From 242b510f2649716bf602248dbdcb6510f555860b Mon Sep 17 00:00:00 2001 From: Sloth Date: Sun, 26 Oct 2014 08:39:17 +0000 Subject: [PATCH] - Improved CountersPutAi. --- .../java/forge/ai/ability/CountersPutAi.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java b/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java index 4ef5447aed6..0fdd0de73c8 100644 --- a/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java @@ -158,6 +158,12 @@ public class CountersPutAi extends SpellAbilityAi { amount = ComputerUtilMana.determineLeftoverMana(sa, ai); 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"))) { List humCreatures = ai.getOpponent().getCreaturesInPlay(); //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 if (abTgt != null) { sa.resetTargets(); @@ -284,12 +285,15 @@ public class CountersPutAi extends SpellAbilityAi { return true; } - // Don't use non P1P1/M1M1 counters before main 2 if possible - if (ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) - && !sa.hasParam("ActivationPhases") - && !(type.equals("P1P1") || type.equals("M1M1")) - && !ComputerUtil.castSpellInMain1(ai, sa)) { - return false; + if (!type.equals("P1P1") && !type.equals("M1M1") && !sa.hasParam("ActivationPhases")) { + // Don't use non P1P1/M1M1 counters before main 2 if possible + if (ph.getPhase().isBefore(PhaseType.MAIN2) + && !ComputerUtil.castSpellInMain1(ai, sa)) { + return false; + } + if (ph.isPlayerTurn(ai) && !isSorcerySpeed(sa)) { + return false; + } } if (ComputerUtil.waitForBlocking(sa)) {