Port the moves that span several turns

A recharging, charged, rampaging or rolling Pokémon plays on without the
battle menu on either side, and a biding one uses FIGHT without the move
list. Razor Wind, Solarbeam, Skull Bash, Sky Attack, Fly and Dig charge
first; flying and digging Pokémon can only be hit by the original's
exceptions. Hyper Beam recharges, Thrash and its kind end in confusion,
Rollout and Fury Cutter double up, and Bide returns twice the damage it
took.

The trapping moves hurt their target between turns until it is released,
Mind Reader and Lock-On make the next move hit, and Pursuit strikes a
Pokémon being withdrawn first, on either side.

The new commands are compared with the original in the reference
emulator. Its fixture no longer zeroes wPlayerScreens with its sentinel.

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 10:57:46 +02:00
1 parent 9e0a2cd2a8
commit c53edb77e5
7 files changed
+713 -39

No files matched your search

+10
View File
@@ -264,6 +264,16 @@ The numbered sections below keep their full scope. Each one opens with a checkli
- A Focus Band now hangs on at 1 HP even when the hit would only take that 1 HP, and cancels a one-hit KO's text.
- `tests/reference-move-effects.spec.ts` runs the original `ConstantDamage`, `OHKO`, `Counter`, `MirrorCoat`, `EndLoop`, `TripleKick`, `HiddenPower` with `DamageCalc`, and `FalseSwipe` in the reference emulator on the same state as the native commands, with the Link RNG; damage, flags, move structs, loop counters, the script position and the random stream must agree. Deliberate mutations of six rules each made a comparison fail.
## Implemented: moves that span turns
- A locked-in Pokémon (recharging, charged, rampaging or rolling) plays on without the battle menu and keeps last turn's move and move struct, on both sides (`ParsePlayerAction`'s `.locked_in`, `ParseEnemyAction`'s `ResetVarsForSubstatusRage`). While biding, FIGHT goes on without the move list.
- Razor Wind, Solarbeam (no charging turn in the sun), Skull Bash (its Defense raise on the charging turn), Sky Attack, Fly and Dig charge with the original texts. Flying Pokémon can only be hit by Gust, Whirlwind, Thunder and Twister, digging ones by Earthquake, Fissure and Magnitude (Earthquake and Magnitude hit twice as hard). Hyper Beam recharges.
- Thrash, Petal Dance and Outrage go on for 1-2 more turns and then confuse the user for 2-3 turns, unless its side has Safeguard. Rollout doubles for each hit, once more after Defense Curl, for up to five; Fury Cutter doubles per consecutive hit up to 16 times. Bide stores the damage taken from its second turn on and unleashes twice that.
- Bind, Wrap, Fire Spin, Clamp and Whirlpool trap for 2-5 more turns; `HandleWrap` takes 1/16 of the maximum HP each turn between Future Sight/weather and Perish Song, until "was released". A substitute shields the trapped Pokémon and pauses the count.
- Mind Reader and Lock-On mark the target: the next move hits unless the target flies from an Earthquake, Fissure or Magnitude (`CheckHit`'s `.LockOn`, which lets a locked-on move hit a digging target).
- 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.
## 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.