From ee94be7322cd067383af20068ef1391ceb02c57c Mon Sep 17 00:00:00 2001 From: Cameron Merkel <44722506+Cguy7777@users.noreply.github.com> Date: Thu, 4 Apr 2024 15:20:16 -0500 Subject: [PATCH] [MKM] Implement Unyielding Gatekeeper (#12045) --- .../mage/cards/u/UnyieldingGatekeeper.java | 101 ++++++++++++++++++ .../src/mage/sets/MurdersAtKarlovManor.java | 2 + 2 files changed, 103 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/u/UnyieldingGatekeeper.java diff --git a/Mage.Sets/src/mage/cards/u/UnyieldingGatekeeper.java b/Mage.Sets/src/mage/cards/u/UnyieldingGatekeeper.java new file mode 100644 index 00000000000..139dc896374 --- /dev/null +++ b/Mage.Sets/src/mage/cards/u/UnyieldingGatekeeper.java @@ -0,0 +1,101 @@ +package mage.cards.u; + +import java.util.UUID; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenControllerTargetPermanentEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.abilities.effects.common.ExileThenReturnTargetEffect; +import mage.constants.Outcome; +import mage.constants.PutCards; +import mage.constants.SubType; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.keyword.DisguiseAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.filter.common.FilterNonlandPermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.DetectiveToken; +import mage.target.common.TargetNonlandPermanent; + +/** + * @author Cguy7777 + */ +public final class UnyieldingGatekeeper extends CardImpl { + + private static final FilterNonlandPermanent filter = new FilterNonlandPermanent(); + + static { + filter.add(AnotherPredicate.instance); + } + + public UnyieldingGatekeeper(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); + + this.subtype.add(SubType.ELEPHANT); + this.subtype.add(SubType.CLERIC); + this.power = new MageInt(3); + this.toughness = new MageInt(2); + + // Disguise {1}{W} + this.addAbility(new DisguiseAbility(this, new ManaCostsImpl<>("{1}{W}"))); + + // When Unyielding Gatekeeper is turned face up, exile another target nonland permanent. + // If you controlled it, return it to the battlefield tapped. + // Otherwise, its controller creates a 2/2 white and blue Detective creature token. + Ability ability = new TurnedFaceUpSourceTriggeredAbility(new UnyieldingGatekeeperEffect()); + ability.addTarget(new TargetNonlandPermanent(filter)); + this.addAbility(ability); + } + + private UnyieldingGatekeeper(final UnyieldingGatekeeper card) { + super(card); + } + + @Override + public UnyieldingGatekeeper copy() { + return new UnyieldingGatekeeper(this); + } +} + +class UnyieldingGatekeeperEffect extends OneShotEffect { + + UnyieldingGatekeeperEffect() { + super(Outcome.Benefit); + staticText = "exile another target nonland permanent. " + + "If you controlled it, return it to the battlefield tapped. " + + "Otherwise, its controller creates a 2/2 white and blue Detective creature token"; + } + + private UnyieldingGatekeeperEffect(final UnyieldingGatekeeperEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (permanent == null) { + return false; + } + + if (permanent.isControlledBy(source.getControllerId())) { + new ExileThenReturnTargetEffect( + false, false, PutCards.BATTLEFIELD_TAPPED).apply(game, source); + } else { + new ExileTargetEffect().apply(game, source); + new CreateTokenControllerTargetPermanentEffect(new DetectiveToken()).apply(game, source); + } + return true; + } + + @Override + public UnyieldingGatekeeperEffect copy() { + return new UnyieldingGatekeeperEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/MurdersAtKarlovManor.java b/Mage.Sets/src/mage/sets/MurdersAtKarlovManor.java index 167b387aeaa..337d93fe4d7 100644 --- a/Mage.Sets/src/mage/sets/MurdersAtKarlovManor.java +++ b/Mage.Sets/src/mage/sets/MurdersAtKarlovManor.java @@ -275,6 +275,8 @@ public final class MurdersAtKarlovManor extends ExpansionSet { cards.add(new SetCardInfo("Underground Mortuary", 271, Rarity.RARE, mage.cards.u.UndergroundMortuary.class)); cards.add(new SetCardInfo("Undergrowth Recon", 181, Rarity.MYTHIC, mage.cards.u.UndergrowthRecon.class)); cards.add(new SetCardInfo("Unscrupulous Agent", 109, Rarity.COMMON, mage.cards.u.UnscrupulousAgent.class)); + cards.add(new SetCardInfo("Unyielding Gatekeeper", 35, Rarity.RARE, mage.cards.u.UnyieldingGatekeeper.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Unyielding Gatekeeper", 392, Rarity.RARE, mage.cards.u.UnyieldingGatekeeper.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Urgent Necropsy", 240, Rarity.MYTHIC, mage.cards.u.UrgentNecropsy.class)); cards.add(new SetCardInfo("Vein Ripper", 110, Rarity.MYTHIC, mage.cards.v.VeinRipper.class)); cards.add(new SetCardInfo("Vengeful Creeper", 182, Rarity.COMMON, mage.cards.v.VengefulCreeper.class));