fix: don't clear designated follower when moving mon within party via PC#149
Open
aloven wants to merge 1 commit into
Open
fix: don't clear designated follower when moving mon within party via PC#149aloven wants to merge 1 commit into
aloven wants to merge 1 commit into
Conversation
Instead of trying to track the designation through complex PC operations (pickup, swap, shift, compact), save the designated mon's identity (personality + OT ID) when entering the PC, then on exit scan the party for that mon and update the slot index. If not found (deposited), clear. This handles all cases: simple moves, multi-swaps, repositioning, etc. The only way the designation clears is if the mon actually leaves the party.
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.
an edge case i noticed that we simply didn't guard against with the desigated follower commit. handled it here.
it actually works well, even if the pokemon does enter the box in the session, if its back in your party, it's still following you. lets you re-organize your party and stuff and not have the follower reset.
Description:
Fixes a bug where the designated follower would reset when repositioning the Pokemon within the party using the PC's "Move" feature, even though the mon never entered a box.
Root cause: The original implementation cleared
designatedFollowerinSetMovingMonDatawhen a party mon was picked up. Multi-swap operations,CompactPartySlots, and the complex pickup/place/shift cycle made it impossible to reliably track the slot index through intermediate states.Fix: Identity-based reconciliation on PC exit.
EnterPokeStorage): save the designated mon'spersonalityandOT IDCB2_ExitPokeStorage): scan the party for that identitydesignatedFollowerto the mon's current slotdesignatedFollower(mon was deposited to a box)This handles all cases regardless of how many swaps/moves happen during the session. Personality + OT ID is a unique identifier for any legitimately obtained Pokemon (32-bit random value + trainer ID).
Does not affect:
CompactPartySlotsremap logic (still runs for non-PC cases like party menu)