mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
- Moved canBeBlockedProfitably() from AiBlockController to ComputerUtilCard
This commit is contained in:
@@ -1013,7 +1013,7 @@ public class AiAttackController {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (AiBlockController.canBeBlockedProfitably(defendingOpponent, attacker)) {
|
||||
if (ComputerUtilCard.canBeBlockedProfitably(defendingOpponent, attacker)) {
|
||||
canKillAllDangerous = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user