From 5328e443db9df3fa4fab05658160f12d60b2d6bf Mon Sep 17 00:00:00 2001 From: Agetian Date: Thu, 24 Aug 2017 17:44:03 +0000 Subject: [PATCH] - Fixed the AI tapping a creature for mana to cast a pump instant/sorcery spell on that creature. --- .../main/java/forge/ai/ComputerUtilMana.java | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java b/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java index 9113ddf8a49..83424fdf3b6 100644 --- a/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java +++ b/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java @@ -203,20 +203,33 @@ public class ComputerUtilMana { continue; } - if (sa.getHostCard() != null && sa.getApi() == ApiType.Animate) { - // For abilities like Genju of the Cedars, make sure that we're not activating the aura ability by tapping the enchanted card for mana - if (sa.getHostCard().isAura() && "Enchanted".equals(sa.getParam("Defined")) - && ma.getHostCard() == sa.getHostCard().getEnchantingCard() - && ma.getPayCosts().hasTapCost()) { - continue; + if (sa.getHostCard() != null) { + if (sa.getApi() == ApiType.Animate) { + // For abilities like Genju of the Cedars, make sure that we're not activating the aura ability by tapping the enchanted card for mana + if (sa.getHostCard().isAura() && "Enchanted".equals(sa.getParam("Defined")) + && ma.getHostCard() == sa.getHostCard().getEnchantingCard() + && ma.getPayCosts().hasTapCost()) { + continue; + } + + // If a manland was previously animated this turn, do not tap it to animate another manland + if (sa.getHostCard().isLand() && ma.getHostCard().isLand() + && ai.getController() instanceof PlayerControllerAi + && AnimateAi.isAnimatedThisTurn(ai, ma.getHostCard())) { + continue; + } + } else if (sa.getApi() == ApiType.Pump) { + if ((sa.getHostCard().isInstant() || sa.getHostCard().isSorcery()) + && ma.getHostCard().isCreature() + && ai.getController().isAI() + && ma.getPayCosts().hasTapCost() + && sa.getTargets().getTargetCards().contains(ma.getHostCard())) { + // do not activate pump instants targeting creatures by tapping targeted + // creatures for mana (for example, Servant of the Conduit) + continue; + } } - // If a manland was previously animated this turn, do not tap it to animate another manland - if (sa.getHostCard().isLand() && ma.getHostCard().isLand() - && ai.getController() instanceof PlayerControllerAi - && AnimateAi.isAnimatedThisTurn(ai, ma.getHostCard())) { - continue; - } } SpellAbility paymentChoice = ma;