From 2a90e8256e8fc61a98fcdd74e1ae27a4280939f8 Mon Sep 17 00:00:00 2001 From: Cameron Merkel <44722506+Cguy7777@users.noreply.github.com> Date: Thu, 7 Dec 2023 20:47:28 -0600 Subject: [PATCH] [MIR] Implement Tainted Specter (#11525) --- .../src/mage/cards/t/TaintedSpecter.java | 114 ++++++++++++++++++ Mage.Sets/src/mage/sets/Mirage.java | 1 + 2 files changed, 115 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TaintedSpecter.java diff --git a/Mage.Sets/src/mage/cards/t/TaintedSpecter.java b/Mage.Sets/src/mage/cards/t/TaintedSpecter.java new file mode 100644 index 00000000000..e8338925db8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TaintedSpecter.java @@ -0,0 +1,114 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageEverythingEffect; +import mage.abilities.effects.common.discard.DiscardTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.target.common.TargetCardInHand; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author Cguy7777 + */ +public final class TaintedSpecter extends CardImpl { + + public TaintedSpecter(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}"); + + this.subtype.add(SubType.SPECTER); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // {1}{B}{B}, {tap}: Target player discards a card unless they put a card from their hand on top of their library. + // If that player discards a card this way, Tainted Specter deals 1 damage to each creature and each player. + // Activate this ability only any time you could cast a sorcery. + Ability ability = new ActivateAsSorceryActivatedAbility( + Zone.BATTLEFIELD, new TaintedSpecterEffect(), new ManaCostsImpl<>("{1}{B}{B}")); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability); + } + + private TaintedSpecter(final TaintedSpecter card) { + super(card); + } + + @Override + public TaintedSpecter copy() { + return new TaintedSpecter(this); + } +} + +class TaintedSpecterEffect extends OneShotEffect { + + public TaintedSpecterEffect() { + super(Outcome.Detriment); + staticText = "Target player discards a card unless they put a card from their hand on top of their library. " + + "If that player discards a card this way, {this} deals 1 damage to each creature and each player"; + } + + private TaintedSpecterEffect(final TaintedSpecterEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); + if (targetPlayer == null) { + return false; + } + + if (targetPlayer.getHand().isEmpty()) { + return true; + } + + final String message = "Discard a card, or put a card from your hand on top of your library?"; + if (targetPlayer.chooseUse(outcome, message, null, "Discard a card", "Put a card from your hand on top", source, game)) { + // Discard a card + Effect discardEffect = new DiscardTargetEffect(1); + discardEffect.setTargetPointer(new FixedTarget(targetPlayer.getId())); + + if (discardEffect.apply(game, source)) { + new DamageEverythingEffect(1).apply(game, source); + } + } else { + // Put a card from your hand on top of your library + TargetCardInHand target = new TargetCardInHand(); + target.withNotTarget(true); + target.setTargetName("a card from your hand to put on top of your library"); + targetPlayer.choose(Outcome.Detriment, target, source, game); + Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); + if (card != null) { + targetPlayer.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false); + } + } + + return true; + } + + @Override + public TaintedSpecterEffect copy() { + return new TaintedSpecterEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Mirage.java b/Mage.Sets/src/mage/sets/Mirage.java index e83bccf8c1c..d534aa0de59 100644 --- a/Mage.Sets/src/mage/sets/Mirage.java +++ b/Mage.Sets/src/mage/sets/Mirage.java @@ -309,6 +309,7 @@ public final class Mirage extends ExpansionSet { cards.add(new SetCardInfo("Swamp", 340, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Swamp", 341, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Swamp", 342, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Tainted Specter", 148, Rarity.RARE, mage.cards.t.TaintedSpecter.class)); cards.add(new SetCardInfo("Talruum Minotaur", 196, Rarity.COMMON, mage.cards.t.TalruumMinotaur.class)); cards.add(new SetCardInfo("Taniwha", 95, Rarity.RARE, mage.cards.t.Taniwha.class)); cards.add(new SetCardInfo("Teeka's Dragon", 320, Rarity.RARE, mage.cards.t.TeekasDragon.class));