[SPM] Implement Interdimensional Web Watch

This commit is contained in:
jmlundeen 2025-09-03 13:12:25 -05:00
parent e7636fb17d
commit e19c454aa3
3 changed files with 162 additions and 0 deletions

View file

@ -0,0 +1,82 @@
package mage.cards.i;
import mage.ConditionalMana;
import mage.MageObject;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.effects.common.ExileTopXMayPlayUntilEffect;
import mage.abilities.mana.ConditionalAnyColorManaAbility;
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.Duration;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.stack.Spell;
import java.util.UUID;
/**
*
* @author Jmlundeen
*/
public final class InterdimensionalWebWatch extends CardImpl {
public InterdimensionalWebWatch(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
// When this artifact enters, exile the top two cards of your library. Until the end of your next turn, you may play those cards.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ExileTopXMayPlayUntilEffect(2, Duration.UntilEndOfYourNextTurn)));
// {T}: Add two mana in any combination of colors. Spend this mana only to cast spells from exile.
this.addAbility(new ConditionalAnyColorManaAbility(2, new InterdimensionalWebWatchManaBuilder()));
}
private InterdimensionalWebWatch(final InterdimensionalWebWatch card) {
super(card);
}
@Override
public InterdimensionalWebWatch copy() {
return new InterdimensionalWebWatch(this);
}
}
class InterdimensionalWebWatchManaBuilder extends ConditionalManaBuilder {
@Override
public ConditionalMana build(Object... options) {
return new InterdimensionalWebWatchConditionalMana(this.mana);
}
@Override
public String getRule() {
return "Spend this mana only to cast spells from exile";
}
}
class InterdimensionalWebWatchConditionalMana extends ConditionalMana {
public InterdimensionalWebWatchConditionalMana(Mana mana) {
super(mana);
staticText = "Spend this mana only to cast spells from exile";
addCondition(new InterdimensionalWebWatchCondition());
}
}
class InterdimensionalWebWatchCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
MageObject object = game.getObject(source.getSourceId());
if (game.inCheckPlayableState()) {
return object instanceof Card && game.getState().getZone(source.getSourceId()) == Zone.EXILED;
}
return object instanceof Spell && ((Spell) object).getFromZone() == Zone.EXILED;
}
}

View file

@ -77,6 +77,8 @@ public final class MarvelsSpiderMan extends ExpansionSet {
cards.add(new SetCardInfo("Hot Dog Cart", 164, Rarity.COMMON, mage.cards.h.HotDogCart.class)); cards.add(new SetCardInfo("Hot Dog Cart", 164, Rarity.COMMON, mage.cards.h.HotDogCart.class));
cards.add(new SetCardInfo("Impostor Syndrome", 251, Rarity.MYTHIC, mage.cards.i.ImpostorSyndrome.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Impostor Syndrome", 251, Rarity.MYTHIC, mage.cards.i.ImpostorSyndrome.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Impostor Syndrome", 34, Rarity.MYTHIC, mage.cards.i.ImpostorSyndrome.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Impostor Syndrome", 34, Rarity.MYTHIC, mage.cards.i.ImpostorSyndrome.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Interdimensional Web Watch", 165, Rarity.RARE, mage.cards.i.InterdimensionalWebWatch.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Interdimensional Web Watch", 278, Rarity.RARE, mage.cards.i.InterdimensionalWebWatch.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Iron Spider, Stark Upgrade", 166, Rarity.RARE, mage.cards.i.IronSpiderStarkUpgrade.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Iron Spider, Stark Upgrade", 166, Rarity.RARE, mage.cards.i.IronSpiderStarkUpgrade.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Iron Spider, Stark Upgrade", 279, Rarity.RARE, mage.cards.i.IronSpiderStarkUpgrade.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Iron Spider, Stark Upgrade", 279, Rarity.RARE, mage.cards.i.IronSpiderStarkUpgrade.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Island", 190, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Island", 190, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS));

View file

@ -0,0 +1,78 @@
package org.mage.test.cards.single.spm;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author Jmlundeen
*/
public class InterdimensionalWebWatchTest extends CardTestPlayerBase {
/*
Interdimensional Web Watch
{4}
Artifact
When this artifact enters, exile the top two cards of your library. Until the end of your next turn, you may play those cards.
{T}: Add two mana in any combination of colors. Spend this mana only to cast spells from exile.
*/
private static final String interdimensionalWebWatch = "Interdimensional Web Watch";
/*
Lightning Bolt
{R}
Instant
Lightning Bolt deals 3 damage to any target.
*/
private static final String lightningBolt = "Lightning Bolt";
/*
Fugitive Wizard
{U}
Creature - Human Wizard
1/1
*/
private static final String fugitiveWizard = "Fugitive Wizard";
/*
Shock
{R}
Instant
Shock deals 2 damage to any target.
*/
private static final String shock = "Shock";
@Test
public void testInterdimensionalWebWatch() {
setStrictChooseMode(true);
skipInitShuffling();
addCard(Zone.LIBRARY, playerA, lightningBolt);
addCard(Zone.LIBRARY, playerA, fugitiveWizard);
addCard(Zone.HAND, playerA, interdimensionalWebWatch);
addCard(Zone.HAND, playerA, shock);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, interdimensionalWebWatch, true);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add two");
setChoiceAmount(playerA, 0, 1, 0, 1, 0); // Add {U}{R}
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
checkPlayableAbility("Can't cast shock from hand", 1, PhaseStep.PRECOMBAT_MAIN, playerA,
"Cast " + shock, false);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, lightningBolt, true);
addTarget(playerA, playerB);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, fugitiveWizard);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertLife(playerB, 20 - 3);
assertPermanentCount(playerA, fugitiveWizard, 1);
}
}