From 311e35e3a44e027c29d69067e660740f374e5d05 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 12 Aug 2019 20:32:46 -0400 Subject: [PATCH] Implemented Hate Mirage --- Mage.Sets/src/mage/cards/h/HateMirage.java | 85 +++++++++++++++++++ .../src/mage/sets/Commander2019Edition.java | 1 + 2 files changed, 86 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/h/HateMirage.java diff --git a/Mage.Sets/src/mage/cards/h/HateMirage.java b/Mage.Sets/src/mage/cards/h/HateMirage.java new file mode 100644 index 0000000000..54c78fa231 --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HateMirage.java @@ -0,0 +1,85 @@ +package mage.cards.h; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenCopyTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; +import mage.target.Target; +import mage.target.TargetPermanent; +import mage.target.targetpointer.FixedTarget; + +import java.util.Collection; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class HateMirage extends CardImpl { + + private static final FilterPermanent filter = new FilterCreaturePermanent("creatures you don't control"); + + static { + filter.add(new ControllerPredicate(TargetController.NOT_YOU)); + } + + public HateMirage(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}"); + + // Choose up to two target creatures you don't control. For each of those creatures, create a token that's a copy of that creature. Those tokens gain haste. Exile them at the beginning of the next end step. + this.getSpellAbility().addEffect(new HateMirageEffect()); + this.getSpellAbility().addTarget(new TargetPermanent(0, 2, filter, false)); + } + + private HateMirage(final HateMirage card) { + super(card); + } + + @Override + public HateMirage copy() { + return new HateMirage(this); + } +} + +class HateMirageEffect extends OneShotEffect { + + HateMirageEffect() { + super(Outcome.Benefit); + staticText = "Choose up to two target creatures you don't control. " + + "For each of those creatures, create a token that's a copy of that creature. " + + "Those tokens gain haste. Exile them at the beginning of the next end step."; + } + + private HateMirageEffect(final HateMirageEffect effect) { + super(effect); + } + + @Override + public HateMirageEffect copy() { + return new HateMirageEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + source.getTargets() + .stream() + .map(Target::getTargets) + .flatMap(Collection::stream) + .forEach(uuid -> { + CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect( + source.getId(), null, true + ); + effect.setTargetPointer(new FixedTarget(uuid, game)); + effect.apply(game, source); + effect.exileTokensCreatedAtNextEndStep(game, source); + }); + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Commander2019Edition.java b/Mage.Sets/src/mage/sets/Commander2019Edition.java index e018ca9164..698a39430c 100644 --- a/Mage.Sets/src/mage/sets/Commander2019Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2019Edition.java @@ -134,6 +134,7 @@ public final class Commander2019Edition extends ExpansionSet { cards.add(new SetCardInfo("Gruul Turf", 250, Rarity.UNCOMMON, mage.cards.g.GruulTurf.class)); cards.add(new SetCardInfo("Guttersnipe", 145, Rarity.UNCOMMON, mage.cards.g.Guttersnipe.class)); cards.add(new SetCardInfo("Harmonize", 171, Rarity.UNCOMMON, mage.cards.h.Harmonize.class)); + cards.add(new SetCardInfo("Hate Mirage", 26, Rarity.UNCOMMON, mage.cards.h.HateMirage.class)); cards.add(new SetCardInfo("Heart-Piercer Manticore", 146, Rarity.RARE, mage.cards.h.HeartPiercerManticore.class)); cards.add(new SetCardInfo("Hedonist's Trove", 119, Rarity.RARE, mage.cards.h.HedonistsTrove.class)); cards.add(new SetCardInfo("Hedron Archive", 214, Rarity.UNCOMMON, mage.cards.h.HedronArchive.class));