Port the status and field move effects

Toxic, Leech Seed, Nightmare and Curse hurt in ResidualDamage's order.
Protect, Detect, Endure, Destiny Bond, Spite, Heal Bell, Disable, Encore,
Attract, Mist, Focus Energy, Haze, the healing moves and Rest, Mean Look,
Pain Split, Belly Drum, Psych Up, Safeguard, Perish Song, Spikes, Rapid
Spin, AncientPower and Future Sight now run, with Future Sight, Perish
Song, Safeguard and Encore handled between turns and Spikes on entry.

A trainer's party struct now follows its Pokémon where the original
updates it, and the enemy's moves spend PP there or in the wild
Pokémon's kept PP, so a caught Pokémon keeps the PP it used.

Part of #28

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sébastien QUEROLandClaude Opus 5.5 committed 2026-10-03 11:11:19 +02:00
1 parent c53edb77e5
commit 8f5b464efc
6 files changed
+1036 -52

No files matched your search

+8
View File
@@ -274,6 +274,14 @@ The numbered sections below keep their full scope. Each one opens with a checkli
- Pursuit doubles against a Pokémon being withdrawn, and `PursuitSwitch` runs it before the player's or the trainer's switch; the Pursuer then cannot move. A withdrawn Pokémon fainting this way keeps its status and gets no faint handling (a kept bug).
- The reference comparisons also cover `RolloutPower`, `FuryCutter`, `CheckRampage`, `Rampage`, `CheckRollout`, `CheckCharge`, `Pursuit` and `CheckHit` with Fly, Dig and Lock-On; six deliberate mutations each failed. The fixture's sentinel moved off `wPlayerScreens` (`$c6ff`), which it had been zeroing.
## Implemented: status and field moves
- Toxic (one more sixteenth each turn), Leech Seed (the seeder regains what is drained; not on Grass types), Nightmare and Curse (a Ghost type halves its HP to curse; others trade Speed for Attack and Defense, or say "ABILITY won't rise anymore!" at the top) hurt in `ResidualDamage`'s order.
- Protect, Detect and Endure (`ProtectChance`: only for the side moving first, halving per use in a row), Destiny Bond, Spite (the PP goes in the party struct, or the wild Pokémon's kept PP), Heal Bell (all six party slots), Disable, Encore (the target switches to its last move at once if it has not moved; FIGHT keeps an encored player's move), Attract with the 50% immobility, Mist, Focus Energy, Haze, Recover, Softboiled, Milk Drink and Rest, Mean Look and Spider Web, Pain Split (the party structs keep their HP until the next update), Belly Drum (two stages stay when it fails, a kept bug), Psych Up, Safeguard, Perish Song, Spikes, Rapid Spin, AncientPower and Future Sight.
- `HandleBetweenTurnEffects` runs Future Sight, trapping and Perish Song with the faint checks between them, then Safeguard, and ends with `HandleEncore`. Spikes hurt Pokémon sent out after a faint or by the player's switch; the trainer AI's own switch skips them in single play, as in the original. A trainer's last Perish count makes the AI switch at the highest chance.
- The trainer's party struct now follows its Pokémon where the original updates it (`UpdateEnemyMonInParty`: status changes, heals, waking up), and moves used by the enemy spend PP in its party struct or in `wWildMonPP`, so a caught Pokémon keeps the PP it used and a trainer's Pokémon sent back in keeps its spent PP.
- A move missing from its user's move list (after Metronome, for instance) is refused by Spite, Disable and Encore, which search on past the list in the original.
## Native battles: current state
The battle core, ROM tables, encounter hooks, battle UI and whiteout hooks are present. Unit tests cover wins, escape, loss, experience, move learning and capture; reference tests compare damage, type effectiveness, stat calculation and experience curves. Browser tests drive a test-only wild encounter through the real UI: victory with level-up and move learning, escape, whiteout, catching with a nickname, keyboard and on-screen D-pad menu navigation, mid-battle backup restore, rollback of unsupported effects, switching through the party menu and a Potion from the Items pocket. Real Route 29 encounters now use the ROM's encounter tables. Only the special Kurt and Park balls remain unported among battle items.