From 904e62450c77cab5398bb0d419a9919db2442785 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 30 Nov 2014 23:33:47 +0100 Subject: [PATCH] * Manamorphose - Fixed that color choice was not made during resolving the spell (fixed also some other cards). --- .../mage/sets/apocalypse/IllusionReality.java | 6 +- .../sets/avacynrestored/DruidsRepository.java | 1 - .../EightAndAHalfTale.java | 92 ------------------- .../mage/sets/onslaught/AkromasBlessing.java | 23 +++-- .../sets/onslaught/JarethLeonineTitan.java | 13 ++- .../sets/returntoravnica/DeathriteShaman.java | 1 - .../mage/sets/returntoravnica/ManaBloom.java | 1 - .../riseoftheeldrazi/MulDayaChannelers.java | 1 - .../mage/sets/shadowmoor/Manamorphose.java | 24 ++++- .../mage/sets/timespiral/GemstoneCaverns.java | 2 - .../src/mage/sets/timespiral/LotusBloom.java | 6 +- .../mage/sets/urzassaga/CarpetOfFlowers.java | 24 +++-- .../mage/sets/urzassaga/FertileGround.java | 1 - .../src/mage/sets/urzassaga/Persecute.java | 21 +++-- .../mage/sets/zendikar/BraveTheElements.java | 29 ++++-- .../src/mage/sets/zendikar/KhalniGem.java | 1 - .../src/mage/sets/zendikar/LotusCobra.java | 5 +- .../effects/common/ChooseColorEffect.java | 15 ++- .../continious/SetCardColorTargetEffect.java | 22 ++++- 19 files changed, 133 insertions(+), 155 deletions(-) delete mode 100644 Mage.Sets/src/mage/sets/championsofkamigawa/EightAndAHalfTale.java diff --git a/Mage.Sets/src/mage/sets/apocalypse/IllusionReality.java b/Mage.Sets/src/mage/sets/apocalypse/IllusionReality.java index c05b4300e4..ec2afb1448 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/IllusionReality.java +++ b/Mage.Sets/src/mage/sets/apocalypse/IllusionReality.java @@ -30,12 +30,11 @@ package mage.sets.apocalypse; import java.util.UUID; import mage.abilities.effects.common.DestroyTargetEffect; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.effects.common.continious.SetCardColorTargetEffect; import mage.cards.SplitCard; -import mage.choices.ChoiceColor; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.target.Target; import mage.target.common.TargetArtifactPermanent; import mage.target.common.TargetSpellOrPermanent; @@ -60,7 +59,6 @@ public class IllusionReality extends SplitCard { getLeftHalfCard().getSpellAbility().addEffect(new SetCardColorTargetEffect(Duration.EndOfTurn)); Target target = new TargetSpellOrPermanent(); getLeftHalfCard().getSpellAbility().addTarget(target); - getLeftHalfCard().getSpellAbility().addChoice(new ChoiceColor()); // Reality // Destroy target artifact. diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DruidsRepository.java b/Mage.Sets/src/mage/sets/avacynrestored/DruidsRepository.java index f95645052e..1cde168415 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/DruidsRepository.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/DruidsRepository.java @@ -35,7 +35,6 @@ import mage.abilities.effects.common.AddManaOfAnyColorEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; -import mage.choices.ChoiceColor; import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/EightAndAHalfTale.java b/Mage.Sets/src/mage/sets/championsofkamigawa/EightAndAHalfTale.java deleted file mode 100644 index ef4b64a2a7..0000000000 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/EightAndAHalfTale.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.sets.championsofkamigawa; - -import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; -import mage.MageInt; -import mage.ObjectColor; -import mage.abilities.Ability; -import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.continious.GainAbilityTargetEffect; -import mage.abilities.effects.common.continious.SetCardColorTargetEffect; -import mage.abilities.keyword.ProtectionAbility; -import mage.cards.CardImpl; -import mage.constants.Duration; -import mage.filter.FilterCard; -import mage.filter.predicate.mageobject.ColorPredicate; -import mage.target.common.TargetControlledPermanent; -import mage.target.common.TargetSpellOrPermanent; - -/** - * - * @author LevelX - */ -public class EightAndAHalfTale extends CardImpl { - - private static final FilterCard filter = new FilterCard("white"); - - static { - filter.add(new ColorPredicate(ObjectColor.WHITE)); - } - - public EightAndAHalfTale(UUID ownerId) { - super(ownerId, 8, "Eight-and-a-Half-Tails", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{W}{W}"); - this.expansionSetCode = "CHK"; - this.supertype.add("Legendary"); - this.subtype.add("Fox"); - this.subtype.add("Cleric"); - this.color.setWhite(true); - this.power = new MageInt(2); - this.toughness = new MageInt(2); - // {1}{W}: Target permanent you control gains protection from white until end of turn. - Ability ability1 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect( - new ProtectionAbility(filter), Duration.EndOfTurn), new ManaCostsImpl("{1}{W}")); - ability1.addTarget(new TargetControlledPermanent()); - this.addAbility(ability1); - // {1}: Target spell or permanent becomes white until end of turn. - Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SetCardColorTargetEffect( - ObjectColor.WHITE, Duration.EndOfTurn),new ManaCostsImpl("{1}")); - ability2.addTarget(new TargetSpellOrPermanent()); - this.addAbility(ability2); - - } - - public EightAndAHalfTale(final EightAndAHalfTale card) { - super(card); - } - - @Override - public EightAndAHalfTale copy() { - return new EightAndAHalfTale(this); - } -} diff --git a/Mage.Sets/src/mage/sets/onslaught/AkromasBlessing.java b/Mage.Sets/src/mage/sets/onslaught/AkromasBlessing.java index 68774bf68e..c37ae10d0b 100644 --- a/Mage.Sets/src/mage/sets/onslaught/AkromasBlessing.java +++ b/Mage.Sets/src/mage/sets/onslaught/AkromasBlessing.java @@ -37,10 +37,12 @@ import mage.cards.CardImpl; import mage.choices.ChoiceColor; import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Outcome; import mage.constants.Rarity; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; +import mage.players.Player; /** * @@ -55,7 +57,6 @@ public class AkromasBlessing extends CardImpl { this.color.setWhite(true); // Choose a color. Creatures you control gain protection from the chosen color until end of turn. - this.getSpellAbility().addChoice(new ChoiceColor()); this.getSpellAbility().addEffect(new AcromasBlessingEffect()); // Cycling {W} this.addAbility(new CyclingAbility(new ManaCostsImpl("{W}"))); @@ -94,11 +95,21 @@ class AcromasBlessingEffect extends GainAbilityControlledEffect { @Override public boolean apply(Game game, Ability source) { - ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); - filter2.add(new ColorPredicate(choice.getColor())); - filter2.setMessage(choice.getChoice()); - setAbility(new ProtectionAbility(new FilterCard(filter2))); - return super.apply(game, source); + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + ChoiceColor choice = new ChoiceColor(); + while (!choice.isChosen()) { + controller.choose(Outcome.Protect, choice, game); + if (!controller.isInGame()) { + return false; + } + } + filter2.add(new ColorPredicate(choice.getColor())); + filter2.setMessage(choice.getChoice()); + setAbility(new ProtectionAbility(new FilterCard(filter2))); + return super.apply(game, source); + } + return false; } } diff --git a/Mage.Sets/src/mage/sets/onslaught/JarethLeonineTitan.java b/Mage.Sets/src/mage/sets/onslaught/JarethLeonineTitan.java index 2cec620207..d6a40e12b9 100644 --- a/Mage.Sets/src/mage/sets/onslaught/JarethLeonineTitan.java +++ b/Mage.Sets/src/mage/sets/onslaught/JarethLeonineTitan.java @@ -48,6 +48,7 @@ import mage.filter.FilterCard; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import mage.game.permanent.Permanent; +import mage.players.Player; /** * @@ -70,7 +71,6 @@ public class JarethLeonineTitan extends CardImpl { this.addAbility(new BlocksTriggeredAbility(new BoostSourceEffect(7,7,Duration.EndOfTurn), false)); // {W}: Jareth gains protection from the color of your choice until end of turn. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new JarethsGainProtectionFromColorSourceEffect(), new ManaCostsImpl("{W}")); - ability.addChoice(new ChoiceColor()); this.addAbility(ability); } @@ -104,9 +104,16 @@ class JarethsGainProtectionFromColorSourceEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); Permanent creature = game.getPermanent(source.getSourceId()); - if (creature != null) { - ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); + if (controller != null && creature != null) { + ChoiceColor choice = new ChoiceColor(); + while (!choice.isChosen()) { + controller.choose(Outcome.Protect, choice, game); + if (!controller.isInGame()) { + return false; + } + } protectionFilter.add(new ColorPredicate(choice.getColor())); protectionFilter.setMessage(choice.getChoice()); ProtectionAbility ability = new ProtectionAbility(protectionFilter); diff --git a/Mage.Sets/src/mage/sets/returntoravnica/DeathriteShaman.java b/Mage.Sets/src/mage/sets/returntoravnica/DeathriteShaman.java index 1fed063669..9c69ad4dcf 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/DeathriteShaman.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/DeathriteShaman.java @@ -41,7 +41,6 @@ import mage.abilities.effects.common.ExileTargetEffect; import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.LoseLifeOpponentsEffect; import mage.cards.CardImpl; -import mage.choices.ChoiceColor; import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.common.FilterCreatureCard; diff --git a/Mage.Sets/src/mage/sets/returntoravnica/ManaBloom.java b/Mage.Sets/src/mage/sets/returntoravnica/ManaBloom.java index f9270bad44..054ae5a3b1 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/ManaBloom.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/ManaBloom.java @@ -48,7 +48,6 @@ import mage.abilities.effects.common.AddManaOfAnyColorEffect; import mage.abilities.effects.common.ReturnToHandSourceEffect; import mage.abilities.mana.ActivateOncePerTurnManaAbility; import mage.cards.CardImpl; -import mage.choices.ChoiceColor; import mage.constants.TargetController; import mage.counters.CounterType; import mage.game.Game; diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/MulDayaChannelers.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/MulDayaChannelers.java index 15a55f0936..3458cbd2fa 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/MulDayaChannelers.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/MulDayaChannelers.java @@ -47,7 +47,6 @@ import mage.abilities.effects.common.continious.PlayWithTheTopCardRevealedEffect import mage.abilities.mana.ManaAbility; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; -import mage.choices.ChoiceColor; import mage.constants.Duration; import mage.game.Game; diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Manamorphose.java b/Mage.Sets/src/mage/sets/shadowmoor/Manamorphose.java index ea9411a278..6211575baf 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/Manamorphose.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/Manamorphose.java @@ -31,11 +31,13 @@ import java.util.UUID; import mage.constants.CardType; import mage.constants.Rarity; import mage.Mana; +import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.ManaEffect; import mage.cards.CardImpl; import mage.choices.ChoiceColor; +import mage.constants.Outcome; import mage.game.Game; import mage.players.Player; @@ -54,8 +56,7 @@ public class Manamorphose extends CardImpl { // Add two mana in any combination of colors to your mana pool. this.getSpellAbility().addEffect(new ManamorphoseEffect()); - this.getSpellAbility().addChoice(new ChoiceColor()); - this.getSpellAbility().addChoice(new ChoiceColor()); + // Draw a card. this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1)); } @@ -93,9 +94,13 @@ class ManamorphoseEffect extends ManaEffect { return false; } + boolean result = false; for (int i = 0; i < 2; i++) { - ChoiceColor choice = (ChoiceColor) source.getChoices().get(i); + ChoiceColor choice = getManaChoice(player, game); + if (choice == null) { + return false; + } Mana mana = null; if (choice.getColor().isBlack()) { mana = Mana.BlackMana(1); @@ -116,4 +121,17 @@ class ManamorphoseEffect extends ManaEffect { } return result; } + + private ChoiceColor getManaChoice(Player controller, Game game) { + ChoiceColor choice = new ChoiceColor(); + while (!choice.isChosen()) { + controller.choose(Outcome.PutManaInPool, choice, game); + if (!controller.isInGame()) { + return null; + } + } + return choice; + } + } + diff --git a/Mage.Sets/src/mage/sets/timespiral/GemstoneCaverns.java b/Mage.Sets/src/mage/sets/timespiral/GemstoneCaverns.java index 6f0e9d4ad1..2171ee5be6 100644 --- a/Mage.Sets/src/mage/sets/timespiral/GemstoneCaverns.java +++ b/Mage.Sets/src/mage/sets/timespiral/GemstoneCaverns.java @@ -37,9 +37,7 @@ import mage.abilities.decorator.ConditionalManaEffect; import mage.abilities.effects.common.AddManaOfAnyColorEffect; import mage.abilities.effects.common.BasicManaEffect; import mage.abilities.mana.ConditionalManaAbility; -import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; -import mage.choices.ChoiceColor; import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; diff --git a/Mage.Sets/src/mage/sets/timespiral/LotusBloom.java b/Mage.Sets/src/mage/sets/timespiral/LotusBloom.java index 029748fa75..ad2ba687e1 100644 --- a/Mage.Sets/src/mage/sets/timespiral/LotusBloom.java +++ b/Mage.Sets/src/mage/sets/timespiral/LotusBloom.java @@ -28,9 +28,6 @@ package mage.sets.timespiral; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.TapSourceCost; @@ -39,7 +36,8 @@ import mage.abilities.effects.common.AddManaOfAnyColorEffect; import mage.abilities.keyword.SuspendAbility; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; -import mage.choices.ChoiceColor; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; /** diff --git a/Mage.Sets/src/mage/sets/urzassaga/CarpetOfFlowers.java b/Mage.Sets/src/mage/sets/urzassaga/CarpetOfFlowers.java index b6e0c1cf8e..b63c5459a3 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/CarpetOfFlowers.java +++ b/Mage.Sets/src/mage/sets/urzassaga/CarpetOfFlowers.java @@ -161,9 +161,15 @@ class CarpetOfFlowersEffect extends ManaEffect { @Override public boolean apply(Game game, Ability source) { - ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); - Player player = game.getPlayer(source.getControllerId()); - if(player != null){ + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null){ + ChoiceColor choice = new ChoiceColor(); + while (!choice.isChosen()) { + controller.choose(Outcome.Protect, choice, game); + if (!controller.isInGame()) { + return false; + } + } int countMax = game.getBattlefield().count(filter, source.getSourceId(), source.getTargets().getFirstTarget(), game); ChoiceImpl choiceCount = new ChoiceImpl(true); LinkedHashSet set = new LinkedHashSet<>(); @@ -173,22 +179,22 @@ class CarpetOfFlowersEffect extends ManaEffect { } choiceCount.setChoices(set); choiceCount.setMessage("Choose number of mana"); - player.choose(Outcome.PutManaInPool, choiceCount, game); + controller.choose(Outcome.PutManaInPool, choiceCount, game); int count = Integer.parseInt(choiceCount.getChoice()); if (choice.getColor().isBlack()) { - player.getManaPool().addMana(new Mana(0, 0, 0, 0, count, 0, 0), game, source); + controller.getManaPool().addMana(new Mana(0, 0, 0, 0, count, 0, 0), game, source); return true; } else if (choice.getColor().isBlue()) { - player.getManaPool().addMana(new Mana(0, 0, count, 0, 0, 0, 0), game, source); + controller.getManaPool().addMana(new Mana(0, 0, count, 0, 0, 0, 0), game, source); return true; } else if (choice.getColor().isRed()) { - player.getManaPool().addMana(new Mana(count, 0, 0, 0, 0, 0, 0), game, source); + controller.getManaPool().addMana(new Mana(count, 0, 0, 0, 0, 0, 0), game, source); return true; } else if (choice.getColor().isGreen()) { - player.getManaPool().addMana(new Mana(0, count, 0, 0, 0, 0, 0), game, source); + controller.getManaPool().addMana(new Mana(0, count, 0, 0, 0, 0, 0), game, source); return true; } else if (choice.getColor().isWhite()) { - player.getManaPool().addMana(new Mana(0, 0, 0, count, 0, 0, 0), game, source); + controller.getManaPool().addMana(new Mana(0, 0, 0, count, 0, 0, 0), game, source); return true; } } diff --git a/Mage.Sets/src/mage/sets/urzassaga/FertileGround.java b/Mage.Sets/src/mage/sets/urzassaga/FertileGround.java index b67749c1fc..c7331e9c8c 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/FertileGround.java +++ b/Mage.Sets/src/mage/sets/urzassaga/FertileGround.java @@ -34,7 +34,6 @@ import mage.abilities.effects.common.AttachEffect; import mage.abilities.keyword.EnchantAbility; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; -import mage.choices.ChoiceColor; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; diff --git a/Mage.Sets/src/mage/sets/urzassaga/Persecute.java b/Mage.Sets/src/mage/sets/urzassaga/Persecute.java index 6aa9ea607b..5d7d1f7630 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/Persecute.java +++ b/Mage.Sets/src/mage/sets/urzassaga/Persecute.java @@ -56,7 +56,6 @@ public class Persecute extends CardImpl { // Choose a color. Target player reveals his or her hand and discards all cards of that color. this.getSpellAbility().addEffect(new PersecuteEffect()); - this.getSpellAbility().addChoice(new ChoiceColor()); this.getSpellAbility().addTarget(new TargetPlayer()); } @@ -89,18 +88,24 @@ class PersecuteEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getFirstTarget()); - if (player != null) { - ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); - if(choice == null || choice.getColor() == null) { + Player controller = game.getPlayer(source.getFirstTarget()); + if (controller != null) { + ChoiceColor choice = new ChoiceColor(); + while (!choice.isChosen()) { + controller.choose(outcome, choice, game); + if (!controller.isInGame()) { + return false; + } + } + if (choice.getColor() == null) { return false; } - Cards hand = player.getHand(); - player.revealCards("Persecute", hand, game); + Cards hand = controller.getHand(); + controller.revealCards("Persecute", hand, game); Set cards = hand.getCards(game); for (Card card : cards) { if (card != null && card.getColor().shares(choice.getColor())) { - player.discard(card, source, game); + controller.discard(card, source, game); } } return true; diff --git a/Mage.Sets/src/mage/sets/zendikar/BraveTheElements.java b/Mage.Sets/src/mage/sets/zendikar/BraveTheElements.java index f1c784c051..adde9b0793 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BraveTheElements.java +++ b/Mage.Sets/src/mage/sets/zendikar/BraveTheElements.java @@ -43,6 +43,7 @@ import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import java.util.UUID; +import mage.players.Player; /** * @@ -54,7 +55,8 @@ public class BraveTheElements extends CardImpl { super(ownerId, 4, "Brave the Elements", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{W}"); this.expansionSetCode = "ZEN"; this.color.setWhite(true); - this.getSpellAbility().addChoice(new ChoiceColor()); + + // Choose a color. White creatures you control gain protection from the chosen color until end of turn. this.getSpellAbility().addEffect(new BraveTheElementsEffect()); } @@ -77,7 +79,7 @@ class BraveTheElementsEffect extends GainAbilityControlledEffect { filter1.add(new ColorPredicate(ObjectColor.WHITE)); } - private FilterCard filter2; + private final FilterCard filter2; public BraveTheElementsEffect() { super(new ProtectionAbility(new FilterCard()), Duration.EndOfTurn, filter1); @@ -97,11 +99,24 @@ class BraveTheElementsEffect extends GainAbilityControlledEffect { @Override public boolean apply(Game game, Ability source) { - ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); - filter2.add(new ColorPredicate(choice.getColor())); - filter2.setMessage(choice.getChoice()); - setAbility(new ProtectionAbility(new FilterCard(filter2))); - return super.apply(game, source); + Player controller = game.getPlayer(source.getFirstTarget()); + if (controller != null) { + ChoiceColor choice = new ChoiceColor(); + while (!choice.isChosen()) { + controller.choose(outcome, choice, game); + if (!controller.isInGame()) { + return false; + } + } + if (choice.getColor() == null) { + return false; + } + filter2.add(new ColorPredicate(choice.getColor())); + filter2.setMessage(choice.getChoice()); + setAbility(new ProtectionAbility(new FilterCard(filter2))); + return super.apply(game, source); + } + return false; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/zendikar/KhalniGem.java b/Mage.Sets/src/mage/sets/zendikar/KhalniGem.java index b65a6b9288..5ad6a8d498 100644 --- a/Mage.Sets/src/mage/sets/zendikar/KhalniGem.java +++ b/Mage.Sets/src/mage/sets/zendikar/KhalniGem.java @@ -40,7 +40,6 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.AddManaOfAnyColorEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; -import mage.choices.ChoiceColor; import mage.filter.common.FilterControlledLandPermanent; import mage.filter.common.FilterControlledPermanent; import mage.game.Game; diff --git a/Mage.Sets/src/mage/sets/zendikar/LotusCobra.java b/Mage.Sets/src/mage/sets/zendikar/LotusCobra.java index 9b042b1019..2b73069dc2 100644 --- a/Mage.Sets/src/mage/sets/zendikar/LotusCobra.java +++ b/Mage.Sets/src/mage/sets/zendikar/LotusCobra.java @@ -29,13 +29,12 @@ package mage.sets.zendikar; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.LandfallAbility; import mage.abilities.effects.common.AddManaOfAnyColorEffect; import mage.cards.CardImpl; -import mage.choices.ChoiceColor; +import mage.constants.CardType; +import mage.constants.Rarity; /** * diff --git a/Mage/src/mage/abilities/effects/common/ChooseColorEffect.java b/Mage/src/mage/abilities/effects/common/ChooseColorEffect.java index 831567106a..14776aa995 100644 --- a/Mage/src/mage/abilities/effects/common/ChooseColorEffect.java +++ b/Mage/src/mage/abilities/effects/common/ChooseColorEffect.java @@ -53,12 +53,19 @@ public class ChooseColorEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); + Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); - if (player != null && permanent != null) { + if (controller != null && permanent != null) { + ChoiceColor choice = new ChoiceColor(); + while (!choice.isChosen()) { + controller.choose(Outcome.PutManaInPool, choice, game); + if (!controller.isInGame()) { + return null; + } + } ChoiceColor colorChoice = new ChoiceColor(); - if (player.choose(outcome, colorChoice, game)) { - game.informPlayers(new StringBuilder(permanent.getLogName()).append(": ").append(player.getName()).append(" has chosen ").append(colorChoice.getChoice()).toString()); + if (controller.choose(outcome, colorChoice, game)) { + game.informPlayers(new StringBuilder(permanent.getLogName()).append(": ").append(controller.getName()).append(" has chosen ").append(colorChoice.getChoice()).toString()); game.getState().setValue(source.getSourceId() + "_color", colorChoice.getColor()); permanent.addInfo("chosen color", "Chosen color: " + colorChoice.getColor().getDescription() + ""); } diff --git a/Mage/src/mage/abilities/effects/common/continious/SetCardColorTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/SetCardColorTargetEffect.java index ab3bf01057..e083dced76 100644 --- a/Mage/src/mage/abilities/effects/common/continious/SetCardColorTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/SetCardColorTargetEffect.java @@ -43,6 +43,7 @@ import mage.constants.SubLayer; import mage.game.Game; import mage.game.permanent.Permanent; import mage.game.stack.StackObject; +import mage.players.Player; /** * @author LevelX @@ -77,13 +78,26 @@ public class SetCardColorTargetEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } boolean result = false; - ObjectColor objectColor = null; + ObjectColor objectColor; if (setColor == null) { - ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); - if (choice != null && choice.getColor() != null) { + ChoiceColor choice = new ChoiceColor(); + while (!choice.isChosen()) { + controller.choose(Outcome.PutManaInPool, choice, game); + if (!controller.isInGame()) { + return false; + } + } + if (choice.getColor() != null) { objectColor = choice.getColor(); - } + } else { + return false; + } + game.informPlayers(controller.getName() + " has chosen the color: " + objectColor.toString()); } else { objectColor = this.setColor; }