From 709e04d9add5aaf4224d86d8dc5a88494eadf3e7 Mon Sep 17 00:00:00 2001 From: Agetian Date: Wed, 12 Dec 2018 10:08:00 +0300 Subject: [PATCH] - Don't try to chain a pump spell to a damage spell targeting a player. --- .../src/main/java/forge/ai/ability/DamageDealAi.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 58df2e8cc7b..bf247dfb109 100644 --- a/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java @@ -228,8 +228,16 @@ public class DamageDealAi extends DamageAiBase { // test what happens if we chain this to another damaging spell if (chainDmg != null && ai.getController().isAI()) { int extraDmg = chainDmg.getValue(); - if (!this.damageTargetAI(ai, sa, dmg + extraDmg, false)) { + boolean willTargetIfChained = this.damageTargetAI(ai, sa, dmg + extraDmg, false); + if (!willTargetIfChained) { return false; // won't play it even in chain + } else if (willTargetIfChained && chainDmg.getKey().getApi() == ApiType.Pump && sa.getTargets().isTargetingAnyPlayer()) { + // we're trying to chain a pump spell to a damage spell targeting a player, that won't work + // so run an additional check to ensure that we want to cast the current spell separately + sa.resetTargets(); + if (!this.damageTargetAI(ai, sa, dmg, false)) { + return false; + } } else { // we are about to decide to play this damage spell; if there's something chained to it, reserve mana for // the second spell so we don't misplay