[MKM] Implement Unyielding Gatekeeper (#12045)

This commit is contained in:
Cameron Merkel 2024-04-04 15:20:16 -05:00 committed by GitHub
parent 146e093824
commit ee94be7322
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 103 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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));