diff --git a/forge-gui/src/main/java/forge/game/spellability/AbilityManaPart.java b/forge-gui/src/main/java/forge/game/spellability/AbilityManaPart.java index fdb1253bdf5..c5fce752b81 100644 --- a/forge-gui/src/main/java/forge/game/spellability/AbilityManaPart.java +++ b/forge-gui/src/main/java/forge/game/spellability/AbilityManaPart.java @@ -59,7 +59,7 @@ public class AbilityManaPart implements java.io.Serializable { private final String addsCounters; private final boolean persistentMana; private String manaReplaceType; - + private transient ArrayList lastManaProduced = new ArrayList(); private final transient Card sourceCard; @@ -174,7 +174,7 @@ public class AbilityManaPart implements java.io.Serializable { *

* cannotCounterPaidWith. *

- * @param saBeingPaid + * @param saBeingPaid * * @return a {@link java.lang.String} object. */ @@ -191,7 +191,7 @@ public class AbilityManaPart implements java.io.Serializable { *

* addKeywords. *

- * @param saBeingPaid + * @param saBeingPaid * * @return a {@link java.lang.String} object. */ @@ -203,7 +203,7 @@ public class AbilityManaPart implements java.io.Serializable { *

* getKeywords. *

- * @param saBeingPaid + * @param saBeingPaid * * @return a {@link java.lang.String} object. */ @@ -215,7 +215,7 @@ public class AbilityManaPart implements java.io.Serializable { *

* addsCounters. *

- * @param saBeingPaid + * @param saBeingPaid * * @return a {@link java.lang.String} object. */ @@ -348,8 +348,8 @@ public class AbilityManaPart implements java.io.Serializable { if(cs.hasRed()) sb.append("R "); if(cs.hasGreen()) sb.append("G "); this.lastExpressChoice = sb.toString().trim(); - } - + } + /** *

* Getter for the field lastAnyChoice. @@ -437,7 +437,7 @@ public class AbilityManaPart implements java.io.Serializable { public final boolean canProduce(final String s) { return canProduce(s, null); } - + /** *

* canProduce. @@ -452,7 +452,7 @@ public class AbilityManaPart implements java.io.Serializable { return true; } - if (this.getOrigProduced().contains("Chosen") && sourceCard != null ) { + if (this.getOrigProduced().contains("Chosen") && sourceCard != null ) { List chosenCol = this.getSourceCard().getChosenColor(); if ( !chosenCol.isEmpty() && MagicColor.toShortString(chosenCol.get(0)).contains(s)) { return true; @@ -610,7 +610,7 @@ public class AbilityManaPart implements java.io.Serializable { StringBuffer sb = new StringBuffer(); while(m.find()) { if (m.group().matches("[0-9][0-9]?")) { - final String rep = StringUtils.repeat(repMap.get("[0-9][0-9]?") + " ", + final String rep = StringUtils.repeat(repMap.get("[0-9][0-9]?") + " ", Integer.parseInt(m.group())).trim(); m.appendReplacement(sb, rep); } else { diff --git a/forge-gui/src/main/java/forge/gui/input/InputPayMana.java b/forge-gui/src/main/java/forge/gui/input/InputPayMana.java index 66f956abaaa..289ee794196 100644 --- a/forge-gui/src/main/java/forge/gui/input/InputPayMana.java +++ b/forge-gui/src/main/java/forge/gui/input/InputPayMana.java @@ -164,21 +164,29 @@ public abstract class InputPayMana extends InputSyncronizedBase { boolean choice = true; if (guessAbilityWithRequiredColors) { // express Mana Choice - final ArrayList colorMatches = new ArrayList(); - for (SpellAbility sa : abilities) { - if (colorNeeded != 0 && abilityProducesManaColor(sa, sa.getManaPartRecursive(), colorNeeded)) { - colorMatches.add(sa); - } - } - - if (colorMatches.isEmpty()) { - // can only match colorless just grab the first and move on. - // This is wrong. Sometimes all abilities aren't created equal + 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 if (colorMatches.size() < abilities.size()) { - // leave behind only color matches - abilities = colorMatches; + else { + final ArrayList colorMatches = new ArrayList(); + for (SpellAbility sa : abilities) { + if (abilityProducesManaColor(sa, sa.getManaPartRecursive(), colorNeeded)) { + colorMatches.add(sa); + } + } + + if (colorMatches.isEmpty()) { + // can only match colorless just grab the first and move on. + // This is wrong. Sometimes all abilities aren't created equal + choice = false; + } + else if (colorMatches.size() < abilities.size()) { + // leave behind only color matches + abilities = colorMatches; + } } }