From af87260262875ab05bf330179b8cc3e03f05a511 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Thu, 27 May 2021 19:38:54 -0500 Subject: [PATCH] [MH2] Implemented Flay Essence (#7854) --- Mage.Sets/src/mage/cards/f/FlayEssence.java | 73 ++++++++++++++++++++ Mage.Sets/src/mage/sets/ModernHorizons2.java | 1 + 2 files changed, 74 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/f/FlayEssence.java diff --git a/Mage.Sets/src/mage/cards/f/FlayEssence.java b/Mage.Sets/src/mage/cards/f/FlayEssence.java new file mode 100644 index 0000000000..6163e608e6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FlayEssence.java @@ -0,0 +1,73 @@ +package mage.cards.f; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.counters.Counter; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreatureOrPlaneswalker; + +/** + * + * @author weirddan455 + */ +public final class FlayEssence extends CardImpl { + + public FlayEssence(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}"); + + // Exile target creature or planeswalker. You gain life equal to the number of counters on it. + this.getSpellAbility().addTarget(new TargetCreatureOrPlaneswalker()); + this.getSpellAbility().addEffect(new FlayEssenceEffect()); + } + + private FlayEssence(final FlayEssence card) { + super(card); + } + + @Override + public FlayEssence copy() { + return new FlayEssence(this); + } +} + +class FlayEssenceEffect extends OneShotEffect { + + public FlayEssenceEffect() { + super(Outcome.Exile); + this.staticText = "Exile target creature or planeswalker. You gain life equal to the number of counters on it"; + } + + private FlayEssenceEffect(final FlayEssenceEffect effect) { + super(effect); + } + + @Override + public FlayEssenceEffect copy() { + return new FlayEssenceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (controller != null && permanent != null) { + int life = 0; + for (Counter counter : permanent.getCounters(game).values()) { + life += counter.getCount(); + } + controller.moveCards(permanent, Zone.EXILED, source, game); + controller.gainLife(life, game, source); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/ModernHorizons2.java b/Mage.Sets/src/mage/sets/ModernHorizons2.java index c07a036635..b04824dc3b 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons2.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons2.java @@ -55,6 +55,7 @@ public final class ModernHorizons2 extends ExpansionSet { cards.add(new SetCardInfo("Extruder", 296, Rarity.UNCOMMON, mage.cards.e.Extruder.class)); cards.add(new SetCardInfo("Flame Rift", 278, Rarity.UNCOMMON, mage.cards.f.FlameRift.class)); cards.add(new SetCardInfo("Flametongue Yearling", 125, Rarity.UNCOMMON, mage.cards.f.FlametongueYearling.class)); + cards.add(new SetCardInfo("Flay Essence", 85, Rarity.UNCOMMON, mage.cards.f.FlayEssence.class)); cards.add(new SetCardInfo("Forest", 489, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Fractured Sanity", 44, Rarity.RARE, mage.cards.f.FracturedSanity.class)); cards.add(new SetCardInfo("Goblin Bombardment", 279, Rarity.RARE, mage.cards.g.GoblinBombardment.class));