- Fixed "human can kill" test in DestroyAllAi.

This commit is contained in:
Sloth
2015-03-01 08:31:21 +00:00
parent eaf8250832
commit c22d9eff42

View File

@@ -113,6 +113,10 @@ public class DestroyAllAi extends SpellAbilityAi {
if (ComputerUtil.preventRunAwayActivations(sa)) { if (ComputerUtil.preventRunAwayActivations(sa)) {
return false; return false;
} }
if (humanlist.isEmpty()) {
return false;
}
// if only creatures are affected evaluate both lists and pass only if // if only creatures are affected evaluate both lists and pass only if
// human creatures are more valuable // human creatures are more valuable
@@ -127,8 +131,15 @@ public class DestroyAllAi extends SpellAbilityAi {
// test whether the human can kill the ai next turn // test whether the human can kill the ai next turn
Combat combat = new Combat(ai.getOpponent()); Combat combat = new Combat(ai.getOpponent());
boolean containsAttacker = false;
for (Card att : ai.getOpponent().getCreaturesInPlay()) { 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); AiBlockController block = new AiBlockController(ai);
block.assignBlockersForCombat(combat); block.assignBlockersForCombat(combat);
@@ -146,8 +157,7 @@ public class DestroyAllAi extends SpellAbilityAi {
return false; return false;
} }
} // otherwise evaluate both lists by CMC and pass only if human permanents are more valuable } // otherwise evaluate both lists by CMC and pass only if human permanents are more valuable
else if ((ComputerUtilCard.evaluatePermanentList(computerlist) + 3) >= ComputerUtilCard else if ((ComputerUtilCard.evaluatePermanentList(computerlist) + 3) >= ComputerUtilCard.evaluatePermanentList(humanlist)) {
.evaluatePermanentList(humanlist)) {
return false; return false;
} }