Avoid prompting for color when using "Add one mana of any color" effect to pay for a colorless cost

This commit is contained in:
drdev
2013-12-12 12:43:50 +00:00
parent 849655cb2f
commit bdfd2e9adf
2 changed files with 31 additions and 23 deletions

View File

@@ -164,9 +164,16 @@ public abstract class InputPayMana extends InputSyncronizedBase {
boolean choice = true;
if (guessAbilityWithRequiredColors) {
// express Mana Choice
if (colorNeeded == 0) {
choice = false;
//avoid unnecessary prompt by pretending we need White
//for the sake of "Add one mana of any color" effects
colorNeeded = MagicColor.WHITE;
}
else {
final ArrayList<SpellAbility> colorMatches = new ArrayList<SpellAbility>();
for (SpellAbility sa : abilities) {
if (colorNeeded != 0 && abilityProducesManaColor(sa, sa.getManaPartRecursive(), colorNeeded)) {
if (abilityProducesManaColor(sa, sa.getManaPartRecursive(), colorNeeded)) {
colorMatches.add(sa);
}
}
@@ -181,6 +188,7 @@ public abstract class InputPayMana extends InputSyncronizedBase {
abilities = colorMatches;
}
}
}
final SpellAbility chosen = abilities.size() > 1 && choice ? GuiChoose.one("Choose mana ability", abilities) : abilities.get(0);
ColorSet colors = ColorSet.fromMask(0 == colorNeeded ? colorCanUse : colorNeeded);