Finish the opening milestone's switching, items and acceptance run

- Decode evolution lists from the ROM; all 251 match the pinned PRET source.
- Compare CalcMonStats and CalcExpAtLevel against the original routines in
  the reference emulator.
- Add a continuous opening playthrough from the intro to the catching
  tutorial, reloading a JSON save after every stage.
- Port player switching in battle: the PKMN menu, forced choices after a
  faint, Shift mode's offer and double faints, with the original texts.
- Port HP and status healing items in battle through the ROM's ItemEffects,
  HealingHPAmounts and StatusHealingActions tables.
- Add the battle party menu and the Items pocket to the UI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sébastien QUEROLandClaude Opus 5.5 committed 2026-09-30 11:04:11 +02:00
1 parent eb03a20d8f
commit f8e0f9c65a
20 files changed
+1902 -96

No files matched your search

+54 -1
View File
@@ -1,6 +1,6 @@
# Recovered Claude session
Latest continuation: see **The introduction's naming and clock: 2026-09-25** at the end of
Latest continuation: see **Remaining opening-milestone items: 2026-09-30** at the end of
this file. Earlier sections are historical snapshots.
Recovered on 2026-09-23 from the local Claude Code transcript
@@ -512,3 +512,56 @@ pushed to `main` as `b13fd20`.
Next (PLAN section 2): player switching and non-ball items in battle; MOVE
PKMN W/O MAIL and the stats screen with the party menu; a continuous opening
playthrough.
## Remaining opening-milestone items: 2026-09-30
The introduction was committed and pushed as `b13fd20` (handoff note
`eb03a20`). Asked to go over what was left and do the quickest items
first, this session took PLAN section 2's open items in that order:
1. Evolution decoder: `PokemonData.evolutions` returns typed level, item,
trade, happiness and stat records (Tyrogue's are four bytes). A
local-ROM test compares all 251 lists with the pinned
`evos_attacks.asm`. Evolving is not ported.
2. Reference vectors: `tests/reference-parity.spec.ts` now also calls the
original `CalcMonStats` (300 cases, including levels above 100 for the
999 cap; the trampoline sets BC, DE and HL) and `CalcExpAtLevel` (all
600 growth/level pairs). A mutation (removing the cap) was confirmed to
fail. Symbol loading and the ROM hand-off are shared helpers now. The
checklist item stays open for random-driven routines (accuracy,
criticals, damage variation, capture).
3. Continuous playthrough: `tests/playthrough.test.ts` plays a new game
from the intro to the catching tutorial through `GameWorld` inputs with
a seeded RNG, reloading a JSON save after every stage. Wild battles are
fought, or fled below half HP (fighting everything whited out on Route
29). The rival battle is lost with this seed (`CANLOSE`), and the story
continues. The stages share one world, so run the whole file.
4. Switching and healing items in battle (details in NATIVE_PORT):
- PKMN/`TryPlayerSwitch`/`PlayerSwitch`/`BattleMonEntrance` with
`SendOutMonText`/`WithdrawMonText`; `AskUseNextPokemon`,
`ForcePlayerMonChoice`, `DoubleSwitch`; Shift mode's
`OfferSwitch`. New `party` prompt (`menu`, `cancel`) answered through
`battleChoose` (a slot or -1), and `{ action: "pkmn" }`.
- Items pocket: `CheckItemContext`, `ItemEffects` dispatch by ROM
address, `RestoreHPEffect` and `StatusHealingEffect` with the ROM's
tables and party menu texts. `PARTYMENUTEXT_*` values are PRET's
($F0-based; `check:reference` caught a wrong value).
- UI: PKMN party list with the SWITCH/STATS/CANCEL submenu (STATS
disabled), and ITEM/BALL POCKET tabs in PACK (opens on Items). The
keyboard test now passes through the enabled PKMN button.
Known limits: `hBattleTurn` at the battle menu is not modelled everywhere,
so a status heal that would make `CalcPlayerStats` reapply a penalty to a
paralysed or burned enemy is refused. `WithdrawMonText` treats the
multiplicand's leftover high byte as zero. X items, Poké Doll, Full
Restore, revives and the stats screen are not ported.
Checks: 324 unit tests with the local ROM (130 passed, 194 skipped
without it); 93 Chromium/WebKit browser tests passed, 19 skipped
intentionally; native and reference builds; reference, release and
vendor checks; `git diff --check`. Not committed.
Next (PLAN section 2): controlled-seed comparisons of random-driven
battle routines. Then PLAN section 3/4 items: the party and bag menus
outside battle (with the stats screen and MOVE PKMN W/O MAIL), evolution
itself, and the remaining battle items.