Skip to content

Give a stolen card back when a snapshot is restored - #11422

Open
cuinhellcat wants to merge 1 commit into
Card-Forge:masterfrom
cuinhellcat:snapshot-controller-fix
Open

Give a stolen card back when a snapshot is restored#11422
cuinhellcat wants to merge 1 commit into
Card-Forge:masterfrom
cuinhellcat:snapshot-controller-fix

Conversation

@cuinhellcat

Copy link
Copy Markdown

Problem

Nothing in GameSnapshot restores who controls a card. A creature that changed hands after the snapshot was taken stays with its new controller when the state is put back.

Reported from play: cast Claim the Firstborn, then roll back. The spell returns to hand, the creature stays on the thief's side.

The zone handling misses it too:

ZoneType type = newCard.getZone().getZoneType();
if (type != fromType) { ... remove ... }

A card already in the game is only taken out of its current zone when the zone type differs — and a move between two players' battlefields keeps the type. So the creature is added to the owner's battlefield while remaining in the thief's, ending up in both at once.

Fix

Restore the controller alongside the rest of the card state, and take the card out of whatever zone it currently sits in unless that is already the zone it is going into.

Reproduction

Snapshot with a creature under its owner's control, give control to the opponent with a zone correction, restore: before the change control stays with the opponent and the creature is in both battlefields; after it, the creature is back under its owner with a single copy on the board.

Notes

AI disclosure

Written with Claude Code (Claude Opus 5), as requested in CONTRIBUTING; the agent is also recorded as co-author on the commit.

Nothing in GameSnapshot restores who controls a card, so a creature that
changed hands after the snapshot was taken stays with its new controller
when the state is put back. Reported from play: casting Claim the
Firstborn and then rolling back returned the spell to hand and left the
creature on the thief's side.

The zone handling missed it as well. A card already in the game is only
taken out of its current zone when the zone type differs, and moving
between two players' battlefields keeps the type — so the creature was
added to the owner's battlefield while remaining in the thief's, ending
up in both.

Restore the controller alongside the rest of the card state, and take
the card out of whatever zone it currently sits in unless that is
already the zone it is going into.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@cuinhellcat

Copy link
Copy Markdown
Author

Closing this in favour of #10294, which already restores the controller as part of its wider pass over the snapshot state.

One piece of this PR is not in #10294, so I do not want it to get lost: a card already in the game is only removed from its current zone when the zone type differs, and a move between two players' battlefields keeps the type. A stolen creature therefore ends up in both battlefields at once, independently of who the card names as controller. If that is worth having on its own I am happy to open it as a separate one-hunk PR.

Found while playing: cast Claim the Firstborn, roll back, creature stays on the thief's side.

@tool4ever

Copy link
Copy Markdown
Contributor

seems relevant enough so we can just discuss it here, that's way easier than on some already too complex other one:

  • I think the zone part is clearly right
  • I don't know about the controller one, how does this even work if it's just from a temporary effect which was set up with a different timestamp? Wouldn't the GameCommand meant to remove the entry just fail?

@Jetz72 Jetz72 added the Experimental Restore Relating to the state-based Undo/Restore feature. label Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Experimental Restore Relating to the state-based Undo/Restore feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants