From 9cd2bc595d6eb04f26e5db7b551f7574c25a1e28 Mon Sep 17 00:00:00 2001 From: Agetian Date: Mon, 3 Feb 2014 06:25:51 +0000 Subject: [PATCH] - Fixed ManaEffect with AnyMana crashing, e.g. for Chromatic Star (temporarily fixed it by reverting the relevant part to the previous version, feel free to revert and commit a more optimal fix) --- .../forge/game/ability/effects/ManaEffect.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/effects/ManaEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ManaEffect.java index cd23b2b8bae..07e7527534f 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ManaEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ManaEffect.java @@ -79,15 +79,21 @@ public class ManaEffect extends SpellAbilityEffect { String colorsNeeded = abMana.getExpressChoice(); String choice = ""; - + ColorSet colorMenu = null; - byte mask = 0; - //loop through colors to make menu - for (int nChar = 0; nChar < colorsNeeded.length(); nChar++) { - mask |= MagicColor.fromName(colorsNeeded.charAt(nChar)); + if (colorsNeeded.length() > 1 && colorsNeeded.length() < 5) { + byte mask = 0; + //loop through colors to make menu + for (int nChar = 0; nChar < colorsNeeded.length(); 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); byte val = act.getController().chooseColor("Select Mana to Produce", sa, colorMenu); + if (0 == val) { throw new RuntimeException("AbilityFactoryMana::manaResolve() - " + act + " color mana choice is empty for " + card.getName()); }