Prevent prompting for X if user can't control what X is

This commit is contained in:
drdev
2014-09-14 14:49:34 +00:00
parent d7f31fdda6
commit 7cd2081cec

View File

@@ -228,6 +228,8 @@ public class HumanPlaySpellAbility {
} }
if (needX && manaCost != null && manaCost.getAmountOfX() > 0) { if (needX && manaCost != null && manaCost.getAmountOfX() > 0) {
String sVar = ability.getSVar("X"); //only prompt for new X value if card doesn't determine it another way
if ("Count$xPaid".equals(sVar) || StringUtils.isNumeric(sVar)) {
Integer value = controller.announceRequirements(ability, "X", allowZero && manaCost.canXbe0()); Integer value = controller.announceRequirements(ability, "X", allowZero && manaCost.canXbe0());
if (value == null) { if (value == null) {
return false; return false;
@@ -236,11 +238,12 @@ public class HumanPlaySpellAbility {
ability.setSVar("X", value.toString()); ability.setSVar("X", value.toString());
card.setSVar("X", value.toString()); card.setSVar("X", value.toString());
// announce to subabilities // announce to sub-abilities
SpellAbility sub = ability; SpellAbility sub = ability;
while ((sub = sub.getSubAbility()) != null) { while ((sub = sub.getSubAbility()) != null) {
sub.setSVar("X", value.toString()); sub.setSVar("X", value.toString());
}; }
}
} }
return true; return true;
} }