From 049dd48d0a2e1b51a56a6ac40ad790cf5fb573dc Mon Sep 17 00:00:00 2001 From: Rowan Gudmundsson <32584686+Rowan-Gudmundsson@users.noreply.github.com> Date: Wed, 1 Mar 2023 02:40:45 -0800 Subject: [PATCH] [CLB] Implement Deep Gnome Terramancer (#9858) --- .../mage/cards/d/DeepGnomeTerramancer.java | 102 ++++++++++++++++++ .../CommanderLegendsBattleForBaldursGate.java | 2 + 2 files changed, 104 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DeepGnomeTerramancer.java diff --git a/Mage.Sets/src/mage/cards/d/DeepGnomeTerramancer.java b/Mage.Sets/src/mage/cards/d/DeepGnomeTerramancer.java new file mode 100644 index 0000000000..9213e78c17 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DeepGnomeTerramancer.java @@ -0,0 +1,102 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.abilities.keyword.FlashAbility; +import mage.abilities.TriggeredAbilityImpl; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.game.events.GameEvent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCardInLibrary; +import mage.watchers.common.PlayLandWatcher; + +import java.util.UUID; + +/** + * @author rgudmundsson + */ +public final class DeepGnomeTerramancer extends CardImpl { + + public DeepGnomeTerramancer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[] { CardType.CREATURE }, "{1}{W}"); + this.subtype.add(SubType.GNOME, SubType.WIZARD); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Whenever one or more lands enter the battlefield under an opponent's control + // without being played, you may search your library for a Plains card, put it + // onto the battlefield tapped, then shuffle. Do this only once each turn. + this.addAbility(new DeepGnomeTerramancerTriggeredAbility().setDoOnlyOnce(true), new PlayLandWatcher()); + } + + private DeepGnomeTerramancer(final DeepGnomeTerramancer card) { + super(card); + } + + @Override + public DeepGnomeTerramancer copy() { + return new DeepGnomeTerramancer(this); + } +} + +class DeepGnomeTerramancerTriggeredAbility extends TriggeredAbilityImpl { + + DeepGnomeTerramancerTriggeredAbility() { + super(Zone.BATTLEFIELD, null); + + FilterCard filter = new FilterCard("Plains card"); + filter.add(SubType.PLAINS.getPredicate()); + TargetCardInLibrary target = new TargetCardInLibrary(filter); + addEffect(new SearchLibraryPutInPlayEffect(target, true, true, Outcome.PutLandInPlay)); + } + + DeepGnomeTerramancerTriggeredAbility(DeepGnomeTerramancerTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent land = game.getPermanent(event.getTargetId()); + PlayLandWatcher watcher = game.getState().getWatcher(PlayLandWatcher.class); + + if (land == null || !land.isLand(game)) { // Permanent is not a land + return false; + } + + if (land.isControlledBy(this.controllerId)) { // Land enters under ability controllers control + return false; + } + + if (watcher.wasLandPlayed(land.getId())) { // Land was played + return false; + } + + return true; + } + + @Override + public DeepGnomeTerramancerTriggeredAbility copy() { + return new DeepGnomeTerramancerTriggeredAbility(this); + } + + @Override + public String getRule() { + return "Whenever one or more lands enter the battlefield under an opponent's control without being played, you may search " + + "your library for a Plains card, put it onto the battlefield tapped, then shuffle. Do this only once each turn."; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index 05605c74f6..643e138b46 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -169,6 +169,8 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Deadly Dispute", 124, Rarity.COMMON, mage.cards.d.DeadlyDispute.class)); cards.add(new SetCardInfo("Death Kiss", 675, Rarity.RARE, mage.cards.d.DeathKiss.class)); cards.add(new SetCardInfo("Decanter of Endless Water", 309, Rarity.COMMON, mage.cards.d.DecanterOfEndlessWater.class)); + cards.add(new SetCardInfo("Deep Gnome Terramancer", 658, Rarity.RARE, mage.cards.d.DeepGnomeTerramancer.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Deep Gnome Terramancer", 607, Rarity.RARE, mage.cards.d.DeepGnomeTerramancer.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Delayed Blast Fireball", 676, Rarity.RARE, mage.cards.d.DelayedBlastFireball.class)); cards.add(new SetCardInfo("Demon Bolt", 787, Rarity.COMMON, mage.cards.d.DemonBolt.class)); cards.add(new SetCardInfo("Descent into Avernus", 169, Rarity.RARE, mage.cards.d.DescentIntoAvernus.class));