[DSK] Implement Ghostly Keybearer

This commit is contained in:
theelk801 2025-12-08 10:18:54 -05:00
parent 91f61f3f66
commit 9563714dcb
2 changed files with 92 additions and 0 deletions

View file

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

View file

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