Keep melded permanents intact across a snapshot - #11421
Open
cuinhellcat wants to merge 1 commit into
Open
Conversation
A melded permanent is two cards: the front half on the battlefield in its Meld state, and the back half held in PlayerZoneBattlefield's melded collection rather than in its card list. forEachCardInGame walks that collection, so both halves reach copyGameState — which then puts each of them in the card list, because it only ever looks at the zone type. Restoring therefore broke a meld in both directions. A snapshot taken while melded came back as two separate permanents, the back half loose on the battlefield. A snapshot taken before the meld left the back half in the melded collection, so it was both melded and on the battlefield, with the front half still pointing at it. Place a card that the snapshot holds as melded back into the melded collection, take it out of there when the snapshot does not, and carry meldedWith and the back-side flag along. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
tool4ever
approved these changes
Jul 27, 2026
cuinhellcat
pushed a commit
to cuinhellcat/forge
that referenced
this pull request
Jul 27, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to a review question on #11416 ("Does this break things like meld?"). It does not — but checking turned up that snapshots break meld already, in both directions, on master and independently of that PR.
Problem
A melded permanent is two cards. The front half sits on the battlefield in its
Meldstate; the back half is held inPlayerZoneBattlefield.meldedCards, not in the zone's card list.forEachCardInGamewalks that collection, so both halves reachcopyGameState— which places every card by zone type alone and drops both into the card list.That breaks a meld whichever way the restore goes:
meldedCards, so it is both melded and on the battlefield, with the front half still pointing at it throughmeldedWith.Fix
Put a card the snapshot holds as melded back into the melded collection, take it out of there when the snapshot does not hold it that way, and carry
meldedWithand the back-side flag across with the rest of the card state.Reproduction
Bruna, the Fading Light and Gisela, the Broken Blade, melded the way
MeldEffectdoes:getMeldedCards()and the front half keeps itsmeldedWith; after it, both halves are loose again and the link is cleared.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.