From 4acdd58eabc2debbe45db9ceb408de8ec08d358e Mon Sep 17 00:00:00 2001 From: xenohedron <12538125+xenohedron@users.noreply.github.com> Date: Sun, 25 Jan 2026 20:46:10 -0500 Subject: [PATCH] implement [DSK] Creeping Peeper --- .../src/mage/cards/c/CreepingPeeper.java | 113 ++++++++++++++++++ .../src/mage/sets/DuskmournHouseOfHorror.java | 1 + 2 files changed, 114 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CreepingPeeper.java diff --git a/Mage.Sets/src/mage/cards/c/CreepingPeeper.java b/Mage.Sets/src/mage/cards/c/CreepingPeeper.java new file mode 100644 index 00000000000..b548efce421 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CreepingPeeper.java @@ -0,0 +1,113 @@ +package mage.cards.c; + +import mage.ConditionalMana; +import mage.MageInt; +import mage.MageObject; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.SpellAbility; +import mage.abilities.common.RoomUnlockAbility; +import mage.abilities.common.TurnFaceUpAbility; +import mage.abilities.condition.Condition; +import mage.abilities.mana.ConditionalColoredManaAbility; +import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.game.Game; +import mage.game.command.Commander; +import mage.game.permanent.Permanent; +import mage.game.stack.Spell; +import mage.game.stack.StackObject; + +import java.util.UUID; + +/** + * @author xenohedron + */ +public final class CreepingPeeper extends CardImpl { + + public CreepingPeeper(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); + + this.subtype.add(SubType.EYE); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // {T}: Add {U}. Spend this mana only to cast an enchantment spell, unlock a door, or turn a permanent face up. + this.addAbility(new ConditionalColoredManaAbility(Mana.BlueMana(1), new CreepingPeeperManaBuilder())); + + } + + private CreepingPeeper(final CreepingPeeper card) { + super(card); + } + + @Override + public CreepingPeeper copy() { + return new CreepingPeeper(this); + } +} + +class CreepingPeeperManaBuilder extends ConditionalManaBuilder { + + @Override + public ConditionalMana build(Object... options) { + return new CreepingPeeperConditionalMana(this.mana); + } + + @Override + public String getRule() { + return "Spend this mana only to cast an enchantment spell, unlock a door, or turn a permanent face up"; + } +} + +class CreepingPeeperConditionalMana extends ConditionalMana { + + public CreepingPeeperConditionalMana(Mana mana) { + super(mana); + addCondition(new CreepingPeeperManaCondition()); + } +} + +class CreepingPeeperManaCondition implements Condition { + + @Override + public boolean apply(Game game, Ability source) { + // cast an enchantment + if (source instanceof SpellAbility && !source.isActivated()) { + MageObject object = game.getObject(source); + if ((object instanceof StackObject)) { + return object.isEnchantment(game); + } + // checking mana without real cast + if (game.inCheckPlayableState()) { + Spell spell = null; + if (object instanceof Card) { + spell = new Spell((Card) object, (SpellAbility) source, source.getControllerId(), game.getState().getZone(source.getSourceId()), game); + } else if (object instanceof Commander) { + spell = new Spell(((Commander) object).getSourceObject(), (SpellAbility) source, source.getControllerId(), game.getState().getZone(source.getSourceId()), game); + } + return spell != null && spell.isEnchantment(game); + } + } + // unlock a door + if (source instanceof RoomUnlockAbility) { + return true; + } + // turn a permanent face up + if (source instanceof TurnFaceUpAbility) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent == null) { + return false; + } + return permanent.isManifested() + || permanent.isMorphed() + || permanent.isDisguised() + || permanent.isCloaked(); + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java index a1b88dec348..1c59406f553 100644 --- a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java +++ b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java @@ -61,6 +61,7 @@ public final class DuskmournHouseOfHorror extends ExpansionSet { cards.add(new SetCardInfo("Conductive Machete", 244, Rarity.UNCOMMON, mage.cards.c.ConductiveMachete.class)); cards.add(new SetCardInfo("Coordinated Clobbering", 173, Rarity.UNCOMMON, mage.cards.c.CoordinatedClobbering.class)); cards.add(new SetCardInfo("Cracked Skull", 88, Rarity.COMMON, mage.cards.c.CrackedSkull.class)); + cards.add(new SetCardInfo("Creeping Peeper", 46, Rarity.COMMON, mage.cards.c.CreepingPeeper.class)); cards.add(new SetCardInfo("Cryptid Inspector", 174, Rarity.COMMON, mage.cards.c.CryptidInspector.class)); cards.add(new SetCardInfo("Cult Healer", 2, Rarity.COMMON, mage.cards.c.CultHealer.class)); cards.add(new SetCardInfo("Cursed Recording", 131, Rarity.RARE, mage.cards.c.CursedRecording.class, NON_FULL_USE_VARIOUS));