From 80459bfbbd1b7d0cd938b10493328226b0d93219 Mon Sep 17 00:00:00 2001 From: Agetian Date: Thu, 28 Sep 2017 06:24:44 +0000 Subject: [PATCH] - AI should not be so reckless with triggered pumps that result in losing the card at end of turn (e.g. Hazoret's Favor) git-svn-id: http://svn.slightlymagic.net/forge/trunk@35806 269b9781-a132-4a9b-9d4e-f004f1b56b58 --- forge-ai/src/main/java/forge/ai/ComputerUtilCard.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ComputerUtilCard.java b/forge-ai/src/main/java/forge/ai/ComputerUtilCard.java index b4a5e183..9c62422b 100644 --- a/forge-ai/src/main/java/forge/ai/ComputerUtilCard.java +++ b/forge-ai/src/main/java/forge/ai/ComputerUtilCard.java @@ -1196,6 +1196,8 @@ public class ComputerUtilCard { final PhaseHandler phase = game.getPhaseHandler(); final Combat combat = phase.getCombat(); final boolean isBerserk = "Berserk".equals(sa.getParam("AILogic")); + final boolean loseCardAtEOT = "Sacrifice".equals(sa.getParam("AtEOT")) || "Exile".equals(sa.getParam("AtEOT")) + || "Destroy".equals(sa.getParam("AtEOT")) || "ExileCombat".equals(sa.getParam("AtEOT")); boolean combatTrick = false; boolean holdCombatTricks = false; @@ -1236,8 +1238,8 @@ public class ComputerUtilCard { return true; } - // buff attacker/blocker using triggered pump - if (immediately && phase.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)) { + // buff attacker/blocker using triggered pump (unless it's lethal and we don't want to be reckless) + if (immediately && phase.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS) && !loseCardAtEOT) { if (phase.isPlayerTurn(ai)) { if (CombatUtil.canAttack(c)) { return true; @@ -1315,7 +1317,7 @@ public class ComputerUtilCard { boolean pumpedWillDie = false; final boolean isAttacking = combat.isAttacking(c); - if (isBerserk && isAttacking) { pumpedWillDie = true; } + if ((isBerserk && isAttacking) || loseCardAtEOT) { pumpedWillDie = true; } if (isAttacking) { pumpedCombat.addAttacker(pumped, opp);