From 5f22004ad329cae5f008a7d9d82c68afdd3e12b8 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sun, 7 May 2023 09:36:27 -0400 Subject: [PATCH] [LTR] Implement Lobelia Sackville-Baggins --- .../mage/cards/l/LobeliaSackvilleBaggins.java | 99 +++++++++++++++++++ .../TheLordOfTheRingsTalesOfMiddleEarth.java | 1 + 2 files changed, 100 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/LobeliaSackvilleBaggins.java diff --git a/Mage.Sets/src/mage/cards/l/LobeliaSackvilleBaggins.java b/Mage.Sets/src/mage/cards/l/LobeliaSackvilleBaggins.java new file mode 100644 index 0000000000..86926bf0b2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LobeliaSackvilleBaggins.java @@ -0,0 +1,99 @@ +package mage.cards.l; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlashAbility; +import mage.abilities.keyword.MenaceAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.card.PutIntoGraveFromBattlefieldThisTurnPredicate; +import mage.game.Game; +import mage.game.permanent.token.TreasureToken; +import mage.players.Player; +import mage.target.common.TargetCardInOpponentsGraveyard; +import mage.watchers.common.CardsPutIntoGraveyardWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class LobeliaSackvilleBaggins extends CardImpl { + + private static final FilterCard filter = new FilterCreatureCard( + "creature card from an opponent's graveyard that was put there from the battlefield this turn" + ); + + static { + filter.add(PutIntoGraveFromBattlefieldThisTurnPredicate.instance); + } + + public LobeliaSackvilleBaggins(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HALFLING); + this.subtype.add(SubType.CITIZEN); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Menace + this.addAbility(new MenaceAbility()); + + // When Lobelia Sackville-Baggins enters the battlefield, exile target creature card from an opponent's graveyard that was put there from the battlefield this turn, then create X Treasure tokens, where X is the exiled card's power. + Ability ability = new EntersBattlefieldTriggeredAbility(new LobeliaSackvilleBagginsEffect()); + ability.addTarget(new TargetCardInOpponentsGraveyard(filter)); + this.addAbility(ability, new CardsPutIntoGraveyardWatcher()); + } + + private LobeliaSackvilleBaggins(final LobeliaSackvilleBaggins card) { + super(card); + } + + @Override + public LobeliaSackvilleBaggins copy() { + return new LobeliaSackvilleBaggins(this); + } +} + +class LobeliaSackvilleBagginsEffect extends OneShotEffect { + + LobeliaSackvilleBagginsEffect() { + super(Outcome.Benefit); + staticText = "exile target creature card from an opponent's graveyard that was put there " + + "from the battlefield this turn, then create X Treasure tokens, where X is the exiled card's power"; + } + + private LobeliaSackvilleBagginsEffect(final LobeliaSackvilleBagginsEffect effect) { + super(effect); + } + + @Override + public LobeliaSackvilleBagginsEffect copy() { + return new LobeliaSackvilleBagginsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Card card = game.getCard(getTargetPointer().getFirst(game, source)); + if (player == null || card == null) { + return false; + } + player.moveCards(card, Zone.EXILED, source, game); + int power = card.getPower().getValue(); + if (power > 0) { + new TreasureToken().putOntoBattlefield(power, game, source); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index 706373594b..f218a7b258 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -29,6 +29,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Gandalf the Grey", 207, Rarity.RARE, mage.cards.g.GandalfTheGrey.class)); cards.add(new SetCardInfo("Gollum, Patient Plotter", 84, Rarity.UNCOMMON, mage.cards.g.GollumPatientPlotter.class)); cards.add(new SetCardInfo("Island", 274, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS)); + cards.add(new SetCardInfo("Lobelia Sackville-Baggins", 399, Rarity.RARE, mage.cards.l.LobeliaSackvilleBaggins.class)); cards.add(new SetCardInfo("Mount Doom", 258, Rarity.MYTHIC, mage.cards.m.MountDoom.class)); cards.add(new SetCardInfo("Mountain", 278, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Plains", 272, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS));