[SPM] Implement The Clone Saga

This commit is contained in:
jmlundeen 2025-08-31 00:23:26 -05:00
parent 480ac32cb0
commit 9021a7bd8a
3 changed files with 174 additions and 0 deletions

View file

@ -0,0 +1,108 @@
package mage.cards.t;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.SagaAbility;
import mage.abilities.common.delayed.CopyNextSpellDelayedTriggeredAbility;
import mage.abilities.effects.common.ChooseACardNameEffect;
import mage.abilities.effects.common.CopyTargetStackObjectEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.keyword.SurveilEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ChosenNamePredicate;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.util.functions.RemoveTypeCopyApplier;
import java.util.UUID;
/**
*
* @author Jmlundeen
*/
public final class TheCloneSaga extends CardImpl {
public TheCloneSaga(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
this.subtype.add(SubType.SAGA);
// (As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.)
SagaAbility sagaAbility = new SagaAbility(this);
// I -- Surveil 3.
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_I, new SurveilEffect(3));
// II -- When you next cast a creature spell this turn, copy it, except the copy isn't legendary.
DelayedTriggeredAbility ability = new CopyNextSpellDelayedTriggeredAbility(
StaticFilters.FILTER_SPELL_A_CREATURE,
new CopyTargetStackObjectEffect(false, false, false, 1, new RemoveTypeCopyApplier(SuperType.LEGENDARY)),
"When you next cast a creature spell this turn, copy it, except the copy isn't legendary"
);
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_II, new CreateDelayedTriggeredAbilityEffect(ability));
// III -- Choose a card name. Whenever a creature with the chosen name deals combat damage to a player this turn, draw a card.
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_III, new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.ALL),
new CreateDelayedTriggeredAbilityEffect(new TheCloneSagaDelayedTrigger()));
this.addAbility(sagaAbility);
}
private TheCloneSaga(final TheCloneSaga card) {
super(card);
}
@Override
public TheCloneSaga copy() {
return new TheCloneSaga(this);
}
}
class TheCloneSagaDelayedTrigger extends DelayedTriggeredAbility {
private static final FilterPermanent filter = new FilterCreaturePermanent("creature with the chosen name");
static {
filter.add(ChosenNamePredicate.instance);
}
TheCloneSagaDelayedTrigger() {
super(new DrawCardSourceControllerEffect(1), Duration.EndOfTurn, false);
}
private TheCloneSagaDelayedTrigger(final TheCloneSagaDelayedTrigger ability) {
super(ability);
}
@Override
public TheCloneSagaDelayedTrigger copy() {
return new TheCloneSagaDelayedTrigger(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (((DamagedPlayerEvent) event).isCombatDamage()) {
Permanent creature = game.getPermanent(event.getSourceId());
return creature != null && filter.match(creature, getControllerId(), this, game);
}
return false;
}
@Override
public String getRule() {
return "Whenever a creature with the chosen name deals combat damage to a player this turn, draw a card.";
}
}

View file

@ -142,6 +142,8 @@ public final class MarvelsSpiderMan extends ExpansionSet {
cards.add(new SetCardInfo("Symbiote Spider-Man", 156, Rarity.RARE, mage.cards.s.SymbioteSpiderMan.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Symbiote Spider-Man", 217, Rarity.RARE, mage.cards.s.SymbioteSpiderMan.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Taxi Driver", 97, Rarity.COMMON, mage.cards.t.TaxiDriver.class));
cards.add(new SetCardInfo("The Clone Saga", 219, Rarity.RARE, mage.cards.t.TheCloneSaga.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("The Clone Saga", 28, Rarity.RARE, mage.cards.t.TheCloneSaga.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Thwip!", 20, Rarity.COMMON, mage.cards.t.Thwip.class));
cards.add(new SetCardInfo("Tombstone, Career Criminal", 70, Rarity.UNCOMMON, mage.cards.t.TombstoneCareerCriminal.class));
cards.add(new SetCardInfo("Ultimate Green Goblin", 157, Rarity.RARE, mage.cards.u.UltimateGreenGoblin.class, NON_FULL_USE_VARIOUS));

View file

@ -0,0 +1,64 @@
package org.mage.test.cards.single.spm;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.player.TestPlayer;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author Jmlundeen
*/
public class TheCloneSagaTest extends CardTestPlayerBase {
/*
The Clone Saga
{3}{U}
Enchantment - Saga
(As this Saga enters step, add a lore counter. Sacrifice after III.)
I -- Surveil 3.
II -- When you next cast a creature spell this turn, copy it, except the copy isn't legendary.
III -- Choose a card name. Whenever a creature with the chosen name deals combat damage to a player this turn, draw a card.
*/
private static final String theCloneSaga = "The Clone Saga";
/*
Ragavan, Nimble Pilferer
{R}
Legendary Creature - Monkey Pirate
Whenever Ragavan, Nimble Pilferer deals combat damage to a player, create a Treasure token and exile the top card of that player's library. Until end of turn, you may cast that card.
Dash {1}{R}
2/1
*/
private static final String ragavanNimblePilferer = "Ragavan, Nimble Pilferer";
@Test
public void testTheCloneSaga() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, theCloneSaga);
addCard(Zone.HAND, playerA, ragavanNimblePilferer);
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addTarget(playerA, TestPlayer.TARGET_SKIP);
setChoice(playerA, "Mountain", 2);
setChoice(playerA, ragavanNimblePilferer);
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, ragavanNimblePilferer);
setChoice(playerA, "Cast with no alternative cost");
attack(3, playerA, ragavanNimblePilferer);
attack(3, playerA, ragavanNimblePilferer);
setChoice(playerA, "Whenever a creature with the chosen name", 2);
setChoice(playerA, "Whenever {this} deals");
setStopAt(3, PhaseStep.END_TURN);
execute();
assertLife(playerB, 20 - 2 - 2);
assertHandCount(playerA, 1 + 1 + 1); // 1 draw + 2 triggers
assertPermanentCount(playerA, "Treasure Token", 2);
}
}