From 0f1034bd243a16344a3a3cc6aaa49d42d1403ba4 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Mon, 24 Mar 2025 14:43:01 -0400 Subject: [PATCH] [TDM] Implement Embermouth Sentinel --- .../src/mage/cards/e/EmbermouthSentinel.java | 93 +++++++++++++++++++ .../src/mage/sets/TarkirDragonstorm.java | 1 + 2 files changed, 94 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/e/EmbermouthSentinel.java diff --git a/Mage.Sets/src/mage/cards/e/EmbermouthSentinel.java b/Mage.Sets/src/mage/cards/e/EmbermouthSentinel.java new file mode 100644 index 00000000000..df2aa14f804 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EmbermouthSentinel.java @@ -0,0 +1,93 @@ +package mage.cards.e; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class EmbermouthSentinel extends CardImpl { + + public EmbermouthSentinel(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}"); + + this.subtype.add(SubType.CHIMERA); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // When this creature enters, you may search your library for a basic land card, reveal it, then shuffle and put that card on top. If you control a Dragon, put that card onto the battlefield tapped instead. + this.addAbility(new EntersBattlefieldTriggeredAbility(new EmbermouthSentinelEffect(), true)); + } + + private EmbermouthSentinel(final EmbermouthSentinel card) { + super(card); + } + + @Override + public EmbermouthSentinel copy() { + return new EmbermouthSentinel(this); + } +} + +class EmbermouthSentinelEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterControlledPermanent(SubType.DRAGON); + + EmbermouthSentinelEffect() { + super(Outcome.Benefit); + staticText = "search your library for a basic land card, reveal it, then shuffle and put that card on top. " + + "If you control a Dragon, put that card onto the battlefield tapped instead"; + } + + private EmbermouthSentinelEffect(final EmbermouthSentinelEffect effect) { + super(effect); + } + + @Override + public EmbermouthSentinelEffect copy() { + return new EmbermouthSentinelEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND); + player.searchLibrary(target, source, game); + Card card = player.getLibrary().getCard(target.getFirstTarget(), game); + player.shuffleLibrary(source, game); + if (card == null) { + return true; + } + player.revealCards(source, new CardsImpl(card), game); + if (game.getBattlefield().contains(filter, source, game, 1)) { + player.moveCards( + card, Zone.BATTLEFIELD, source, game, true, + false, false, null + ); + } else { + player.putCardsOnTopOfLibrary(card, game, source, false); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/TarkirDragonstorm.java b/Mage.Sets/src/mage/sets/TarkirDragonstorm.java index 0695995c72e..a2262b2d782 100644 --- a/Mage.Sets/src/mage/sets/TarkirDragonstorm.java +++ b/Mage.Sets/src/mage/sets/TarkirDragonstorm.java @@ -59,6 +59,7 @@ public final class TarkirDragonstorm extends ExpansionSet { cards.add(new SetCardInfo("Dragonstorm Forecaster", 43, Rarity.UNCOMMON, mage.cards.d.DragonstormForecaster.class)); cards.add(new SetCardInfo("Dusyut Earthcarver", 141, Rarity.COMMON, mage.cards.d.DusyutEarthcarver.class)); cards.add(new SetCardInfo("Duty Beyond Death", 10, Rarity.UNCOMMON, mage.cards.d.DutyBeyondDeath.class)); + cards.add(new SetCardInfo("Embermouth Sentinel", 242, Rarity.COMMON, mage.cards.e.EmbermouthSentinel.class)); cards.add(new SetCardInfo("Equilibrium Adept", 106, Rarity.UNCOMMON, mage.cards.e.EquilibriumAdept.class)); cards.add(new SetCardInfo("Evolving Wilds", 255, Rarity.COMMON, mage.cards.e.EvolvingWilds.class)); cards.add(new SetCardInfo("Fangkeeper's Familiar", 183, Rarity.RARE, mage.cards.f.FangkeepersFamiliar.class));