From cf93e5d572246ed6eab98ba7abe44daafd3568fa Mon Sep 17 00:00:00 2001 From: "Raphael \"who?!\" Kehldorfer" Date: Fri, 17 Sep 2021 14:07:54 +0200 Subject: [PATCH] [MID] Implemented Wake to Slaughter (#8270) * [MID] Implemented Wake to Slaughter * [MID] Refactored Wake to Slaughter: + Reworked WakeToSlaughterEffect + Added Min / Max * [MID] Refactored Wake to Slaughter + Added missing ability and trigger --- .../src/mage/cards/w/WakeToSlaughter.java | 126 ++++++++++++++++++ .../src/mage/sets/InnistradMidnightHunt.java | 1 + 2 files changed, 127 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/WakeToSlaughter.java diff --git a/Mage.Sets/src/mage/cards/w/WakeToSlaughter.java b/Mage.Sets/src/mage/cards/w/WakeToSlaughter.java new file mode 100644 index 00000000000..cdb70557850 --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WakeToSlaughter.java @@ -0,0 +1,126 @@ +package mage.cards.w; + +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.FlashbackAbility; +import mage.abilities.keyword.HasteAbility; +import mage.cards.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.Target; +import mage.target.TargetCard; +import mage.target.common.TargetCardInGraveyard; +import mage.target.common.TargetOpponent; +import mage.target.targetpointer.FixedTarget; + +import java.util.Set; +import java.util.UUID; + +/** + * @author LePwnerer + */ +public final class WakeToSlaughter extends CardImpl { + + public WakeToSlaughter(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}{R}"); + + // Choose up to two target creature cards in your graveyard. An opponent chooses one of them. Return that card to your hand. Return the other to the battlefield under your control. It gains haste. Exile it at the beginning of the next end step. + this.getSpellAbility().addTarget(new TargetCardInGraveyard(0, 2, StaticFilters.FILTER_CARD_CREATURE)); + this.getSpellAbility().addEffect(new WakeToSlaughterEffect()); + + // Flashback {4}{B}{R} + this.addAbility(new FlashbackAbility(this, new ManaCostsImpl<>("{4}{B}{R}"))); + + } + + private WakeToSlaughter(final WakeToSlaughter card) { + super(card); + } + + @Override + public WakeToSlaughter copy() { + return new WakeToSlaughter(this); + } +} + +class WakeToSlaughterEffect extends OneShotEffect { + + public WakeToSlaughterEffect() { + super(Outcome.Benefit); + this.staticText = "Choose up to two target creature cards in your graveyard. " + + "An opponent chooses one of them. " + + "Return that card to your hand. " + + "Return the other to the battlefield under your control. " + + "It gains haste. " + + "Exile it at the beginning of the next end step."; + } + + public WakeToSlaughterEffect(final mage.cards.w.WakeToSlaughterEffect effect) { + super(effect); + } + + @Override + public mage.cards.w.WakeToSlaughterEffect copy() { + return new mage.cards.w.WakeToSlaughterEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Cards pickedCards = new CardsImpl(getTargetPointer().getTargets(game, source)); + if (player != null && !pickedCards.isEmpty()) { + Card cardToHand; + if (pickedCards.size() == 1) { + cardToHand = pickedCards.getRandom(game); + } else { + Player opponent; + Set opponents = game.getOpponents(player.getId()); + if (opponents.size() == 1) { + opponent = game.getPlayer(opponents.iterator().next()); + } else { + Target targetOpponent = new TargetOpponent(true); + player.chooseTarget(Outcome.Detriment, targetOpponent, source, game); + opponent = game.getPlayer(targetOpponent.getFirstTarget()); + } + + TargetCard target = new TargetCard(1, Zone.GRAVEYARD, new FilterCard()); + target.withChooseHint("Card to go to opponent's hand (other goes to battlefield)"); + opponent.chooseTarget(outcome, pickedCards, target, source, game); + cardToHand = game.getCard(target.getFirstTarget()); + } + for (Card card : pickedCards.getCards(game)) { + if (card == cardToHand) { + player.moveCards(cardToHand, Zone.HAND, source, game); + } else { + player.moveCards(card, Zone.BATTLEFIELD, source, game); + + FixedTarget fixedTarget = new FixedTarget(card, game); + ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfGame); + effect.setTargetPointer(fixedTarget); + game.addEffect(effect, source); + + ExileTargetEffect exileEffect = new ExileTargetEffect(null, null, Zone.BATTLEFIELD); + exileEffect.setTargetPointer(fixedTarget); + DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect); + game.addDelayedTriggeredAbility(delayedAbility, source); + } + } + pickedCards.clear(); + return true; + } + + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index 917f5eb6e5f..d65369018c9 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -322,6 +322,7 @@ public final class InnistradMidnightHunt extends ExpansionSet { cards.add(new SetCardInfo("Voldaren Ambusher", 166, Rarity.UNCOMMON, mage.cards.v.VoldarenAmbusher.class)); cards.add(new SetCardInfo("Voldaren Stinger", 167, Rarity.COMMON, mage.cards.v.VoldarenStinger.class)); cards.add(new SetCardInfo("Waildrifter", 55, Rarity.COMMON, mage.cards.w.Waildrifter.class)); + cards.add(new SetCardInfo("Wake to Slaughter", 250, Rarity.RARE, mage.cards.w.WakeToSlaughter.class)); cards.add(new SetCardInfo("Willow Geist", 207, Rarity.RARE, mage.cards.w.WillowGeist.class)); cards.add(new SetCardInfo("Wing Shredder", 169, Rarity.COMMON, mage.cards.w.WingShredder.class)); cards.add(new SetCardInfo("Winterthorn Blessing", 251, Rarity.UNCOMMON, mage.cards.w.WinterthornBlessing.class));