Skip to content

Conversation

@Bertie690
Copy link
Contributor

@Bertie690 Bertie690 commented Sep 30, 2025

Original poketernity PR

Locales PR
(Removes an unused locale key, low priority)

What are the changes the user will see?

  • On the prompt to switch Pokemon at the start of a battle, if the Player selects "Yes", then cancels out of the Party menu without selecting a Pokemon, the game will now return to the switch prompt.
  • Some minor improvements to animation timing

Why am I making these changes?

Inner's stuff (which I wholeheartedly agree with)

The current phase hierarchy for recalling, switching, and summoning Pokemon (namely ReturnPhase, SwitchPhase, SwitchSummonPhase, and SummonPhase) is extremely convoluted. Logic and data manipulation is woven in between animations composed of hanging Promises and other unmarked async calls.

This PR aims to improve the readability and stability of the switch sequence by

  • Separating logical and visual elements and reducing duplicate code with helper methods
  • Centralizing the logical elements of the switch sequence within a single phase
  • Promisifying all animations for the switch sequence so that they may more explicitly be run in sequence or in parallel.

My stuff

I really, REALLY HATE our method of queueing start of battle switches.
I\ reworked it

What are the changes from a developer perspective?

Original PR:

  • Removed SwitchSummonPhase and ReturnPhase
  • Added RecallPhase, which plays animations for recalling a Pokemon and removes the Pokemon from the field and is essentially a replacement for ReturnPhase
  • Rewrote SwitchPhase to handle all logical aspects of switching, including:
    • Resolving the index of the Pokemon to switch in
    • Applying all changes to game data as a result of the switch, including pre-switch Ability triggers and data transfers from Baton Pass and Shed Tail.
  • Rewrote SummonPhase to only contain visual effects related to summoning a Pokemon (WIP)
  • In BattleScene: Added a helper method to prompt the Player to select a Pokemon from their party. This is currently only used in SwitchPhase, but may be applied to other instances where the Party UI is required.
    The end result: Instead of the SummonPhase > SwitchSummonPhase > ReturnPhase hierarchy, each phase in the RecallPhase > SwitchPhase > SummonPhase sequence is independent and can be scheduled independently. In theory, every sequence where Pokemon are recalled, switched, and/or summoned can be implemented by a combination of one or more of the new phases.

Additional changes needed to port over:
Copied over the Animations class from PKTY used to handle showing various animations

Added helper methods to PokemonPhase (of dubious quality, but w/e)

Screenshots/Videos

TODO

How to test the changes?

The changes in this PR are mainly visual and therefore require manual playtesting.

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? (pnpm test:silent)
    • Have I created new automated tests (pnpm test:create) 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)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Rewriting existing code related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants