- Moved canBeBlockedProfitably() from AiBlockController to ComputerUtilCard

This commit is contained in:
excessum
2014-09-24 13:12:52 +00:00
parent 14c4b95658
commit 7226e24cf5
3 changed files with 15 additions and 14 deletions

View File

@@ -1013,7 +1013,7 @@ public class AiAttackController {
}
}
}
if (AiBlockController.canBeBlockedProfitably(defendingOpponent, attacker)) {
if (ComputerUtilCard.canBeBlockedProfitably(defendingOpponent, attacker)) {
canKillAllDangerous = false;
}

View File

@@ -927,17 +927,4 @@ public class AiBlockController {
return first;
}
/**
* Check if an attacker can be blocked profitably (ie. kill attacker)
* @param ai controller of attacking creature
* @param attacker attacking creature to evaluate
* @return attacker will die
*/
public static boolean canBeBlockedProfitably(final Player ai, Card attacker) {
AiBlockController aiBlk = new AiBlockController(ai);
Combat combat = new Combat(ai);
combat.addAttacker(attacker, ai);
aiBlk.assignBlockers(combat, null, attacker);
return ComputerUtilCombat.attackerWouldBeDestroyed(ai, attacker, combat);
}
}

View File

@@ -674,6 +674,20 @@ public class ComputerUtilCard {
}
}
/**
* Check if an attacker can be blocked profitably (ie. kill attacker)
* @param ai controller of attacking creature
* @param attacker attacking creature to evaluate
* @return attacker will die
*/
public static boolean canBeBlockedProfitably(final Player ai, Card attacker) {
AiBlockController aiBlk = new AiBlockController(ai);
Combat combat = new Combat(ai);
combat.addAttacker(attacker, ai);
aiBlk.assignBlockers(combat, null, attacker);
return ComputerUtilCombat.attackerWouldBeDestroyed(ai, attacker, combat);
}
/**
* getMostExpensivePermanentAI.
*