feat: keep the game master move order - #142
Merged
Merged
Conversation
Collaborator
|
Does anything even depend on the move order? IMO the sort should just be removed unconditionally. |
`Pokemon.getMoves` sorted every move list numerically by move id, which discarded the order the game master ships them in. Nothing in the generator depends on that ordering, and consumers that want to show moves the way the game lists them cannot recover the original order from the output. Drop the sort and return the move ids in game master order. Applies to quickMoves, chargedMoves, eliteQuickMoves, and eliteChargedMoves on both base pokemon and forms, plus the Smeargle move settings. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Fabio1988
force-pushed
the
feat/preserve-move-order
branch
from
August 25, 2026 19:03
6d10360 to
8e9312b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Pokemon.getMovessorts every move list numerically by move id:That discards the order the game master ships the moves in, and the original order is not recoverable from the output. Consumers that want to show moves the way the game lists them (move pickers, masterfile-driven UIs) have no way to get it back.
The difference is not marginal — across the 2468
pokemonSettingsentries in the current GAME_MASTER, sorting changes the order of:e.g. Charizard's charged moves are
FIRE_BLAST, DRAGON_CLAW, OVERHEAT, AIR_CUTTERin the game master and came out asDRAGON_CLAW, FIRE_BLAST, AIR_CUTTER, OVERHEAT.Change
Drop the sort. Move lists now come out in game master order.
I originally wrote this as an opt-in
preserveMoveOrderoption, but there is no case where the numeric order is the more useful one — it is not the game's order and it is not stable in any meaningful sense, it is just move id ascending. A config flag for it only adds surface area, so this removes the sort outright.Covers everything that flows through
getMoves:quickMoves,chargedMoves,eliteQuickMoves,eliteChargedMoves, on both base pokemon and forms, plus the Smeargle move settings.Scope / notes
getTypesis left alone — this is only about moves.PokeApi.mergeMoveListsstill sorts. Those moves are estimated from PokeAPI, not the game master, so their incoming order carries no in-game meaning and ascending id is as good as anything.resolveEnumIds(form change move reassignment / requirements) still sorts. Those are matched as sets rather than displayed as ordered lists.Masterfile.compareis order sensitive, which works in our favour here: a form whose game master order differs from its parent now keeps its own list instead of inheriting.Tests
New
tests/moveOrder.test.jsasserts game master order for quick, charged, and elite moves using Charizard's real game master lists, plus order preservation for lists that are already numeric ids. Full suite passes: 12 suites, 91 tests.Also verified end to end with
yarn generateagainst the live game master: