From e3cc3dce9fab34f3009454c7caaf78baeb88c439 Mon Sep 17 00:00:00 2001 From: ciaccona007 Date: Sun, 19 Apr 2020 16:37:08 -0700 Subject: [PATCH] Implement Molten Echoes --- Mage.Sets/src/mage/cards/m/MoltenEchoes.java | 99 +++++++++++++++++++ .../src/mage/sets/Commander2020Edition.java | 1 + 2 files changed, 100 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MoltenEchoes.java diff --git a/Mage.Sets/src/mage/cards/m/MoltenEchoes.java b/Mage.Sets/src/mage/cards/m/MoltenEchoes.java new file mode 100644 index 0000000000..23a8c70c9e --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MoltenEchoes.java @@ -0,0 +1,99 @@ +package mage.cards.m; + +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.AsEntersBattlefieldAbility; +import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility; +import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ChooseCreatureTypeEffect; +import mage.abilities.effects.common.CreateTokenCopyTargetEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SetTargetPointer; +import mage.constants.Zone; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ChosenSubtypePredicate; +import mage.filter.predicate.permanent.TokenPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * + * @author ciaccona007 + */ +public final class MoltenEchoes extends CardImpl { + + public MoltenEchoes(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}{R}"); + + // As Molten Echoes enters the battlefield, choose a creature type. + this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.Copy))); + + // Whenever a nontoken creature of the chosen type enters the battlefield under your control, create a token that's a copy of that creature. That token gains haste. Exile it at the beginning of the next end step. + FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("nontoken creature of the chosen type"); + filter.add(Predicates.not(TokenPredicate.instance)); + filter.add(ChosenSubtypePredicate.instance); + + Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new MoltenEchoesEffect(), + filter, false, SetTargetPointer.PERMANENT, + "Whenever a nontoken creature of the chosen type enters the battlefield under your control, " + + "create a token that's a copy of that creature. " + + "That token gains haste. Exile it at the beginning of the next end step"); + this.addAbility(ability); + } + + private MoltenEchoes(final MoltenEchoes card) { + super(card); + } + + @Override + public MoltenEchoes copy() { + return new MoltenEchoes(this); + } +} + +class MoltenEchoesEffect extends OneShotEffect { + + public MoltenEchoesEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "create a token that's a copy of that creature. That token gains haste. Exile it at the beginning of the next end step"; + } + + public MoltenEchoesEffect(final MoltenEchoesEffect effect) { + super(effect); + } + + @Override + public MoltenEchoesEffect copy() { + return new MoltenEchoesEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game); + if (permanent != null) { + CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(null, null, true); + effect.setTargetPointer(getTargetPointer()); + if (effect.apply(game, source)) { + for (Permanent tokenPermanent : effect.getAddedPermanent()) { + ExileTargetEffect exileEffect = new ExileTargetEffect(); + exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game)); + DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect); + game.addDelayedTriggeredAbility(delayedAbility, source); + } + return true; + } + } + + return false; + } +} + diff --git a/Mage.Sets/src/mage/sets/Commander2020Edition.java b/Mage.Sets/src/mage/sets/Commander2020Edition.java index e1f982d325..e3aa032990 100644 --- a/Mage.Sets/src/mage/sets/Commander2020Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2020Edition.java @@ -200,6 +200,7 @@ public final class Commander2020Edition extends ExpansionSet { cards.add(new SetCardInfo("Mimic Vat", 246, Rarity.RARE, mage.cards.m.MimicVat.class)); cards.add(new SetCardInfo("Mind Spring", 116, Rarity.RARE, mage.cards.m.MindSpring.class)); cards.add(new SetCardInfo("Mindleecher", 44, Rarity.RARE, mage.cards.m.Mindleecher.class)); + cards.add(new SetCardInfo("Molten Echoes", 54, Rarity.RARE, mage.cards.m.MoltenEchoes.class)); cards.add(new SetCardInfo("Mortuary Mire", 289, Rarity.COMMON, mage.cards.m.MortuaryMire.class)); cards.add(new SetCardInfo("Mossfire Valley", 290, Rarity.RARE, mage.cards.m.MossfireValley.class)); cards.add(new SetCardInfo("Mosswort Bridge", 291, Rarity.RARE, mage.cards.m.MosswortBridge.class));