From ee7ea4e8fe0535770553e97e6f1dc5997ecbc196 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 12 Jan 2019 11:30:19 -0500 Subject: [PATCH] Implemented Clear the Stage --- Mage.Sets/src/mage/cards/c/ClearTheStage.java | 81 +++++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + 2 files changed, 82 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/ClearTheStage.java diff --git a/Mage.Sets/src/mage/cards/c/ClearTheStage.java b/Mage.Sets/src/mage/cards/c/ClearTheStage.java new file mode 100644 index 0000000000..6f49a7091d --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/ClearTheStage.java @@ -0,0 +1,81 @@ +package mage.cards.c; + +import mage.abilities.Ability; +import mage.abilities.condition.common.FerociousCondition; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInYourGraveyard; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ClearTheStage extends CardImpl { + + private static final FilterCard filter = new FilterCreatureCard("creature card from your graveyard"); + + public ClearTheStage(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{B}"); + + // Target creature gets -3/-3 until end of turn. If you control a creature with power 4 or greater, you may return up to one target creature card from your graveyard to your hand. + this.getSpellAbility().addEffect(new ClearTheStageEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(0, 1, filter)); + } + + private ClearTheStage(final ClearTheStage card) { + super(card); + } + + @Override + public ClearTheStage copy() { + return new ClearTheStage(this); + } +} + +class ClearTheStageEffect extends OneShotEffect { + + ClearTheStageEffect() { + super(Outcome.Benefit); + staticText = "Target creature gets -3/-3 until end of turn. If you control a creature with power 4 or greater, " + + "you may return up to one target creature card from your graveyard to your hand."; + } + + private ClearTheStageEffect(final ClearTheStageEffect effect) { + super(effect); + } + + @Override + public ClearTheStageEffect copy() { + return new ClearTheStageEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + game.addEffect(new BoostTargetEffect(-3, -3), source); + if (!FerociousCondition.instance.apply(game, source)) { + return true; + } + Player player = game.getPlayer(source.getSourceId()); + if (player == null || !player.chooseUse(Outcome.Benefit, "Return a creature card from your graveyard to your hand?", source, game)) { + return false; + } + Card card = game.getCard(source.getTargets().get(1).getFirstTarget()); + if (card == null) { + return false; + } + return player.moveCards(card, Zone.HAND, source, game); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index 52a22987af..1e881a07ce 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -77,6 +77,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Clamor Shaman", 96, Rarity.UNCOMMON, mage.cards.c.ClamorShaman.class)); cards.add(new SetCardInfo("Clan Guildmage", 162, Rarity.UNCOMMON, mage.cards.c.ClanGuildmage.class)); cards.add(new SetCardInfo("Clear the Mind", 34, Rarity.COMMON, mage.cards.c.ClearTheMind.class)); + cards.add(new SetCardInfo("Clear the Stage", 68, Rarity.UNCOMMON, mage.cards.c.ClearTheStage.class)); cards.add(new SetCardInfo("Code of Constraint", 35, Rarity.UNCOMMON, mage.cards.c.CodeOfConstraint.class)); cards.add(new SetCardInfo("Collision // Colossus", 223, Rarity.UNCOMMON, mage.cards.c.CollisionColossus.class)); cards.add(new SetCardInfo("Combine Guildmage", 163, Rarity.UNCOMMON, mage.cards.c.CombineGuildmage.class));