From c20093280c2117d72a71c87ef766fd91fedad0d3 Mon Sep 17 00:00:00 2001 From: Agetian Date: Wed, 11 Apr 2018 08:56:14 +0300 Subject: [PATCH] - Do not consider "indirect Planeswalker burn" when deliberately evaluating a planeswalker vs. a player target (the clause must be removed and set as default later when the planeswalker redirection rule is fully removed). --- .../src/main/java/forge/ai/ability/DamageAiBase.java | 11 +++++++++-- .../src/main/java/forge/ai/ability/DamageDealAi.java | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ability/DamageAiBase.java b/forge-ai/src/main/java/forge/ai/ability/DamageAiBase.java index 29920d40736..ec4ade1a03c 100644 --- a/forge-ai/src/main/java/forge/ai/ability/DamageAiBase.java +++ b/forge-ai/src/main/java/forge/ai/ability/DamageAiBase.java @@ -44,6 +44,11 @@ public abstract class DamageAiBase extends SpellAbilityAi { } protected boolean shouldTgtP(final Player comp, final SpellAbility sa, final int d, final boolean noPrevention) { + // TODO: once the "planeswalker redirection" rule is removed completely, just remove this code and + // remove the "burn Planeswalkers" code in the called method. + return shouldTgtP(comp, sa, d, noPrevention, false); + } + protected boolean shouldTgtP(final Player comp, final SpellAbility sa, final int d, final boolean noPrevention, final boolean noPlaneswalkerRedirection) { int restDamage = d; final Game game = comp.getGame(); Player enemy = ComputerUtil.getOpponentFor(comp); @@ -78,8 +83,10 @@ public abstract class DamageAiBase extends SpellAbilityAi { } // burn Planeswalkers - if (Iterables.any(enemy.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.PLANESWALKERS)) { - return true; + if (!noPlaneswalkerRedirection) { + if (Iterables.any(enemy.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.PLANESWALKERS)) { + return true; + } } if (avoidTargetP(comp, sa)) { diff --git a/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java b/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java index 65aab027ede..c918723848b 100644 --- a/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java @@ -533,7 +533,7 @@ public class DamageDealAi extends DamageAiBase { if (tgt.canTgtPlaneswalker()) { // We can damage planeswalkers with this, consider targeting. Card c = this.dealDamageChooseTgtPW(ai, sa, dmg, noPrevention, enemy, false); - if (c != null) { + if (c != null && !this.shouldTgtP(ai, sa, dmg, noPrevention, true)) { tcs.add(c); if (divided) { final int assignedDamage = ComputerUtilCombat.getEnoughDamageToKill(c, dmg, source, false, noPrevention);