Prevent crash with Back for More

This commit is contained in:
Adam Pantel
2021-02-16 15:14:10 -05:00
parent d0e8052c9f
commit 9ecad3f775

View File

@@ -51,7 +51,11 @@ public class FightAi extends SpellAbilityAi {
// assumes the triggered card belongs to the ai // assumes the triggered card belongs to the ai
if (sa.hasParam("Defined")) { if (sa.hasParam("Defined")) {
Card fighter1 = AbilityUtils.getDefinedCards(source, sa.getParam("Defined"), sa).get(0); CardCollection fighter1List = AbilityUtils.getDefinedCards(source, sa.getParam("Defined"), sa);
if (fighter1List.isEmpty()) {
return true;
}
Card fighter1 = fighter1List.get(0);
for (Card humanCreature : humCreatures) { for (Card humanCreature : humCreatures) {
if (ComputerUtilCombat.getDamageToKill(humanCreature) <= fighter1.getNetPower() if (ComputerUtilCombat.getDamageToKill(humanCreature) <= fighter1.getNetPower()
&& humanCreature.getNetPower() < ComputerUtilCombat.getDamageToKill(fighter1)) { && humanCreature.getNetPower() < ComputerUtilCombat.getDamageToKill(fighter1)) {