From 519ecb35c189b3972b11cb46d7bd153c921e7ac6 Mon Sep 17 00:00:00 2001 From: xenohedron Date: Thu, 12 Oct 2023 20:32:49 -0400 Subject: [PATCH] Implement [APC] Suppress --- Mage.Sets/src/mage/cards/s/Suppress.java | 84 +++++++++++++++++++ Mage.Sets/src/mage/sets/Apocalypse.java | 1 + ...ersNextEndStepDelayedTriggeredAbility.java | 6 +- 3 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/s/Suppress.java diff --git a/Mage.Sets/src/mage/cards/s/Suppress.java b/Mage.Sets/src/mage/cards/s/Suppress.java new file mode 100644 index 00000000000..169a9f92c85 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/Suppress.java @@ -0,0 +1,84 @@ +package mage.cards.s; + +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.delayed.AtTheBeginOfPlayersNextEndStepDelayedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ReturnFromExileEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author xenohedron + */ +public final class Suppress extends CardImpl { + + public Suppress(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}"); + + // Target player exiles all cards from their hand face down. + // At the beginning of the end step of that player's next turn, that player returns those cards to their hand. + this.getSpellAbility().addEffect(new SuppressEffect()); + this.getSpellAbility().addTarget(new TargetPlayer()); + } + + private Suppress(final Suppress card) { + super(card); + } + + @Override + public Suppress copy() { + return new Suppress(this); + } +} + +class SuppressEffect extends OneShotEffect { + + SuppressEffect() { + super(Outcome.Detriment); + this.staticText = "target player exiles all cards from their hand face down. " + + "At the beginning of the end step of that player's next turn, that player returns those cards to their hand"; + } + + private SuppressEffect(final SuppressEffect effect) { + super(effect); + } + + @Override + public SuppressEffect copy() { + return new SuppressEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (player == null || player.getHand().isEmpty()) { + return false; + } + Cards cards = new CardsImpl(player.getHand()); + player.moveCardsToExile( + cards.getCards(game), source, game, false, + CardUtil.getExileZoneId(game, source), CardUtil.getSourceName(game, source) + ); + cards.getCards(game) + .stream() + .filter(card -> game.getState().getZone(card.getId()) == Zone.EXILED) + .forEach(card -> card.setFaceDown(true, game)); + DelayedTriggeredAbility ability = new AtTheBeginOfPlayersNextEndStepDelayedTriggeredAbility( + new ReturnFromExileEffect(Zone.HAND).setText("that player returns those cards to their hand"), player.getId() + ).setTriggerPhrase("At the beginning of the end step of that player's next turn, "); + game.addDelayedTriggeredAbility(ability, source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Apocalypse.java b/Mage.Sets/src/mage/sets/Apocalypse.java index bf38b8856f8..bcff00f8876 100644 --- a/Mage.Sets/src/mage/sets/Apocalypse.java +++ b/Mage.Sets/src/mage/sets/Apocalypse.java @@ -145,6 +145,7 @@ public final class Apocalypse extends ExpansionSet { cards.add(new SetCardInfo("Standard Bearer", 18, Rarity.COMMON, mage.cards.s.StandardBearer.class)); cards.add(new SetCardInfo("Strength of Night", 86, Rarity.COMMON, mage.cards.s.StrengthOfNight.class)); cards.add(new SetCardInfo("Suffocating Blast", 124, Rarity.RARE, mage.cards.s.SuffocatingBlast.class)); + cards.add(new SetCardInfo("Suppress", 52, Rarity.UNCOMMON, mage.cards.s.Suppress.class)); cards.add(new SetCardInfo("Sylvan Messenger", 87, Rarity.UNCOMMON, mage.cards.s.SylvanMessenger.class)); cards.add(new SetCardInfo("Symbiotic Deployment", 88, Rarity.RARE, mage.cards.s.SymbioticDeployment.class)); cards.add(new SetCardInfo("Tahngarth's Glare", 70, Rarity.COMMON, mage.cards.t.TahngarthsGlare.class)); diff --git a/Mage/src/main/java/mage/abilities/common/delayed/AtTheBeginOfPlayersNextEndStepDelayedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/delayed/AtTheBeginOfPlayersNextEndStepDelayedTriggeredAbility.java index 3e6b8d70767..ceb5d6a1e55 100644 --- a/Mage/src/main/java/mage/abilities/common/delayed/AtTheBeginOfPlayersNextEndStepDelayedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/delayed/AtTheBeginOfPlayersNextEndStepDelayedTriggeredAbility.java @@ -16,6 +16,7 @@ public class AtTheBeginOfPlayersNextEndStepDelayedTriggeredAbility extends Delay public AtTheBeginOfPlayersNextEndStepDelayedTriggeredAbility(Effect effect, UUID playerId) { super(effect, Duration.Custom, true, false); this.playerId = playerId; + this.setTriggerPhrase("At the beginning of its owners next end step, "); } protected AtTheBeginOfPlayersNextEndStepDelayedTriggeredAbility(final AtTheBeginOfPlayersNextEndStepDelayedTriggeredAbility ability) { @@ -38,9 +39,4 @@ public class AtTheBeginOfPlayersNextEndStepDelayedTriggeredAbility extends Delay return game.getActivePlayerId().equals(playerId); } - @Override - public String getRule() { - return "At the beginning of its owners next end step, " + super.getRule(); - } - }