Skip to content

fix: don't clear designated follower when moving mon within party via PC#149

Open
aloven wants to merge 1 commit into
resetes12:masterfrom
aloven:fix/follower-guard
Open

fix: don't clear designated follower when moving mon within party via PC#149
aloven wants to merge 1 commit into
resetes12:masterfrom
aloven:fix/follower-guard

Conversation

@aloven

@aloven aloven commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

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 designatedFollower in SetMovingMonData when 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.

  • On PC entry (EnterPokeStorage): save the designated mon's personality and OT ID
  • On PC exit (CB2_ExitPokeStorage): scan the party for that identity
    • Found → update designatedFollower to the mon's current slot
    • Not found → clear designatedFollower (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:

  • Normal deposit/release/trade clearing (still works via existing guards)
  • Battle Frontier designation behavior (separate code path)
  • CompactPartySlots remap logic (still runs for non-PC cases like party menu)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant