Fix IsTriggerRemembered for Tokens (#93)

Co-authored-by: TRT <>
This commit is contained in:
tool4ever
2022-04-19 15:06:08 +02:00
committed by GitHub
parent 3058b172b6
commit 9a88de1d6f
2 changed files with 40 additions and 46 deletions

View File

@@ -275,56 +275,51 @@ public class GameAction {
lastKnownInfo = CardUtil.getLKICopy(c); lastKnownInfo = CardUtil.getLKICopy(c);
} }
if (!c.isRealToken()) { copied = CardFactory.copyCard(c, false);
copied = CardFactory.copyCard(c, false);
if (zoneTo.is(ZoneType.Stack)) { if (zoneTo.is(ZoneType.Stack)) {
// when moving to stack, copy changed card information // when moving to stack, copy changed card information
copied.setChangedCardColors(c.getChangedCardColorsTable()); copied.setChangedCardColors(c.getChangedCardColorsTable());
copied.setChangedCardColorsCharacterDefining(c.getChangedCardColorsCharacterDefiningTable()); copied.setChangedCardColorsCharacterDefining(c.getChangedCardColorsCharacterDefiningTable());
copied.setChangedCardKeywords(c.getChangedCardKeywords()); copied.setChangedCardKeywords(c.getChangedCardKeywords());
copied.setChangedCardTypes(c.getChangedCardTypesTable()); copied.setChangedCardTypes(c.getChangedCardTypesTable());
copied.setChangedCardTypesCharacterDefining(c.getChangedCardTypesCharacterDefiningTable()); copied.setChangedCardTypesCharacterDefining(c.getChangedCardTypesCharacterDefiningTable());
copied.setChangedCardNames(c.getChangedCardNames()); copied.setChangedCardNames(c.getChangedCardNames());
copied.setChangedCardTraits(c.getChangedCardTraits()); copied.setChangedCardTraits(c.getChangedCardTraits());
copied.setDrawnThisTurn(c.getDrawnThisTurn()); copied.setDrawnThisTurn(c.getDrawnThisTurn());
copied.copyChangedTextFrom(c); copied.copyChangedTextFrom(c);
copied.setTimestamp(c.getTimestamp()); copied.setTimestamp(c.getTimestamp());
// clean up changes that come from its own static abilities // clean up changes that come from its own static abilities
copied.cleanupCopiedChangesFrom(c); copied.cleanupCopiedChangesFrom(c);
// copy exiled properties when adding to stack // copy exiled properties when adding to stack
// will be cleanup later in MagicStack // will be cleanup later in MagicStack
copied.setExiledWith(c.getExiledWith()); copied.setExiledWith(c.getExiledWith());
copied.setExiledBy(c.getExiledBy()); copied.setExiledBy(c.getExiledBy());
// copy bestow timestamp // copy bestow timestamp
copied.setBestowTimestamp(c.getBestowTimestamp()); copied.setBestowTimestamp(c.getBestowTimestamp());
} else { } else {
// when a card leaves the battlefield, ensure it's in its original state // when a card leaves the battlefield, ensure it's in its original state
// (we need to do this on the object before copying it, or it won't work correctly e.g. // (we need to do this on the object before copying it, or it won't work correctly e.g.
// on Transformed objects) // on Transformed objects)
copied.setState(CardStateName.Original, false); copied.setState(CardStateName.Original, false);
copied.setBackSide(false); copied.setBackSide(false);
// reset timestamp in changezone effects so they have same timestamp if ETB simultaneously // reset timestamp in changezone effects so they have same timestamp if ETB simultaneously
copied.setTimestamp(game.getNextTimestamp());
}
copied.setUnearthed(c.isUnearthed());
copied.setTapped(false);
// need to copy counters when card enters another zone than hand or library
if (lastKnownInfo.hasKeyword("Counters remain on CARDNAME as it moves to any zone other than a player's hand or library.") &&
!(zoneTo.is(ZoneType.Hand) || zoneTo.is(ZoneType.Library))) {
copied.setCounters(Maps.newHashMap(lastKnownInfo.getCounters()));
}
} else { //Token
copied = c;
copied.setTimestamp(game.getNextTimestamp()); copied.setTimestamp(game.getNextTimestamp());
} }
copied.setUnearthed(c.isUnearthed());
copied.setTapped(false);
// need to copy counters when card enters another zone than hand or library
if (lastKnownInfo.hasKeyword("Counters remain on CARDNAME as it moves to any zone other than a player's hand or library.") &&
!(zoneTo.is(ZoneType.Hand) || zoneTo.is(ZoneType.Library))) {
copied.setCounters(Maps.newHashMap(lastKnownInfo.getCounters()));
}
} }
// ensure that any leftover keyword/type changes are cleared in the state view // ensure that any leftover keyword/type changes are cleared in the state view

View File

@@ -3,8 +3,7 @@ ManaCost:6
Types:Legendary Artifact Equipment Types:Legendary Artifact Equipment
K:Equip:3 K:Equip:3
S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddPower$ 5 | AddToughness$ 5 | Description$ Equipped creature gets +5/+5. S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddPower$ 5 | AddToughness$ 5 | Description$ Equipped creature gets +5/+5.
A:AB$ Token | Cost$ 6 Exile<1/CARDNAME> | TokenAmount$ 1 | TokenScript$ u_5_5_dragon_spirit_flying | TokenOwner$ You | RememberTokens$ True | SpellDescription$ Create a 5/5 blue Dragon Spirit creature token with flying. Return CARDNAME to the battlefield under its owner's control when that token dies. A:AB$ Token | Cost$ 6 Exile<1/CARDNAME> | TokenAmount$ 1 | TokenScript$ u_5_5_dragon_spirit_flying | TokenOwner$ You | RememberTokens$ True | SubAbility$ DelTrig | SpellDescription$ Create a 5/5 blue Dragon Spirit creature token with flying. Return CARDNAME to the battlefield under its owner's control when that token dies.
T:Mode$ ChangesZone | ValidCard$ Creature.IsRemembered | Origin$ Battlefield | Destination$ Graveyard | TriggerZones$ Exile | Execute$ TrigReturn | Secondary$ True | TriggerDescription$ Return CARDNAME to the battlefield under its owner's control when that token dies. SVar:DelTrig:DB$ DelayedTrigger | Mode$ ChangesZone | ValidCard$ Card.IsTriggerRemembered | Origin$ Battlefield | Destination$ Graveyard | Execute$ TrigReturn | RememberObjects$ Remembered | TriggerDescription$ Return CARDNAME to the battlefield under its owner's control when that token dies.
SVar:TrigReturn:DB$ ChangeZone | Origin$ Exile | Destination$ Battlefield | Defined$ Self | SubAbility$ DBCleanUp SVar:TrigReturn:DB$ ChangeZone | Origin$ Exile | Destination$ Battlefield | Defined$ Self
SVar:DBCleanUp:DB$ Cleanup | ClearRemembered$ True
Oracle:Equipped creature gets +5/+5.\n{6}, Exile Tatsumasa, the Dragon's Fang: Create a 5/5 blue Dragon Spirit creature token with flying. Return Tatsumasa to the battlefield under its owner's control when that token dies.\nEquip {3} Oracle:Equipped creature gets +5/+5.\n{6}, Exile Tatsumasa, the Dragon's Fang: Create a 5/5 blue Dragon Spirit creature token with flying. Return Tatsumasa to the battlefield under its owner's control when that token dies.\nEquip {3}