- 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.

This commit is contained in:
Agetian
2017-06-10 19:30:53 +00:00
parent a4fdd54424
commit c096079b61

View File

@@ -1309,7 +1309,7 @@ public class ComputerUtilMana {
*/ */
public static int determineLeftoverMana(final SpellAbility sa, final Player player) { public static int determineLeftoverMana(final SpellAbility sa, final Player player) {
for (int i = 1; i < 100; i++) { for (int i = 1; i < 100; i++) {
if (!canPayManaCost(sa, player, i)) { if (!canPayManaCost(sa.getRootAbility(), player, i)) {
return i - 1; return i - 1;
} }
} }
@@ -1331,7 +1331,7 @@ public class ComputerUtilMana {
* @since 1.5.59 * @since 1.5.59
*/ */
public static int determineLeftoverMana(final SpellAbility sa, final Player player, final String shardColor) { 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; String shardSurplus = shardColor;
for (int i = 1; i < 100; i++) { for (int i = 1; i < 100; i++) {