From c7bc799f86395a9338996c2765016981ed70f360 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 18 Dec 2018 21:23:35 -0500 Subject: [PATCH] Implemented Light Up the Stage --- .../src/mage/cards/c/CommuneWithLava.java | 7 +- .../src/mage/cards/l/LightUpTheStage.java | 127 ++++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + 3 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/l/LightUpTheStage.java diff --git a/Mage.Sets/src/mage/cards/c/CommuneWithLava.java b/Mage.Sets/src/mage/cards/c/CommuneWithLava.java index 08cf2112e7..6f4f3bb193 100644 --- a/Mage.Sets/src/mage/cards/c/CommuneWithLava.java +++ b/Mage.Sets/src/mage/cards/c/CommuneWithLava.java @@ -1,7 +1,5 @@ package mage.cards.c; -import java.util.Set; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.AsThoughEffectImpl; import mage.abilities.effects.ContinuousEffect; @@ -15,6 +13,9 @@ import mage.players.Player; import mage.target.targetpointer.FixedTarget; import mage.util.CardUtil; +import java.util.Set; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -78,7 +79,7 @@ class CommuneWithLavaEffect extends OneShotEffect { class CommuneWithLavaMayPlayEffect extends AsThoughEffectImpl { - int castOnTurn = 0; + private int castOnTurn = 0; public CommuneWithLavaMayPlayEffect() { super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit); diff --git a/Mage.Sets/src/mage/cards/l/LightUpTheStage.java b/Mage.Sets/src/mage/cards/l/LightUpTheStage.java new file mode 100644 index 0000000000..2a48c3106c --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LightUpTheStage.java @@ -0,0 +1,127 @@ +package mage.cards.l; + +import mage.abilities.Ability; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.AsThoughEffectImpl; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.SpectacleAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; +import mage.util.CardUtil; + +import java.util.Set; +import java.util.UUID; + +/** + * @author TheElk801 and jeffwadsworth + */ +public final class LightUpTheStage extends CardImpl { + + public LightUpTheStage(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}"); + + // Spectacle {R} + this.addAbility(new SpectacleAbility(this, new ManaCostsImpl("{R}"))); + + // Exile the top two cards of your library. Until the end of your next turn, you may play those cards. + this.getSpellAbility().addEffect(new LightUpTheStageEffect()); + } + + public LightUpTheStage(final LightUpTheStage card) { + super(card); + } + + @Override + public LightUpTheStage copy() { + return new LightUpTheStage(this); + } +} + +class LightUpTheStageEffect extends OneShotEffect { + + public LightUpTheStageEffect() { + super(Outcome.PlayForFree); + this.staticText = "Exile the top two cards of your library. Until the end of your next turn, you may play those cards"; + } + + public LightUpTheStageEffect(final LightUpTheStageEffect effect) { + super(effect); + } + + @Override + public LightUpTheStageEffect copy() { + return new LightUpTheStageEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Card sourceCard = game.getCard(source.getSourceId()); + if (controller != null) { + Set cards = controller.getLibrary().getTopCards(game, 2); + controller.moveCardsToExile(cards, source, game, true, CardUtil.getCardExileZoneId(game, source), sourceCard.getIdName()); + + for (Card card : cards) { + ContinuousEffect effect = new LightUpTheStageMayPlayEffect(); + effect.setTargetPointer(new FixedTarget(card.getId())); + game.addEffect(effect, source); + } + + return true; + } + return false; + } +} + +class LightUpTheStageMayPlayEffect extends AsThoughEffectImpl { + + private int castOnTurn = 0; + + public LightUpTheStageMayPlayEffect() { + super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit); + this.staticText = "Until the end of your next turn, you may play that card."; + } + + public LightUpTheStageMayPlayEffect(final LightUpTheStageMayPlayEffect effect) { + super(effect); + castOnTurn = effect.castOnTurn; + } + + @Override + public LightUpTheStageMayPlayEffect copy() { + return new LightUpTheStageMayPlayEffect(this); + } + + @Override + public void init(Ability source, Game game) { + super.init(source, game); + castOnTurn = game.getTurnNum(); + } + + @Override + public boolean isInactive(Ability source, Game game) { + if (castOnTurn != game.getTurnNum() && game.getPhase().getStep().getType() == PhaseStep.END_TURN) { + if (game.isActivePlayer(source.getControllerId())) { + return true; + } + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { + return source.isControlledBy(affectedControllerId) + && getTargetPointer().getTargets(game, source).contains(sourceId); + } +} diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index a140b3ad76..242c82fa44 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -35,6 +35,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Gate Colossus", 232, Rarity.UNCOMMON, mage.cards.g.GateColossus.class)); cards.add(new SetCardInfo("Growth Spiral", 178, Rarity.COMMON, mage.cards.g.GrowthSpiral.class)); cards.add(new SetCardInfo("Imperious Oligarch", 184, Rarity.COMMON, mage.cards.i.ImperiousOligarch.class)); + cards.add(new SetCardInfo("Light Up the Stage", 107, Rarity.UNCOMMON, mage.cards.l.LightUpTheStage.class)); cards.add(new SetCardInfo("Mortify", 192, Rarity.UNCOMMON, mage.cards.m.Mortify.class)); cards.add(new SetCardInfo("Rafter Demon", 196, Rarity.COMMON, mage.cards.r.RafterDemon.class)); cards.add(new SetCardInfo("Rix Maadi Reveler", 109, Rarity.RARE, mage.cards.r.RixMaadiReveler.class));