diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java index 167f66ffb5b3..608fb678e3db 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java @@ -24,7 +24,6 @@ import mage.cards.repository.CardInfo; import mage.cards.repository.CardRepository; import mage.choices.Choice; -import mage.choices.ChoiceColor; import mage.constants.*; import mage.counters.CounterType; import mage.filter.FilterCard; @@ -1956,7 +1955,7 @@ public boolean choose(Outcome outcome, Choice choice, Game game) { } // choose the correct color to pay a spell - if (outcome == Outcome.PutManaInPool && choice instanceof ChoiceColor && currentUnpaidMana != null) { + if (outcome == Outcome.PutManaInPool && choice.isManaColorChoice() && currentUnpaidMana != null) { if (currentUnpaidMana.containsColor(ColoredManaSymbol.W) && choice.getChoices().contains("White")) { choice.setChoice("White"); return true; diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index f797234c3f3a..cf3841c8414c 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -16,7 +16,6 @@ import mage.cards.*; import mage.cards.decks.Deck; import mage.choices.Choice; -import mage.choices.ChoiceColor; import mage.choices.ChoiceImpl; import mage.constants.*; import mage.filter.StaticFilters; @@ -583,7 +582,7 @@ public boolean choose(Outcome outcome, Choice choice, Game game) { } // Try to autopay for mana - if (Outcome.PutManaInPool == outcome && choice instanceof ChoiceColor && currentlyUnpaidMana != null) { + if (Outcome.PutManaInPool == outcome && choice.isManaColorChoice() && currentlyUnpaidMana != null) { // Check check if the spell being paid for cares about the color of mana being paid // See: https://github.com/magefree/mage/issues/9070 boolean caresAboutManaColor = false; diff --git a/Mage.Sets/src/mage/cards/k/KatildaDawnhartPrime.java b/Mage.Sets/src/mage/cards/k/KatildaDawnhartPrime.java index 8e551fd7e7c7..353b036f33e3 100644 --- a/Mage.Sets/src/mage/cards/k/KatildaDawnhartPrime.java +++ b/Mage.Sets/src/mage/cards/k/KatildaDawnhartPrime.java @@ -150,7 +150,7 @@ public Mana produceMana(Game game, Ability source) { if (controller == null || permanent == null) { return new Mana(); } - Choice choice = new ChoiceImpl(); + Choice choice = new ChoiceImpl().setManaColorChoice(true); choice.setMessage("Pick a mana color"); ObjectColor color = permanent.getColor(game); if (color.isWhite()) { diff --git a/Mage.Sets/src/mage/cards/t/TazriStalwartSurvivor.java b/Mage.Sets/src/mage/cards/t/TazriStalwartSurvivor.java index 5e016cadd88f..274420ef428b 100644 --- a/Mage.Sets/src/mage/cards/t/TazriStalwartSurvivor.java +++ b/Mage.Sets/src/mage/cards/t/TazriStalwartSurvivor.java @@ -195,7 +195,7 @@ public Mana produceMana(Game game, Ability source) { if (controller == null || permanent == null) { return new Mana(); } - Choice choice = new ChoiceImpl(); + Choice choice = new ChoiceImpl().setManaColorChoice(true); choice.setMessage("Pick a mana color"); ObjectColor color = permanent.getColor(game); if (color.isWhite()) { diff --git a/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java b/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java index 57d5aa407848..fa0b2aa79798 100644 --- a/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java @@ -106,7 +106,7 @@ public Mana produceMana(Game game, Ability source) { } Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - Choice choice = new ChoiceImpl(); + Choice choice = new ChoiceImpl().setManaColorChoice(true); choice.setMessage("Pick a mana color"); for (UUID commanderId : game.getCommandersIds(controller, CommanderCardType.COMMANDER_OR_OATHBREAKER, false)) { Card commander = game.getCard(commanderId); diff --git a/Mage/src/main/java/mage/choices/Choice.java b/Mage/src/main/java/mage/choices/Choice.java index 2323cbf42e52..49e9558c9121 100644 --- a/Mage/src/main/java/mage/choices/Choice.java +++ b/Mage/src/main/java/mage/choices/Choice.java @@ -41,6 +41,10 @@ public interface Choice extends Serializable, Copyable { ChoiceHintType getHintType(); + boolean isManaColorChoice(); + + Choice setManaColorChoice(boolean manaColorChoice); + // string choice void setChoices(Set choices); diff --git a/Mage/src/main/java/mage/choices/ChoiceColor.java b/Mage/src/main/java/mage/choices/ChoiceColor.java index f8123988cc8f..b3da6bbe0644 100644 --- a/Mage/src/main/java/mage/choices/ChoiceColor.java +++ b/Mage/src/main/java/mage/choices/ChoiceColor.java @@ -47,6 +47,7 @@ public ChoiceColor(boolean required, String chooseMessage, String chooseSubMessa this.setMessage(chooseMessage); this.setSubMessage(chooseSubMessage); + this.manaColorChoice = true; } protected ChoiceColor(final ChoiceColor choice) { diff --git a/Mage/src/main/java/mage/choices/ChoiceImpl.java b/Mage/src/main/java/mage/choices/ChoiceImpl.java index e1b117af0401..3db38909e9a7 100644 --- a/Mage/src/main/java/mage/choices/ChoiceImpl.java +++ b/Mage/src/main/java/mage/choices/ChoiceImpl.java @@ -34,6 +34,8 @@ public class ChoiceImpl implements Choice { protected String specialText = ""; protected String specialHint = ""; + protected boolean manaColorChoice = false; // set true to allow automatic choosing with Outcome.PutManaInPool + public ChoiceImpl() { this(false); } @@ -65,6 +67,7 @@ protected ChoiceImpl(final ChoiceImpl choice) { this.specialCanBeEmpty = choice.specialCanBeEmpty; this.specialText = choice.specialText; this.specialHint = choice.specialHint; + this.manaColorChoice = choice.manaColorChoice; } @Override @@ -328,6 +331,17 @@ public ChoiceHintType getHintType() { return this.hintType; } + @Override + public boolean isManaColorChoice() { + return manaColorChoice; + } + + @Override + public ChoiceImpl setManaColorChoice(boolean manaColorChoice) { + this.manaColorChoice = manaColorChoice; + return this; + } + private void protectFromEmptyChoices() { // if there are no choices then required must be disabled to allow user to close a dialog // example: database error on too low memory, see Brain Pry and 500 Mb server