mana effect - will give all colors to choose from if manaAb.expressChoice was empty

This commit is contained in:
Maxmtg
2014-02-03 06:41:14 +00:00
parent 9cd2bc595d
commit a1886d51f8

View File

@@ -58,7 +58,7 @@ public class ManaEffect extends SpellAbilityEffect {
String choice = ""; String choice = "";
byte chosenColor = activator.getController().chooseColor("Select Mana to Produce", sa, colorOptions); byte chosenColor = activator.getController().chooseColor("Select Mana to Produce", sa, colorOptions);
if (chosenColor == 0) if (chosenColor == 0)
throw new RuntimeException("AbilityFactoryMana::manaResolve() - " + activator + " color mana choice is empty for " + card.getName()); throw new RuntimeException("ManaEffect::resolve() /*combo mana*/ - " + activator + " color mana choice is empty for " + card.getName());
choice = MagicColor.toShortString(chosenColor); choice = MagicColor.toShortString(chosenColor);
if (nMana != 1) { if (nMana != 1) {
@@ -81,21 +81,15 @@ public class ManaEffect extends SpellAbilityEffect {
String choice = ""; String choice = "";
ColorSet colorMenu = null; ColorSet colorMenu = null;
if (colorsNeeded.length() > 1 && colorsNeeded.length() < 5) { byte mask = 0;
byte mask = 0; //loop through colors to make menu
//loop through colors to make menu for (int nChar = 0; nChar < colorsNeeded.length(); nChar++) {
for (int nChar = 0; nChar < colorsNeeded.length(); nChar++) { mask |= MagicColor.fromName(colorsNeeded.charAt(nChar));
mask |= forge.card.MagicColor.fromName(colorsNeeded.substring(nChar, nChar + 1));
}
colorMenu = ColorSet.fromMask(mask);
}
else {
colorMenu = ColorSet.fromNames(MagicColor.Constant.ONLY_COLORS);
} }
colorMenu = ColorSet.fromMask(mask == 0 ? MagicColor.ALL_COLORS : mask);
byte val = act.getController().chooseColor("Select Mana to Produce", sa, colorMenu); byte val = act.getController().chooseColor("Select Mana to Produce", sa, colorMenu);
if (0 == val) { if (0 == val) {
throw new RuntimeException("AbilityFactoryMana::manaResolve() - " + act + " color mana choice is empty for " + card.getName()); throw new RuntimeException("ManaEffect::resolve() /*any mana*/ - " + act + " color mana choice is empty for " + card.getName());
} }
choice = MagicColor.toShortString(val); choice = MagicColor.toShortString(val);