From 878dc7bd2e83f81de41eb005dc32739fb972600c Mon Sep 17 00:00:00 2001 From: Alex Vasile <48962821+Alex-Vasile@users.noreply.github.com> Date: Sun, 30 Jan 2022 23:50:29 -0500 Subject: [PATCH] Simplified Light Up the Stage implementation based on Act On Impulse. (#8621) --- .../src/mage/cards/l/LightUpTheStage.java | 89 ++----------------- 1 file changed, 5 insertions(+), 84 deletions(-) diff --git a/Mage.Sets/src/mage/cards/l/LightUpTheStage.java b/Mage.Sets/src/mage/cards/l/LightUpTheStage.java index 991aa6c632..9166f4c822 100644 --- a/Mage.Sets/src/mage/cards/l/LightUpTheStage.java +++ b/Mage.Sets/src/mage/cards/l/LightUpTheStage.java @@ -5,6 +5,7 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.AsThoughEffectImpl; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileTopXMayPlayUntilEndOfTurnEffect; import mage.abilities.keyword.SpectacleAbility; import mage.cards.Card; import mage.cards.CardImpl; @@ -27,10 +28,12 @@ public final class LightUpTheStage extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{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()); + this.getSpellAbility().addEffect(new ExileTopXMayPlayUntilEndOfTurnEffect( + 2, false, Duration.UntilEndOfYourNextTurn + )); // Spectacle {R} - this.addAbility(new SpectacleAbility(this, new ManaCostsImpl("{R}"))); + this.addAbility(new SpectacleAbility(this, new ManaCostsImpl<>("{R}"))); } private LightUpTheStage(final LightUpTheStage card) { @@ -42,85 +45,3 @@ public final class LightUpTheStage extends CardImpl { return new LightUpTheStage(this); } } - -class LightUpTheStageEffect extends OneShotEffect { - - 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"; - } - - private 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()); - if (controller != null) { - Set cards = controller.getLibrary().getTopCards(game, 2); - Card sourceCard = game.getCard(source.getSourceId()); - controller.moveCardsToExile(cards, source, game, true, CardUtil.getCardExileZoneId(game, source), sourceCard != null ? 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; - - 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."; - } - - private 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) { - return game.isActivePlayer(source.getControllerId()); - } - return false; - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { - UUID objectIdToCast = CardUtil.getMainCardId(game, sourceId); - return source.isControlledBy(affectedControllerId) - && getTargetPointer().getTargets(game, source).contains(objectIdToCast); - } -}