Fix AI casting without paying mana cost using X values

This commit is contained in:
tool4EvEr
2021-05-22 19:38:55 +02:00
parent 83f4a5ea73
commit f434be45b6

View File

@@ -113,8 +113,7 @@ public class CounterAi extends SpellAbilityAi {
boolean setPayX = false; boolean setPayX = false;
if (unlessCost.equals("X") && sa.getSVar(unlessCost).equals("Count$xPaid")) { if (unlessCost.equals("X") && sa.getSVar(unlessCost).equals("Count$xPaid")) {
setPayX = true; setPayX = true;
// TODO use ComputerUtilCost.getMaxXValue toPay = Math.min(ComputerUtilCost.getMaxXValue(sa, ai), usableManaSources + 1);
toPay = Math.min(ComputerUtilMana.determineLeftoverMana(sa, ai), usableManaSources + 1);
} else { } else {
toPay = AbilityUtils.calculateAmount(source, unlessCost, sa); toPay = AbilityUtils.calculateAmount(source, unlessCost, sa);
} }
@@ -124,8 +123,7 @@ public class CounterAi extends SpellAbilityAi {
} }
if (toPay <= usableManaSources) { if (toPay <= usableManaSources) {
// If this is a reusable Resource, feel free to play it most of // If this is a reusable Resource, feel free to play it most of the time
// the time
if (!SpellAbilityAi.playReusable(ai,sa)) { if (!SpellAbilityAi.playReusable(ai,sa)) {
return false; return false;
} }