Adds check for X cannot be zero for AI player

This commit is contained in:
Wendell Wilkerson
2021-08-14 23:34:18 -05:00
parent afae2ef25a
commit 9da3686ecb

View File

@@ -1504,6 +1504,11 @@ public class ComputerUtilMana {
manaToAdd = AbilityUtils.calculateAmount(card, "X", sa) * xCounter; manaToAdd = AbilityUtils.calculateAmount(card, "X", sa) * xCounter;
} }
if (manaToAdd < 1 && !payCosts.getCostMana().canXbe0()) {
// AI cannot really handle X costs properly but this keeps AI form violating rules
manaToAdd = 1;
}
String xColor = sa.getParamOrDefault("XColor", "1"); String xColor = sa.getParamOrDefault("XColor", "1");
if (card.hasKeyword("Spend only colored mana on X. No more than one mana of each color may be spent this way.")) { if (card.hasKeyword("Spend only colored mana on X. No more than one mana of each color may be spent this way.")) {
xColor = "WUBRGX"; xColor = "WUBRGX";