Fix card LKI existing in both lastStates at once (#4400)

* Fix card LKI existing in both lastStates at once
This commit is contained in:
tool4ever
2023-12-20 16:21:43 +01:00
committed by GitHub
parent c63287ff4b
commit 151527a646
4 changed files with 14 additions and 16 deletions

View File

@@ -211,7 +211,8 @@ public class Game {
: null;
if (lookup != null) {
lookup.remove(c);
lastStateBattlefield.remove(c);
lastStateGraveyard.remove(c);
lookup.add(CardUtil.getLKICopy(c));
}
}
@@ -851,7 +852,7 @@ public class Game {
SpellAbilityStackInstance si = getStack().getInstanceMatchingSpellAbilityID(c.getCastSA());
si.setActivatingPlayer(c.getController());
}
if ((c.getController().equals(p)) && !(c.isPlane() || c.isPhenomenon())) {
if (c.getController().equals(p) && !(c.isPlane() || c.isPhenomenon())) {
getAction().exile(c, null, null);
triggerList.put(ZoneType.Battlefield, c.getZone().getZoneType(), c);
}
@@ -868,7 +869,7 @@ public class Game {
// planar controller leaves
if (planarControllerLost) {
for (Card c : getActivePlanes()) {
if ((c != null) && !(c.getOwner().equals(p))) {
if (c != null && !c.getOwner().equals(p)) {
c.setController(getNextPlayerAfter(p), 0);
getAction().controllerChangeZoneCorrection(c);
}
@@ -885,14 +886,14 @@ public class Game {
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
CardCollection planesLeavingGame = new CardCollection();
for (Card c : getActivePlanes()) {
if ((c != null) && (c.getOwner().equals(p))) {
if (c != null && c.getOwner().equals(p)) {
planesLeavingGame.add(c);
planarController.removeCurrentPlane(c);
}
}
runParams.put(AbilityKey.Cards, planesLeavingGame);
getTriggerHandler().runTrigger(TriggerType.PlaneswalkedFrom, runParams, false);
planarController.planeswalkTo(null, new CardCollection(planarController.getZone(ZoneType.PlanarDeck).get(0)));
planarController.planeswalk(null);
}
if (p.isMonarch()) {

View File

@@ -3,7 +3,7 @@ ManaCost:3 B
Types:Creature Faerie Warlock
PT:2/2
K:Flying
T:Mode$ SpellCast | ValidCard$ Creature | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | OpponentTurn$ True | Execute$ TrigPump | TriggerDescription$ Whenever you cast a spell during an opponent's turn, up to one target creature an opponent controls gets -1/-1 until end of turn.
T:Mode$ SpellCast | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | OpponentTurn$ True | Execute$ TrigPump | TriggerDescription$ Whenever you cast a spell during an opponent's turn, up to one target creature an opponent controls gets -1/-1 until end of turn.
SVar:TrigPump:DB$ Pump | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Select up to one target creature an opponent controls | NumAtt$ -1 | NumDef$ -1 | IsCurse$ True | TargetMin$ 0 | TargetMax$ 1
DeckHints:Type$Instant
SVar:BuffedBy:Creature.withFlash

View File

@@ -1,7 +1,7 @@
Name:Guff Rewrites History
ManaCost:2 R
Types:Instant
A:SP$ ChangeZone | ValidTgts$ Permanent.nonLand+nonEnchantment | RememberChanged$ True | TgtPrompt$ For each player, choose target nonenchantment, nonland permanent that player controls. | Origin$ Battlefield | Destination$ Library | Shuffle$ True | TargetMin$ OneEach | TargetMax$ OneEach | TargetsWithDifferentControllers$ True | SubAbility$ DBRepeat | SpellDescription$ For each player, choose target nonenchantment, nonland permanent that player controls. Those permanents' owners shuffle them into their libraries. Each player who controlled one of those permanents exiles cards from the top of their library until they exile a nonland card, then puts the rest on the bottom of their library in a random order. Each player may cast the nonland card they exiled without paying its mana cost.
A:SP$ ChangeZone | ValidTgts$ Permanent.nonLand+nonEnchantment | RememberLKI$ True | TgtPrompt$ For each player, choose target nonenchantment, nonland permanent that player controls. | Origin$ Battlefield | Destination$ Library | Shuffle$ True | TargetMin$ OneEach | TargetMax$ OneEach | TargetsWithDifferentControllers$ True | SubAbility$ DBRepeat | SpellDescription$ For each player, choose target nonenchantment, nonland permanent that player controls. Those permanents' owners shuffle them into their libraries. Each player who controlled one of those permanents exiles cards from the top of their library until they exile a nonland card, then puts the rest on the bottom of their library in a random order. Each player may cast the nonland card they exiled without paying its mana cost.
SVar:DBRepeat:DB$ RepeatEach | RepeatPlayers$ RememberedController | ClearRememberedBeforeLoop$ True | RepeatSubAbility$ DBDigUntil | SubAbility$ DBRepeatCard
SVar:DBDigUntil:DB$ DigUntil | Defined$ RememberedController | Valid$ Permanent.nonLand | FoundDestination$ Exile | RevealedDestination$ Exile | ImprintFound$ True | RememberRevealed$ True | SubAbility$ DBChange
SVar:DBChange:DB$ ChangeZoneAll | ChangeType$ Card.IsRemembered+IsNotImprinted | Origin$ Exile | Destination$ Library | RandomOrder$ True | LibraryPosition$ -1 | SubAbility$ DBCleanup

View File

@@ -1,18 +1,15 @@
Name:River Song's Diary
ManaCost:3
Types:Artifact
T:Mode$ SpellCast | ValidCard$ Instant,Sorcery | Execute$ TrigEffect | TriggerZones$ Battlefield | TriggerDescription$ Imprint — Whenever a player casts an instant or sorcery spell from their hand, exile it instead of putting it into a graveyard as it resolves.
SVar:TrigEffect:DB$ Effect | ReplacementEffects$ ReMoved | RememberObjects$ TriggeredCard | SubAbility$ DBImprint
SVar:DBImprint:DB$ Pump | ImprintCards$ TriggeredCard
T:Mode$ SpellCast | ValidCard$ Instant.wasCastFromTheirHand,Sorcery.wasCastFromTheirHand | Execute$ TrigEffect | TriggerZones$ Battlefield | TriggerDescription$ Imprint — Whenever a player casts an instant or sorcery spell from their hand, exile it instead of putting it into a graveyard as it resolves.
SVar:TrigEffect:DB$ Effect | ReplacementEffects$ ReMoved | RememberObjects$ TriggeredCard
SVar:ReMoved:Event$ Moved | ValidCard$ Card.IsRemembered | Origin$ Stack | Destination$ Graveyard | Fizzle$ False | ReplaceWith$ DBExile | Description$ Exile it instead of putting it into a graveyard as it resolves.
SVar:DBExile:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Stack | Destination$ Exile | SubAbility$ DBExileSelf
SVar:DBExile:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Stack | Destination$ Exile | SubAbility$ DBExileSelf
SVar:DBExileSelf:DB$ ChangeZone | Origin$ Command | Destination$ Exile | Defined$ Self
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | CheckSVar$ X | SVarCompare$ GE4 | Execute$ TrigChooseRandom | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your upkeep, if there are four or more cards exiled with CARDNAME, choose one of them at random. You may cast it without paying its mana cost.
SVar:TrigChooseRandom:DB$ ChooseCard | ChoiceZone$ Exile | AtRandom$ True | Choices$ Card.IsImprinted | SubAbility$ DBPlay
SVar:DBPlay:DB$ Play | Defined$ ChosenCard | ValidSA$ Spell | WithoutManaCost$ True | SubAbility$ DBCleanup
SVar:TrigChooseRandom:DB$ ChooseCard | ChoiceZone$ Exile | AtRandom$ True | Choices$ Card.ExiledWithSource | SubAbility$ DBPlay
SVar:DBPlay:DB$ Play | Defined$ ChosenCard | ValidSA$ Spell | WithoutManaCost$ True | Optional$ True | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearChosenCard$ True
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Battlefield | Destination$ Any | Execute$ DBCleanupStatic | Static$ True
SVar:DBCleanupStatic:DB$ Cleanup | ClearImprinted$ True
SVar:X:Imprinted$Amount
SVar:X:ExiledWith$Amount
DeckHints:Type$Instant|Sorcery
Oracle:Imprint — Whenever a player casts an instant or sorcery spell from their hand, exile it instead of putting it into a graveyard as it resolves.\nAt the beginning of your upkeep, if there are four or more cards exiled with River Song's Diary, choose one of them at random. You may cast it without paying its mana cost.