From c22d9eff42b1e1de69f5ff95dc9736d2ce69a2b5 Mon Sep 17 00:00:00 2001 From: Sloth Date: Sun, 1 Mar 2015 08:31:21 +0000 Subject: [PATCH] - Fixed "human can kill" test in DestroyAllAi. --- .../main/java/forge/ai/ability/DestroyAllAi.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ability/DestroyAllAi.java b/forge-ai/src/main/java/forge/ai/ability/DestroyAllAi.java index 9ad8ff2cdca..9b9de00e17b 100644 --- a/forge-ai/src/main/java/forge/ai/ability/DestroyAllAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/DestroyAllAi.java @@ -113,6 +113,10 @@ public class DestroyAllAi extends SpellAbilityAi { if (ComputerUtil.preventRunAwayActivations(sa)) { return false; } + + if (humanlist.isEmpty()) { + return false; + } // if only creatures are affected evaluate both lists and pass only if // human creatures are more valuable @@ -127,8 +131,15 @@ public class DestroyAllAi extends SpellAbilityAi { // test whether the human can kill the ai next turn Combat combat = new Combat(ai.getOpponent()); + boolean containsAttacker = false; for (Card att : ai.getOpponent().getCreaturesInPlay()) { - combat.addAttacker(att, ai); + if (ComputerUtilCombat.canAttackNextTurn(att, ai)) { + combat.addAttacker(att, ai); + containsAttacker = containsAttacker | humanlist.contains(att); + } + } + if (!containsAttacker) { + return false; } AiBlockController block = new AiBlockController(ai); block.assignBlockersForCombat(combat); @@ -146,8 +157,7 @@ public class DestroyAllAi extends SpellAbilityAi { return false; } } // otherwise evaluate both lists by CMC and pass only if human permanents are more valuable - else if ((ComputerUtilCard.evaluatePermanentList(computerlist) + 3) >= ComputerUtilCard - .evaluatePermanentList(humanlist)) { + else if ((ComputerUtilCard.evaluatePermanentList(computerlist) + 3) >= ComputerUtilCard.evaluatePermanentList(humanlist)) { return false; }