Skip to content

feat: keep the game master move order - #142

Merged
Fabio1988 merged 2 commits into
mainfrom
feat/preserve-move-order
Aug 25, 2026
Merged

feat: keep the game master move order#142
Fabio1988 merged 2 commits into
mainfrom
feat/preserve-move-order

Conversation

@Fabio1988

@Fabio1988 Fabio1988 commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Problem

Pokemon.getMoves sorts every move list numerically by move id:

.filter(Boolean)
.sort((a, b) => a - b)

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 pokemonSettings entries in the current GAME_MASTER, sorting changes the order of:

  • 1128 quick move lists
  • 1894 charged move lists

e.g. Charizard's charged moves are FIRE_BLAST, DRAGON_CLAW, OVERHEAT, AIR_CUTTER in the game master and came out as DRAGON_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 preserveMoveOrder option, 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

  • Output ordering changes for every consumer. Nothing in the generator reads move lists positionally, but downstream diffs of generated masterfiles will show churn on first regeneration. Flagging in case you'd rather cut this as a major.
  • getTypes is left alone — this is only about moves.
  • PokeApi.mergeMoveLists still 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.compare is 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.js asserts 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 generate against the live game master:

charizard quick:   ["Fire Spin","Air Slash"]
charizard charged: ["Fire Blast","Dragon Claw","Overheat","Air Cutter"]

@Mygod

Mygod commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Does anything even depend on the move order? IMO the sort should just be removed unconditionally.

Fabio1988 and others added 2 commits August 25, 2026 21:02
`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
Fabio1988 force-pushed the feat/preserve-move-order branch from 6d10360 to 8e9312b Compare August 25, 2026 19:03
@Fabio1988 Fabio1988 changed the title feat: add preserveMoveOrder option feat: keep the game master move order Aug 25, 2026
@Fabio1988
Fabio1988 merged commit 3e4a5e6 into main Aug 25, 2026
1 check passed
@Fabio1988
Fabio1988 deleted the feat/preserve-move-order branch August 25, 2026 19:05
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