Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Save data migrator to fix starters with no selectable forms #5425

Merged

Conversation

Wlowscha
Copy link
Contributor

What are the changes the user will see?

Players who previously could select E-Max Eternatus or other forms supposed not to be selectable from the starter screen will now see the default form, as intended.

Why am I making these changes?

After #5119, catching a battle form did not automatically unlock the default form. This caused unintended behavior in the starter select screen, where the caught battle form would show up and be selectable, most noticeable for players who caught Eternatus in its E-Max form. The bug was fixed in #5385, and applies to Pokémon caught from 1.7.0 onwards, but the issue still exists for already problematic save data. In order to fix this, a save data migration is necessary.

What are the changes from a developer perspective?

A new migrator function is added to systemMigrators. Its purpose is to scan data.dexData to find starters which are caught, but for which only unselectable forms are marked as caught. For any such starters, the default form is automatically marked as caught.

Screenshots/Videos

How to test the changes?

Checklist

  • I'm using beta as my base branch
  • There is no overlap with another PR?
  • The PR is self-contained and cannot be split into smaller PRs?
  • Have I provided a clear explanation of the changes?
  • Have I tested the changes manually?
  • Are all unit tests still passing? (npm run test)
    • Have I created new automated tests (npm run create-test) or updated existing tests related to the PR's changes?
  • Have I provided screenshots/videos of the changes (if applicable)?
    • Have I made sure that any UI change works for both UI themes (default and legacy)?

@Snailman11
Copy link
Collaborator

@Wlowscha
Copy link
Contributor Author

This was tested on a save file with three caught forms: E-Max Eternatus, Rain Castform, and W Unown. This is what the starter select screen looks like in a previous version:
right_starters

After loading up the same save with the code in this PR, it looks like this:
wrong_starters

To test other forms, generate a new savefile. This can be done by using overrides such as

const overrides = {
  STARTING_WAVE_OVERRIDE: 11,
  OPP_SPECIES_OVERRIDE: Species.ETERNATUS,
  OPP_FORM_OVERRIDES: {[Species.ETERNATUS]: 1},
  POKEBALL_OVERRIDE: {
    active: true,
    pokeballs: {
      [PokeballType.POKEBALL]: 0,
      [PokeballType.GREAT_BALL]: 0,
      [PokeballType.ULTRA_BALL]: 0,
      [PokeballType.ROGUE_BALL]: 0,
      [PokeballType.MASTER_BALL]: 99,
    },
  }
} satisfies Partial<InstanceType<typeof DefaultOverrides>>;

on a version of the code pre- #5385 . It is necessary to have a full party when catching the form, and refuse when asked to add it to the party.

@Wlowscha Wlowscha marked this pull request as ready for review February 26, 2025 21:22
@Wlowscha Wlowscha requested a review from a team as a code owner February 26, 2025 21:22
@damocleas damocleas added the P2 Bug Minor. Non crashing Incorrect move/ability/interaction label Feb 27, 2025
@damocleas damocleas enabled auto-merge (squash) February 27, 2025 21:48
@damocleas damocleas merged commit 922a170 into pagefaultgames:beta Feb 27, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Bug Minor. Non crashing Incorrect move/ability/interaction
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants