Skip to content

Ask to propagate OT info to all Pokémon when trainer identity changes#248

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/change-trainer-info
Draft

Ask to propagate OT info to all Pokémon when trainer identity changes#248
Copilot wants to merge 5 commits intomainfrom
copilot/change-trainer-info

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

Changing trainer Name/TID/SID on the Home page silently updated only the save file header — every existing Pokémon retained its old Original Trainer data. This adds a confirmation modal so the user can choose whether to bulk-apply the new identity to all Pokémon.

PKHeX.Facade — Trainer.cs

  • PokemonInPartyCount / PokemonInBoxCount — non-empty slot counts used in the modal message
  • ApplyOwnerToAll() — sets Owner.Name/TID/SID on every non-empty party + box Pokémon to the current trainer values, then calls Commit()

PKHeX.Web — Home.razor

  • HandleNameChanged / HandleTIDChanged / HandleSIDChanged now defer the write: they store the mutation in _pendingTrainerChange and open the modal instead of applying immediately
  • "Yes, update all" — invokes the pending change then calls ApplyOwnerToAll()
  • "No, just update trainer" — invokes the pending change only; Pokémon OT data untouched
You have 6 Pokémon in your party and 42 in your box.
Would you like to update their Original Trainer info to match the new trainer values?

[ Yes, update all ]   [ No, just update trainer ]

PKHeX.Facade.Tests — TrainerTests.cs

  • ApplyOwnerToAll_ShouldUpdateAllPokemon — sets trainer identity, calls ApplyOwnerToAll, save/reloads, and asserts every non-empty Pokémon carries the new Name, TID, and SID (p.Id.TID/SID rather than p.Owner.TID/SID because Owner.TID getter uses TrainerTID7, which is a Gen 7-style derived value and not symmetric with the DisplayTID setter for Gen 4 saves)

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.

2 participants