- Improved CountersPutAi.

This commit is contained in:
Sloth
2014-10-26 08:39:17 +00:00
parent c8e538da45
commit 242b510f26

View File

@@ -158,6 +158,12 @@ public class CountersPutAi extends SpellAbilityAi {
amount = ComputerUtilMana.determineLeftoverMana(sa, ai); amount = ComputerUtilMana.determineLeftoverMana(sa, ai);
source.setSVar("PayX", Integer.toString(amount)); source.setSVar("PayX", Integer.toString(amount));
} }
// don't use it if no counters to add
if (amount <= 0) {
return false;
}
if ("Polukranos".equals(sa.getParam("AILogic"))) { if ("Polukranos".equals(sa.getParam("AILogic"))) {
List<Card> humCreatures = ai.getOpponent().getCreaturesInPlay(); List<Card> humCreatures = ai.getOpponent().getCreaturesInPlay();
//TODO how to grab target restrictions from subsequent triggered ability? //TODO how to grab target restrictions from subsequent triggered ability?
@@ -187,11 +193,6 @@ public class CountersPutAi extends SpellAbilityAi {
} }
} }
// don't use it if no counters to add
if (amount <= 0) {
return false;
}
// Targeting // Targeting
if (abTgt != null) { if (abTgt != null) {
sa.resetTargets(); sa.resetTargets();
@@ -284,12 +285,15 @@ public class CountersPutAi extends SpellAbilityAi {
return true; return true;
} }
// Don't use non P1P1/M1M1 counters before main 2 if possible if (!type.equals("P1P1") && !type.equals("M1M1") && !sa.hasParam("ActivationPhases")) {
if (ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) // Don't use non P1P1/M1M1 counters before main 2 if possible
&& !sa.hasParam("ActivationPhases") if (ph.getPhase().isBefore(PhaseType.MAIN2)
&& !(type.equals("P1P1") || type.equals("M1M1")) && !ComputerUtil.castSpellInMain1(ai, sa)) {
&& !ComputerUtil.castSpellInMain1(ai, sa)) { return false;
return false; }
if (ph.isPlayerTurn(ai) && !isSorcerySpeed(sa)) {
return false;
}
} }
if (ComputerUtil.waitForBlocking(sa)) { if (ComputerUtil.waitForBlocking(sa)) {