* Manamorphose - Fixed that color choice was not made during resolving the spell (fixed also some other cards).

This commit is contained in:
LevelX2 2014-11-30 23:33:47 +01:00
parent d6a3288d83
commit 904e62450c
19 changed files with 133 additions and 155 deletions

View file

@ -30,12 +30,11 @@ package mage.sets.apocalypse;
import java.util.UUID; import java.util.UUID;
import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DestroyTargetEffect;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.effects.common.continious.SetCardColorTargetEffect; import mage.abilities.effects.common.continious.SetCardColorTargetEffect;
import mage.cards.SplitCard; import mage.cards.SplitCard;
import mage.choices.ChoiceColor; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Rarity;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetArtifactPermanent; import mage.target.common.TargetArtifactPermanent;
import mage.target.common.TargetSpellOrPermanent; import mage.target.common.TargetSpellOrPermanent;
@ -60,7 +59,6 @@ public class IllusionReality extends SplitCard {
getLeftHalfCard().getSpellAbility().addEffect(new SetCardColorTargetEffect(Duration.EndOfTurn)); getLeftHalfCard().getSpellAbility().addEffect(new SetCardColorTargetEffect(Duration.EndOfTurn));
Target target = new TargetSpellOrPermanent(); Target target = new TargetSpellOrPermanent();
getLeftHalfCard().getSpellAbility().addTarget(target); getLeftHalfCard().getSpellAbility().addTarget(target);
getLeftHalfCard().getSpellAbility().addChoice(new ChoiceColor());
// Reality // Reality
// Destroy target artifact. // Destroy target artifact.

View file

@ -35,7 +35,6 @@ import mage.abilities.effects.common.AddManaOfAnyColorEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.mana.SimpleManaAbility; import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;

View file

@ -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);
}
}

View file

