Skip to content

refactor: Rewrite Pokemon generation - #1396

Merged
innerthunder merged 5 commits into
betafrom
refactor/pokemon-generation
Dec 9, 2025
Merged

refactor: Rewrite Pokemon generation#1396
innerthunder merged 5 commits into
betafrom
refactor/pokemon-generation

Conversation

@innerthunder

Copy link
Copy Markdown
Contributor

What are the changes the user will see?

N/A

Why am I making these changes?

The constructors for Pokemon and its subclasses are a mess. This is also a prerequisite for #1394.

What are the changes from a developer perspective?

  • The Pokemon constructor's optional parameters have been consolidated into a PokemonOptions interface. It also accepts a Pokemon in place of the options interface to create shallow copies of Pokemon. Subclasses PlayerPokemon and EnemyPokemon have also been given similar treatment.
  • Enemy overrides for shiny variant, IVs, nature, etc. are now all applied in the EnemyPokemon constructor.
  • PokemonData now implements PokemonOptions, meaning it can also be directly plugged into Pokemon constructors.
  • With the above changes, the dataSource constructor parameter has been made obsolete, hence it not being included in PokemonOptions.

Screenshots/Videos

How to test the changes?

Affected overrides may require playtesting. Unit tests are TBD

Checklist

  • ⚠️ If this is a PR for main (such as a hotfix), has the game version been updated (pnpm update-version:patch / pnpm update-version:minor?
  • Otherwise: 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 (dark and light)?

@innerthunder innerthunder self-assigned this Dec 5, 2025
@innerthunder innerthunder added Refactor For refactoring code Blocker This item blocks other Item/s and should be prioritized labels Dec 5, 2025
Comment thread src/field/pokemon.ts Outdated
Comment thread src/field/pokemon.ts
Comment thread src/utils/pokemon-utils.ts Outdated
@innerthunder
innerthunder force-pushed the refactor/pokemon-generation branch from f5270b2 to f675010 Compare December 8, 2025 23:16
@innerthunder
innerthunder marked this pull request as ready for review December 9, 2025 05:23
@innerthunder
innerthunder force-pushed the refactor/pokemon-generation branch from 427649f to db81db1 Compare December 9, 2025 05:41
DayKev
DayKev previously approved these changes Dec 9, 2025
Comment thread src/field/pokemon.ts Outdated
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
@innerthunder
innerthunder merged commit 5ada447 into beta Dec 9, 2025
9 checks passed
@innerthunder
innerthunder deleted the refactor/pokemon-generation branch December 9, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blocker This item blocks other Item/s and should be prioritized Refactor For refactoring code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants