From bd9ee4f24d8011e52e22705d53fbe5860fa758bd Mon Sep 17 00:00:00 2001 From: drdev Date: Sat, 26 Sep 2015 15:01:45 +0000 Subject: [PATCH] Avoid being unnecessarily prompted when tapping multi-color creature for convoke --- .../main/java/forge/game/mana/ManaCostBeingPaid.java | 8 ++++++++ .../forge/match/input/InputSelectCardsForConvoke.java | 11 ++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/forge-game/src/main/java/forge/game/mana/ManaCostBeingPaid.java b/forge-game/src/main/java/forge/game/mana/ManaCostBeingPaid.java index 96a81c7bd6b..c454c9a3777 100644 --- a/forge-game/src/main/java/forge/game/mana/ManaCostBeingPaid.java +++ b/forge-game/src/main/java/forge/game/mana/ManaCostBeingPaid.java @@ -580,4 +580,12 @@ public class ManaCostBeingPaid { } return 0; } + + public final byte getUnpaidColors() { + byte result = 0; + for (ManaCostShard s : unpaidShards.keySet()) { + result |= s.getColorMask(); + } + return result; + } } diff --git a/forge-gui/src/main/java/forge/match/input/InputSelectCardsForConvoke.java b/forge-gui/src/main/java/forge/match/input/InputSelectCardsForConvoke.java index 532c8a53a8e..ff4ab5bc7ad 100644 --- a/forge-gui/src/main/java/forge/match/input/InputSelectCardsForConvoke.java +++ b/forge-gui/src/main/java/forge/match/input/InputSelectCardsForConvoke.java @@ -54,12 +54,17 @@ public final class InputSelectCardsForConvoke extends InputSelectManyBase } else { byte chosenColor; - final ColorSet colors = CardUtil.getColors(card); - if (colors.isMonoColor()) { + ColorSet colors = CardUtil.getColors(card); + if (colors.isMulticolor()) { + //if card is multicolor, strip out any colors which can't be paid towards remaining cost + colors = ColorSet.fromMask(colors.getColor() & remainingCost.getUnpaidColors()); + } + if (!colors.isMulticolor()) { // Since the convoke mana logic can use colored mana as colorless if needed, // there is no need to prompt the user when convoking with a mono-color creature. chosenColor = colors.getColor(); - } else { + } + else { //prompt user if more than one option for which color to pay towards convoke chosenColor = player.getController().chooseColorAllowColorless("Convoke " + card.toString() + " for which color?", card, colors); } final ManaCostShard shard = remainingCost.payManaViaConvoke(chosenColor);