MCPcopy Create free account
hub / github.com/Card-Forge/forge / canKill

Method canKill

forge-ai/src/main/java/forge/ai/ability/FightAi.java:313–328  ·  view source on GitHub ↗
(Card fighter, Card opponent, int pumpAttack)

Source from the content-addressed store, hash-verified

311 }
312
313 public static boolean canKill(Card fighter, Card opponent, int pumpAttack) {
314 if (opponent.getSVar("Targeting").equals("Dies")) {
315 return true;
316 }
317 // the damage prediction is later
318 int damage = fighter.getNetPower() + pumpAttack;
319 if (damage <= 0 || opponent.getShieldCount() > 0 || ComputerUtil.canRegenerate(opponent.getController(), opponent)) {
320 return false;
321 }
322 // try to predict the damage that fighter would deal to opponent
323 // this should also handle if the opponents creature can be destroyed or not
324 if (ComputerUtilCombat.getEnoughDamageToKill(opponent, damage, fighter, false) <= damage) {
325 return true;
326 }
327 return false;
328 }
329}

Callers 7

considerMethod · 0.95
damageChoosingTargetsMethod · 0.95
checkApiLogicMethod · 0.95
doTriggerNoCostMethod · 0.95
canFightMethod · 0.95
shouldFightMethod · 0.95
checkApiLogicMethod · 0.95

Calls 7

canRegenerateMethod · 0.95
getEnoughDamageToKillMethod · 0.95
getNetPowerMethod · 0.80
getSVarMethod · 0.65
equalsMethod · 0.45
getShieldCountMethod · 0.45
getControllerMethod · 0.45

Tested by

no test coverage detected