From c096079b61bab616b135be78d77c8f8e80142c08 Mon Sep 17 00:00:00 2001 From: Agetian Date: Sat, 10 Jun 2017 19:30:53 +0000 Subject: [PATCH] - Experimental: determineLeftoverMana should use the root ability (with the actual mana cost), otherwise it's not always possible to determine the correct mana cost (e.g. for Banefire) and PayX gets set to the wrong (usually too high) value, making the AI unable to play the card. --- forge-ai/src/main/java/forge/ai/ComputerUtilMana.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java b/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java index ac8688dd7f2..16cc37420f3 100644 --- a/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java +++ b/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java @@ -1309,7 +1309,7 @@ public class ComputerUtilMana { */ public static int determineLeftoverMana(final SpellAbility sa, final Player player) { for (int i = 1; i < 100; i++) { - if (!canPayManaCost(sa, player, i)) { + if (!canPayManaCost(sa.getRootAbility(), player, i)) { return i - 1; } } @@ -1331,7 +1331,7 @@ public class ComputerUtilMana { * @since 1.5.59 */ public static int determineLeftoverMana(final SpellAbility sa, final Player player, final String shardColor) { - ManaCost origCost = sa.getPayCosts().getTotalMana(); + ManaCost origCost = sa.getRootAbility().getPayCosts().getTotalMana(); String shardSurplus = shardColor; for (int i = 1; i < 100; i++) {