From 091c6cb48d8ded584e552ae4c12daf0c2b400563 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 6 Nov 2021 13:58:20 -0400 Subject: [PATCH] [VOW] Implemented Lantern of the Lost --- .../src/mage/cards/l/LanternOfTheLost.java | 89 +++++++++++++++++++ .../src/mage/sets/InnistradCrimsonVow.java | 1 + 2 files changed, 90 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/LanternOfTheLost.java diff --git a/Mage.Sets/src/mage/cards/l/LanternOfTheLost.java b/Mage.Sets/src/mage/cards/l/LanternOfTheLost.java new file mode 100644 index 0000000000..6da5e390ba --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LanternOfTheLost.java @@ -0,0 +1,89 @@ +package mage.cards.l; + +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.ExileSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInGraveyard; + +import java.util.Objects; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class LanternOfTheLost extends CardImpl { + + public LanternOfTheLost(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}"); + + // When Lantern of the Lost enters the battlefield, exile target card from a graveyard. + Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetEffect()); + ability.addTarget(new TargetCardInGraveyard()); + this.addAbility(ability); + + // {1}, {T}, Exile Lantern of the Lost: Exile all cards from all graveyards, then draw a card. + ability = new SimpleActivatedAbility(new LanternOfTheLostEffect(), new GenericManaCost(1)); + ability.addCost(new TapSourceCost()); + ability.addCost(new ExileSourceCost()); + this.addAbility(ability); + } + + private LanternOfTheLost(final LanternOfTheLost card) { + super(card); + } + + @Override + public LanternOfTheLost copy() { + return new LanternOfTheLost(this); + } +} + +class LanternOfTheLostEffect extends OneShotEffect { + + LanternOfTheLostEffect() { + super(Outcome.Benefit); + staticText = "exile all cards from all graveyards, then draw a card"; + } + + private LanternOfTheLostEffect(final LanternOfTheLostEffect effect) { + super(effect); + } + + @Override + public LanternOfTheLostEffect copy() { + return new LanternOfTheLostEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Cards cards = new CardsImpl(); + game.getState() + .getPlayersInRange(source.getControllerId(), game) + .stream() + .map(game::getPlayer) + .filter(Objects::nonNull) + .map(Player::getGraveyard) + .forEach(cards::addAll); + player.moveCards(cards, Zone.EXILED, source, game); + player.drawCards(1, source, game); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java index e55045ab88..c8d239cba4 100644 --- a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java +++ b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java @@ -163,6 +163,7 @@ public final class InnistradCrimsonVow extends ExpansionSet { cards.add(new SetCardInfo("Lambholt Ravager", 167, Rarity.UNCOMMON, mage.cards.l.LambholtRavager.class)); cards.add(new SetCardInfo("Lantern Bearer", 66, Rarity.COMMON, mage.cards.l.LanternBearer.class)); cards.add(new SetCardInfo("Lantern Flare", 23, Rarity.RARE, mage.cards.l.LanternFlare.class)); + cards.add(new SetCardInfo("Lantern of the Lost", 259, Rarity.UNCOMMON, mage.cards.l.LanternOfTheLost.class)); cards.add(new SetCardInfo("Lanterns' Lift", 66, Rarity.COMMON, mage.cards.l.LanternsLift.class)); cards.add(new SetCardInfo("Lightning Wolf", 168, Rarity.COMMON, mage.cards.l.LightningWolf.class)); cards.add(new SetCardInfo("Lunar Rejection", 67, Rarity.UNCOMMON, mage.cards.l.LunarRejection.class));