Repository navigation
fix(sockets): play four discard reveal on caster instead of victim (#1440) - #1442
Merged
itsalaidbacklife merged 3 commits intoOct 18, 2026
Merged
itsalaidbacklife merged 3 commits into
itsalaidbacklife merged 3 commits into
Conversation
…uttle-cards#1440) The server-side create-socket-events helper flips playedBy to the caster on MoveType.RESOLVE events. In inGameEvents, the case 4 check previously checked evData.playedBy !== gameStore.myPNum, causing processFours to run on the victim's client (splicing the discarded cards into the opponent's hand on their screen) while the caster skipped the reveal entirely. Invert the check so processFours runs when playedBy === gameStore.myPNum (the caster) to display the discarded cards from the opponent's hand, while the victim updates the game state directly.
itsalaidbacklife
previously approved these changes
Oct 18, 2026
itsalaidbacklife
left a comment
Contributor
There was a problem hiding this comment.
Nice fix; thank you! There's one extraneous line of setup code in the tests. I'll commit the change myself so I can wrap this up without an additional review cycle
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.
Issue number
Please check the following
Please describe additional details for testing this change
Root Cause & Fix
On MoveType.RESOLVE socket events, api/helpers/game-states/create-socket-events.js flips playedBy to the caster. In src/plugins/sockets/inGameEvents.js, the check for rank 4 was checking evData.playedBy !== gameStore.myPNum, which caused processFours to execute on the victim client (splicing discarded cards into opponent hand on their screen) while the caster bypassed the animation.
Inverted the check so processFours runs when evData.playedBy === gameStore.myPNum (the caster) to reveal discarded cards from the opponent hand, while the victim directly runs gameStore.updateGame(evData.game).
Test Coverage
Added unit tests in tests/unit/specs/in-game-events.spec.js asserting that:
All unit tests and linting pass cleanly.