From 9563714dcb0cbd8ebcc516141fdb56fa6e6cf5f2 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Mon, 8 Dec 2025 10:18:54 -0500 Subject: [PATCH] [DSK] Implement Ghostly Keybearer --- .../src/mage/cards/g/GhostlyKeybearer.java | 91 +++++++++++++++++++ .../src/mage/sets/DuskmournHouseOfHorror.java | 1 + 2 files changed, 92 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GhostlyKeybearer.java diff --git a/Mage.Sets/src/mage/cards/g/GhostlyKeybearer.java b/Mage.Sets/src/mage/cards/g/GhostlyKeybearer.java new file mode 100644 index 00000000000..c387627e364 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GhostlyKeybearer.java @@ -0,0 +1,91 @@ +package mage.cards.g; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GhostlyKeybearer extends CardImpl { + + private static final FilterPermanent filter = new FilterControlledPermanent(SubType.ROOM); + + public GhostlyKeybearer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); + + this.subtype.add(SubType.SPIRIT); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Whenever this creature deals combat damage to a player, unlock a locked door of up to one target Room you control. + Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new GhostlyKeybearerEffect()); + ability.addTarget(new TargetPermanent(0, 1, filter)); + this.addAbility(ability); + } + + private GhostlyKeybearer(final GhostlyKeybearer card) { + super(card); + } + + @Override + public GhostlyKeybearer copy() { + return new GhostlyKeybearer(this); + } +} + +class GhostlyKeybearerEffect extends OneShotEffect { + + GhostlyKeybearerEffect() { + super(Outcome.Benefit); + staticText = "unlock a locked door of up to one target Room you control"; + } + + private GhostlyKeybearerEffect(final GhostlyKeybearerEffect effect) { + super(effect); + } + + @Override + public GhostlyKeybearerEffect copy() { + return new GhostlyKeybearerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (player == null || permanent == null || !permanent.isLeftDoorUnlocked() && !permanent.isRightDoorUnlocked()) { + return false; + } + boolean unlockLeft; + if (!permanent.isLeftDoorUnlocked() && permanent.isRightDoorUnlocked()) { + unlockLeft = true; + } else if (permanent.isLeftDoorUnlocked() && !permanent.isRightDoorUnlocked()) { + unlockLeft = false; + } else { + unlockLeft = player.chooseUse( + Outcome.Neutral, "Unlock the left door or the right door?", + null, "Left", "Right", source, game + ); + } + return permanent.unlockDoor(game, source, unlockLeft); + } +} diff --git a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java index f221b78c050..03d1e984f3d 100644 --- a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java +++ b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java @@ -153,6 +153,7 @@ public final class DuskmournHouseOfHorror extends ExpansionSet { cards.add(new SetCardInfo("Ghost Vacuum", 326, Rarity.RARE, mage.cards.g.GhostVacuum.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Ghostly Dancers", 13, Rarity.RARE, mage.cards.g.GhostlyDancers.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Ghostly Dancers", 302, Rarity.RARE, mage.cards.g.GhostlyDancers.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Ghostly Keybearer", 61, Rarity.UNCOMMON, mage.cards.g.GhostlyKeybearer.class)); cards.add(new SetCardInfo("Give In to Violence", 101, Rarity.COMMON, mage.cards.g.GiveInToViolence.class)); cards.add(new SetCardInfo("Glassworks // Shattered Yard", 137, Rarity.COMMON, mage.cards.g.GlassworksShatteredYard.class)); cards.add(new SetCardInfo("Glimmer Seeker", 14, Rarity.UNCOMMON, mage.cards.g.GlimmerSeeker.class));