Port weather, copying moves, held items and obedience (#28)
Checks / web (push) Canceled after 0s

Complete the weather, Substitute, Transform, called-move and forced-switch effects. Add held-item behavior, Exp. Share awards and badge-based traded Pokemon obedience, and persist trainer berry consumption.

Validated with 576 passing unit tests and 149 browser tests, native/reference builds, reference/vendor/release checks and 320 Metal Powder emulator comparisons per browser. Smart AI and special balls/battle types remain on #28.
This commit is contained in:
Sébastien QUEROL committed 2026-10-03 15:03:19 +02:00
1 parent 8f5b464efc
commit 32d736ecae
13 files changed
+1509 -75

No files matched your search

+60 -1
View File
@@ -1,6 +1,6 @@
# Recovered Claude session
Latest continuation: see **Field items, fishing, Select and MAIL: 2026-10-03**
Latest continuation: see **Battle effects, held items and obedience: 2026-10-03**
at the end of this file. Earlier sections are historical snapshots.
Recovered on 2026-09-23 from the local Claude Code transcript
@@ -1165,3 +1165,62 @@ Rod was checked once in Chromium and WebKit.
Next: the remaining battle commands, move effects and Smart AI handlers
(board #28).
## Battle effects, held items and obedience: 2026-10-03
Recovered the latest Claude Code session from
`~/.claude/projects/-Users-kawa-Crystal/d316d957-8ee4-4b55-aa7b-12be1bcd8726.jsonl`.
Its request was "continue the plan", taking card #28. It hit the usage limit
at 09:25 UTC while researching held items, Exp. Share and CheckObedience.
Claude had committed three groups:
- `9e0a2cd`: multi-hit and special-damage effects.
- `c53edb7`: moves spanning several turns.
- `8f5b464`: status and field move effects.
Its next group was uncommitted: weather, Substitute, Transform, Mimic,
Metronome, Mirror Move, Sleep Talk, Snore, Conversion/Conversion2, Sketch,
Baton Pass, Roar/Whirlwind and Teleport. Every move's effect script now has
a handler. Rollback fixtures use level-1 Psywave, which would loop in the
original and remains explicitly refused. These changes were preserved;
the recovered tree passed 546 unit tests before further edits. Claude's
last recorded browser run had 147 passed and 19 skipped.
The resumed increment adds:
- Smoke Ball, Metal Powder (also in the AI damage estimate), MysteryBerry,
Berserk Gene and the original unused held stat-raising effects. Item
order and stored/battle PP follow `engine/battle/core.asm`. Metal Powder
checks original species after Transform and retains byte overflow;
Berserk Gene retains the 256-turn/stale confusion-count bug.
- Exp. Share's separate participant/holder awards, halving bytes before
dividing each pool, including stat experience and existing modifiers.
- Traded Pokémon obedience, including badge thresholds, alternate moves,
nap, self-damage and idle outcomes. The world supplies its Johto badge
byte. RNG rejection loops fail closed for an invalid random source.
- Correct removal of consumed trainer healing/confusion berries from
the stored party, preventing them from returning on a switch.
- `tests/battle-held-items.test.ts` (30 local-ROM tests) and
`tests/reference-held-items.spec.ts` (320 Metal Powder cases per browser,
running the unmodified original routine). The new tests skip without
the private ROM; the emulator test also needs the pinned symbol file.
The reference harness must keep sentinels out of `$c6ff` (player screens).
The move-effect and held-item specs use audio RAM `$c0f0`, with interrupts
disabled, instead.
Validation on the final code: `npm test` passed 576 tests, with 3 skipped;
without the private ROM, 136 passed and 443 skipped. The full Chromium/WebKit
suite passed 149 tests, with 19 intentional skips, including the original
Tin Tower pillars case on this run. Native/reference builds, profile and
pinned-reference verification, vendor integrity, release isolation and
`git diff --check` passed. Metal Powder has direct emulator evidence;
the other new held-item, experience and obedience paths have local unit
coverage and source review. No CI or physical-device validation was run.
Next: complete the Smart AI effect dispatch in `src/game/battle/ai.ts`;
card #28 remains open. Other explicit boundaries include the special balls,
Unown generation, Beat Up with Eggs, and original routines that run off a
move list or loop indefinitely. Johto badge stat boosts are still absent;
the new badge option implements obedience only. Do not claim the battle
engine or the full card is complete. Delivery is tracked by the commits
referencing card #28; its commit list includes the recovered groups above.