@ -37,10 +37,12 @@ import mage.cards.CardImpl;
import mage.choices.ChoiceColor; import mage.choices.ChoiceColor;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player;
/** /**
* *
@ -55,7 +57,6 @@ public class AkromasBlessing extends CardImpl {
this.color.setWhite(true); this.color.setWhite(true);
// Choose a color. Creatures you control gain protection from the chosen color until end of turn. // 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()); this.getSpellAbility().addEffect(new AcromasBlessingEffect());
// Cycling {W} // Cycling {W}
this.addAbility(new CyclingAbility(new ManaCostsImpl("{W}"))); this.addAbility(new CyclingAbility(new ManaCostsImpl("{W}")));
@ -94,11 +95,21 @@ class AcromasBlessingEffect extends GainAbilityControlledEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); 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.add(new ColorPredicate(choice.getColor()));
filter2.setMessage(choice.getChoice()); filter2.setMessage(choice.getChoice());
setAbility(new ProtectionAbility(new FilterCard(filter2))); setAbility(new ProtectionAbility(new FilterCard(filter2)));
return super.apply(game, source); return super.apply(game, source);
} }
return false;
}
} }

View file

@ -48,6 +48,7 @@ import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; 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)); 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. // {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 ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new JarethsGainProtectionFromColorSourceEffect(), new ManaCostsImpl("{W}"));
ability.addChoice(new ChoiceColor());
this.addAbility(ability); this.addAbility(ability);
} }
@ -104,9 +104,16 @@ class JarethsGainProtectionFromColorSourceEffect extends ContinuousEffectImpl {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent creature = game.getPermanent(source.getSourceId()); Permanent creature = game.getPermanent(source.getSourceId());
if (creature != null) { if (controller != null && creature != null) {
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); 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.add(new ColorPredicate(choice.getColor()));
protectionFilter.setMessage(choice.getChoice()); protectionFilter.setMessage(choice.getChoice());
ProtectionAbility ability = new ProtectionAbility(protectionFilter); ProtectionAbility ability = new ProtectionAbility(protectionFilter);

View file

@ -41,7 +41,6 @@ import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeOpponentsEffect; import mage.abilities.effects.common.LoseLifeOpponentsEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;

View file

@ -48,7 +48,6 @@ import mage.abilities.effects.common.AddManaOfAnyColorEffect;
import mage.abilities.effects.common.ReturnToHandSourceEffect; import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.mana.ActivateOncePerTurnManaAbility; import mage.abilities.mana.ActivateOncePerTurnManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;

View file

@ -47,7 +47,6 @@ import mage.abilities.effects.common.continious.PlayWithTheTopCardRevealedEffect
import mage.abilities.mana.ManaAbility; import mage.abilities.mana.ManaAbility;
import mage.abilities.mana.SimpleManaAbility; import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.constants.Duration; import mage.constants.Duration;
import mage.game.Game; import mage.game.Game;

View file

@ -31,11 +31,13 @@ import java.util.UUID;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.Mana; import mage.Mana;
import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.ManaEffect; import mage.abilities.effects.common.ManaEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.choices.ChoiceColor; import mage.choices.ChoiceColor;
import mage.constants.Outcome;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; 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. // Add two mana in any combination of colors to your mana pool.
this.getSpellAbility().addEffect(new ManamorphoseEffect()); this.getSpellAbility().addEffect(new ManamorphoseEffect());
this.getSpellAbility().addChoice(new ChoiceColor());
this.getSpellAbility().addChoice(new ChoiceColor());
// Draw a card. // Draw a card.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1)); this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
} }
@ -93,9 +94,13 @@ class ManamorphoseEffect extends ManaEffect {
return false; return false;
} }
boolean result = false; boolean result = false;
for (int i = 0; i < 2; i++) { 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; Mana mana = null;
if (choice.getColor().isBlack()) { if (choice.getColor().isBlack()) {
mana = Mana.BlackMana(1); mana = Mana.BlackMana(1);
@ -116,4 +121,17 @@ class ManamorphoseEffect extends ManaEffect {
} }
return result; 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;
}
} }

View file

@ -37,9 +37,7 @@ import mage.abilities.decorator.ConditionalManaEffect;
import mage.abilities.effects.common.AddManaOfAnyColorEffect; import mage.abilities.effects.common.AddManaOfAnyColorEffect;
import mage.abilities.effects.common.BasicManaEffect; import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.mana.ConditionalManaAbility; import mage.abilities.mana.ConditionalManaAbility;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;

View file

@ -28,9 +28,6 @@
package mage.sets.timespiral; package mage.sets.timespiral;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
@ -39,7 +36,8 @@ import mage.abilities.effects.common.AddManaOfAnyColorEffect;
import mage.abilities.keyword.SuspendAbility; import mage.abilities.keyword.SuspendAbility;
import mage.abilities.mana.SimpleManaAbility; import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.choices.ChoiceColor; import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
/** /**

View file

@ -161,9 +161,15 @@ class CarpetOfFlowersEffect extends ManaEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); Player controller = game.getPlayer(source.getControllerId());
Player player = game.getPlayer(source.getControllerId()); if (controller != null){
if(player != 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); int countMax = game.getBattlefield().count(filter, source.getSourceId(), source.getTargets().getFirstTarget(), game);
ChoiceImpl choiceCount = new ChoiceImpl(true); ChoiceImpl choiceCount = new ChoiceImpl(true);
LinkedHashSet<String> set = new LinkedHashSet<>(); LinkedHashSet<String> set = new LinkedHashSet<>();
@ -173,22 +179,22 @@ class CarpetOfFlowersEffect extends ManaEffect {
} }
choiceCount.setChoices(set); choiceCount.setChoices(set);
choiceCount.setMessage("Choose number of mana"); choiceCount.setMessage("Choose number of mana");
player.choose(Outcome.PutManaInPool, choiceCount, game); controller.choose(Outcome.PutManaInPool, choiceCount, game);
int count = Integer.parseInt(choiceCount.getChoice()); int count = Integer.parseInt(choiceCount.getChoice());
if (choice.getColor().isBlack()) { 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; return true;
} else if (choice.getColor().isBlue()) { } 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; return true;
} else if (choice.getColor().isRed()) { } 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; return true;
} else if (choice.getColor().isGreen()) { } 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; return true;
} else if (choice.getColor().isWhite()) { } 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; return true;
} }
} }

View file

@ -34,7 +34,6 @@ import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.abilities.mana.TriggeredManaAbility; import mage.abilities.mana.TriggeredManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;

View file

@ -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. // Choose a color. Target player reveals his or her hand and discards all cards of that color.
this.getSpellAbility().addEffect(new PersecuteEffect()); this.getSpellAbility().addEffect(new PersecuteEffect());
this.getSpellAbility().addChoice(new ChoiceColor());
this.getSpellAbility().addTarget(new TargetPlayer()); this.getSpellAbility().addTarget(new TargetPlayer());
} }
@ -89,18 +88,24 @@ class PersecuteEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget()); Player controller = game.getPlayer(source.getFirstTarget());
if (player != null) { if (controller != null) {
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); ChoiceColor choice = new ChoiceColor();
if(choice == null || choice.getColor() == null) { while (!choice.isChosen()) {
controller.choose(outcome, choice, game);
if (!controller.isInGame()) {
return false; return false;
} }
Cards hand = player.getHand(); }
player.revealCards("Persecute", hand, game); if (choice.getColor() == null) {
return false;
}
Cards hand = controller.getHand();
controller.revealCards("Persecute", hand, game);
Set<Card> cards = hand.getCards(game); Set<Card> cards = hand.getCards(game);
for (Card card : cards) { for (Card card : cards) {
if (card != null && card.getColor().shares(choice.getColor())) { if (card != null && card.getColor().shares(choice.getColor())) {
player.discard(card, source, game); controller.discard(card, source, game);
} }
} }
return true; return true;

View file

@ -43,6 +43,7 @@ import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game; import mage.game.Game;
import java.util.UUID; 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}"); super(ownerId, 4, "Brave the Elements", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{W}");
this.expansionSetCode = "ZEN"; this.expansionSetCode = "ZEN";
this.color.setWhite(true); 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()); this.getSpellAbility().addEffect(new BraveTheElementsEffect());
} }
@ -77,7 +79,7 @@ class BraveTheElementsEffect extends GainAbilityControlledEffect {
filter1.add(new ColorPredicate(ObjectColor.WHITE)); filter1.add(new ColorPredicate(ObjectColor.WHITE));
} }
private FilterCard filter2; private final FilterCard filter2;
public BraveTheElementsEffect() { public BraveTheElementsEffect() {
super(new ProtectionAbility(new FilterCard()), Duration.EndOfTurn, filter1); super(new ProtectionAbility(new FilterCard()), Duration.EndOfTurn, filter1);
@ -97,11 +99,24 @@ class BraveTheElementsEffect extends GainAbilityControlledEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); 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.add(new ColorPredicate(choice.getColor()));
filter2.setMessage(choice.getChoice()); filter2.setMessage(choice.getChoice());
setAbility(new ProtectionAbility(new FilterCard(filter2))); setAbility(new ProtectionAbility(new FilterCard(filter2)));
return super.apply(game, source); return super.apply(game, source);
} }
return false;
}
} }

View file

@ -40,7 +40,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AddManaOfAnyColorEffect; import mage.abilities.effects.common.AddManaOfAnyColorEffect;
import mage.abilities.mana.SimpleManaAbility; import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.filter.common.FilterControlledLandPermanent; import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterControlledPermanent;
import mage.game.Game; import mage.game.Game;

View file

@ -29,13 +29,12 @@
package mage.sets.zendikar; package mage.sets.zendikar;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.LandfallAbility; import mage.abilities.common.LandfallAbility;
import mage.abilities.effects.common.AddManaOfAnyColorEffect; import mage.abilities.effects.common.AddManaOfAnyColorEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.choices.ChoiceColor; import mage.constants.CardType;
import mage.constants.Rarity;
/** /**
* *

View file

@ -53,12 +53,19 @@ public class ChooseColorEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { 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()); 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(); ChoiceColor colorChoice = new ChoiceColor();
if (player.choose(outcome, colorChoice, game)) { if (controller.choose(outcome, colorChoice, game)) {
game.informPlayers(new StringBuilder(permanent.getLogName()).append(": ").append(player.getName()).append(" has chosen ").append(colorChoice.getChoice()).toString()); 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()); game.getState().setValue(source.getSourceId() + "_color", colorChoice.getColor());
permanent.addInfo("chosen color", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>"); permanent.addInfo("chosen color", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>");
} }

View file

@ -43,6 +43,7 @@ import mage.constants.SubLayer;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.stack.StackObject; import mage.game.stack.StackObject;
import mage.players.Player;
/** /**
* @author LevelX * @author LevelX
@ -77,13 +78,26 @@ public class SetCardColorTargetEffect extends ContinuousEffectImpl {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
boolean result = false; Player controller = game.getPlayer(source.getControllerId());
ObjectColor objectColor = null; if (controller == null) {
if (setColor == null) { return false;
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
if (choice != null && choice.getColor() != null) {
objectColor = choice.getColor();
} }
boolean result = false;
ObjectColor objectColor;
if (setColor == 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 { } else {
objectColor = this.setColor; objectColor = this.setColor;
} }