mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
Simplified Light Up the Stage implementation based on Act On Impulse. (#8621)
This commit is contained in:
parent
3a9543d847
commit
878dc7bd2e
1 changed files with 5 additions and 84 deletions
|
@ -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<Card> 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue