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

Method shouldFight

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

Source from the content-addressed store, hash-verified

299 }
300
301 private static boolean shouldFight(Card fighter, Card opponent, int pumpAttack, int pumpDefense) {
302 if (canKill(fighter, opponent, pumpAttack)) {
303 if (!canKill(opponent, fighter, -pumpDefense)) { // can survive
304 return true;
305 }
306 if (MyRandom.getRandom().nextInt(20) < (opponent.getCMC() - fighter.getCMC())) { // trade
307 return true;
308 }
309 }
310 return false;
311 }
312
313 public static boolean canKill(Card fighter, Card opponent, int pumpAttack) {
314 if (opponent.getSVar("Targeting").equals("Dies")) {

Callers 1

canFightMethod · 0.95

Calls 3

canKillMethod · 0.95
getRandomMethod · 0.95
getCMCMethod · 0.45

Tested by

no test coverage detected