Port Headbutt and Rock Smash encounters
Facing a Headbutt tree asks to HEADBUTT it, and HEADBUTT from the party menu skips the question. ShakeHeadbuttTree shakes the tree as a sprite over grass, then TreeMonEncounter scores the facing tile against the trainer ID and draws from the map's common or rare tree table. A Pokémon that falls fights as BATTLETYPE_TREE: "fell out of the tree!", and the time of day's AsleepTreeMons species start asleep. Smashable rocks run SmashRockScript, and ROCK SMASH from the party menu acts on the facing rock; after the rock breaks, RockMonEncounter gives the map's rock set a 40% chance of a wild battle. Closes #26 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ee55d344af
commit
f259163da9
18 files changed
+789
-36
No files matched your search
+10
-2
@@ -185,7 +185,7 @@ The numbered sections below keep their full scope. Each one opens with a checkli
|
||||
- Field moves in the Pokémon submenu run their menu functions: the world checks the badge (`CheckBadge`: "Sorry! A new BADGE is required."), the facing tile, water or object, then the menu closes and the ROM's `…FromMenu` script runs for the chosen Pokémon (no "Want to …?" question): Cut (`CheckMapForSomethingToCut`), Surf (including "already surfing" and forced cycling), Strength, Flash (a `PALETTE_DARK` map or the Aerodactyl chamber; `BlindingFlash` sets the Flash flag), Whirlpool and Waterfall. Failures print the ROM's messages and return to the party menu.
|
||||
- Sweet Scent runs `SweetScentFromMenu`: where wild Pokémon can appear and the map has a rate, `ChooseWildEncounter` picks one without the rate roll and a battle starts; elsewhere "Looks like there's nothing here…".
|
||||
- Softboiled and Milk Drink give a fifth of the user's maximum HP to another Pokémon that has not fainted and is not at full HP; the user needs more than that fifth.
|
||||
- Headbutt (facing a tree) and Rock Smash (facing a rock) run their checks and messages, then give a notice: tree and rock encounters are not ported. Fly, Dig and Teleport run since the section below.
|
||||
- Headbutt (facing a tree) and Rock Smash (facing a rock) run their checks and messages; their encounters run since a later section, as do Fly, Dig and Teleport.
|
||||
- SEL registers an item that `CANT_SELECT` allows (in practice key items) in `wWhichRegisteredItem` and `wRegisteredItem`, which saves keep. Select runs `SelectMenu`: `CheckRegisteredItem` (a slot that no longer holds the item clears the registration; a registered ball is never found, as in the original) and `UseRegisteredItem` by field menu. The Bicycle uses `Script_GetOnBike_Register` and `Script_GetOffBike_Register`, without a message; elsewhere Oak objects. Without a registration Select explains SEL. This replaces the earlier Key Items shortcut.
|
||||
- Bill's PC's MOVE PKMN W/O MAIL: refused while a party Pokémon holds MAIL, then "Each time you move a POKéMON, data will be saved. OK?". Choose the party or a box, a Pokémon (MOVE, STATS, CANCEL), then a box and the position to insert before. The party keeps its last Pokémon and its last healthy one, a different full box or party has "no room", a Pokémon moved down its own list lands one place earlier (`.CheckTrivialMove`), a boxed Pokémon joining the party gets its stats with full HP and no status (`CalcBufferMonStats`), and one entering a box gets its PP restored. The original's left/right box switching is presented as a list of boxes; after "no room" the box is chosen again rather than the position.
|
||||
- Save format 3 gained `registeredItem`, migrated by absence to none.
|
||||
@@ -232,6 +232,14 @@ The numbered sections below keep their full scope. Each one opens with a checkli
|
||||
- `newloadmap` now stops its script and resumes it on the new map, which these scripts need for their landing movements. Save format 3 gained `digWarp`, migrated by absence to none.
|
||||
- Unreachable in normal play so far: the Storm Badge, caves (Dark Cave is beyond Route 31) and flypoints beyond Cherrygrove. A destination that is not ported gives a notice. `JumpRoamMons` waits for roaming Pokémon.
|
||||
|
||||
## Implemented: Headbutt and Rock Smash
|
||||
|
||||
- Facing a Headbutt tree with a Pokémon that knows Headbutt asks "Want to HEADBUTT it?" (`AskHeadbuttScript`); HEADBUTT from the party menu skips the question (`HeadbuttFromMenuScript`). "did a HEADBUTT!", then `ShakeHeadbuttTree`: the tree's four tiles become grass tile $05 while `SPRITE_ANIM_OBJ_HEADBUTT` shakes over them in `PAL_OW_TREE`, two frames alternating every three steps with the second mirrored on every other pass, for 40 frames. The sound is not presented.
|
||||
- `TreeMonEncounter`: the map's set in `TreeMonMaps` (`TREEMON_SET_NONE` and unlisted maps have none), `GetTreeScore`'s facing-tile score ((x × y + x + y) / 5 modulo 10, in `wPlayerMapX/Y` coordinates) against the trainer ID's last digit, then 10%, 50% or 80% for a bad, good or rare score, the rare one drawing from the rare table, and `SelectTreeMon`'s percentages. Otherwise "Nope. Nothing…".
|
||||
- A tree battle is `BATTLETYPE_TREE`: "fell out of the tree!" instead of "appeared!", and the time of day's `AsleepTreeMons` species start asleep for `TREEMON_SLEEP_TURNS`.
|
||||
- Talking to a smashable rock runs `SmashRockScript`: "Maybe a POKéMON can break this." without Rock Smash (`HasRockSmash`), otherwise the question; ROCK SMASH from the party menu skips it and acts on the facing rock as `hLastTalked`. The earthquake, the rock's flicker and its disappearance run from the ROM's script, then `RockMonEncounter`: the map's `RockMonMaps` set and a 40% chance of a wild battle.
|
||||
- Unreachable in normal play so far: no open map has rocks, and no Pokémon available yet learns Headbutt (the Ilex Forest tutor) or Rock Smash (a TM on Route 36). Route 29 and Route 30 have tree sets.
|
||||
|
||||
## 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.
|
||||
@@ -314,7 +322,7 @@ Introduce native player, party, Pokémon, inventory, money and quest models. Rea
|
||||
|
||||
Expand script calls, choices, scene state, inventory commands and native special handlers. Translate routines reached through assembly calls into explicit native services; never fall back to emulator execution in the shipping game.
|
||||
|
||||
Meeting Mom, Elm's introduction, the starter, the aide's Potion, Route 29, Cherrygrove, Route 30's trainers, Mr. Pokémon's house, the Cherrygrove rival battle, the return to Elm, capture, the catching tutorial, the PC, the introduction's naming and clock screens, and switching and healing items in battle run now. The opening milestone is complete within the recorded acceptance boundaries. The start menu, party menu and pack now run outside battle, and Pokémon evolve. Field moves from the menu, SEL/Select and MOVE PKMN W/O MAIL run too, and the Pokégear's clock, map and phone cards, with calls to Mom and Elm, Mom's bank at home and her purchases, the trainer card with the play time, the options, and Fly, Dig, Teleport and the Escape Rope. Next: Headbutt and Rock Smash encounters.
|
||||
Meeting Mom, Elm's introduction, the starter, the aide's Potion, Route 29, Cherrygrove, Route 30's trainers, Mr. Pokémon's house, the Cherrygrove rival battle, the return to Elm, capture, the catching tutorial, the PC, the introduction's naming and clock screens, and switching and healing items in battle run now. The opening milestone is complete within the recorded acceptance boundaries. The start menu, party menu and pack now run outside battle, and Pokémon evolve. Field moves from the menu, SEL/Select and MOVE PKMN W/O MAIL run too, and the Pokégear's clock, map and phone cards, with calls to Mom and Elm, Mom's bank at home and her purchases, the trainer card with the play time, the options, Fly, Dig, Teleport and the Escape Rope, and Headbutt and Rock Smash with their encounters. Next: the remaining field items, MAIL and pack reordering.
|
||||
|
||||
Complete and validate the native battle engine: deterministic randomness, stats, move selection, accuracy/critical checks, damage, status, turn order, switching, fainting, experience, capture and rewards. Compare controlled seeds and states with the original, including integer rounding and overflow behavior.
|
||||
|
||||
|
||||
+50
-1
@@ -1,6 +1,6 @@
|
||||
# Recovered Claude session
|
||||
|
||||
Latest continuation: see **Mom's bank and her purchases: 2026-10-01**
|
||||
Latest continuation: see **Headbutt and Rock Smash: 2026-10-02**
|
||||
at the end of this file. Earlier sections are historical snapshots.
|
||||
|
||||
Recovered on 2026-09-23 from the local Claude Code transcript
|
||||
@@ -1039,3 +1039,52 @@ Teleport then Fly was checked once in Chromium and WebKit.
|
||||
Not made into cards, because they can be automated: emulator comparisons
|
||||
of the flight paths and of the Teleport/Dig warps through the reference
|
||||
harness.
|
||||
|
||||
## Headbutt and Rock Smash: 2026-10-02
|
||||
|
||||
Resumed with "continue the plan" on a clean tree after `ee55d34`, taking
|
||||
board card #26.
|
||||
|
||||
- `src/game/scripts/treemons.ts`: `treeMonEncounter` (`TreeMonEncounter`
|
||||
with `GetTreeMonSet`, `GetTreeMons`, `GetTreeScore` and `GetTreeMon`,
|
||||
including the rare table after the common one), `rockMonEncounter`
|
||||
(`RockMonEncounter`'s 40%) and `treeScore`, all read from the ROM's
|
||||
`TreeMonMaps`, `RockMonMaps` and `TreeMons`.
|
||||
- Interpreter: `callasm` runs `TreeMonEncounter` (facing tile in
|
||||
`wPlayerMapX/Y` coordinates, +4), `RockMonEncounter`, `HasRockSmash`
|
||||
(sets `wCurPartyMon`) and `ShakeHeadbuttTree` (a `headbutt` effect after
|
||||
the text). A `tempWild` local stands for `wTempWildMonSpecies`/
|
||||
`wCurPartyLevel`: `randomwildmon` reads it, `readmem wTempWildMonSpecies`
|
||||
answers from it, and the battle clears it with the tree battle type, as
|
||||
`CleanUpBattleRAM` does. The `battle` effect gained `tree`.
|
||||
- World: facing a tree runs `AskHeadbuttScript`; HEADBUTT and ROCK SMASH
|
||||
from the party menu queue `HeadbuttFromMenuScript` and
|
||||
`RockSmashFromMenuScript`, the latter with the rock as `hLastTalked`
|
||||
(`MenuFieldMove.lastTalked`). Talking to a rock already ran
|
||||
`SmashRockScript`. The `headbutt` effect lasts 20 ticks
|
||||
(`HEADBUTT_TICKS`) and `world.headbuttTree` gives the renderer the square
|
||||
and frames; objects do not move meanwhile.
|
||||
- Battle: `BATTLETYPE_TREE` (`tree` option) prints
|
||||
`PokemonFellFromTreeText` and puts the time of day's `AsleepTreeMons`
|
||||
species to sleep for `TREEMON_SLEEP_TURNS` (`CheckSleepingTreeMon`). The
|
||||
skipped cry is not presented anyway.
|
||||
- Renderer: tile $05 over the tree's four tiles for 36 frames, and the
|
||||
`HeadbuttTreeGFX` sprite in `PAL_OW_TREE` with the frameset's timing
|
||||
(three video frames a step, frame 2 mirrored on every other pass). Checked
|
||||
in Chromium with close-up screenshots across the shake.
|
||||
- New profile entries (OVERWORLD, BATTLE, `RAM.tempWildMonSpecies`) and
|
||||
constants (`BATTLETYPE_TREE`, `TREEMON_SLEEP_TURNS`, `NUM_TREEMON_SETS`),
|
||||
all verified by `check:reference`.
|
||||
|
||||
Checks: 435 unit tests with the local ROM (434 passed, 1 skipped; 135
|
||||
passed, 300 skipped without it; new `tests/headbutt-rock-smash.test.ts`,
|
||||
and the Rock Smash test in `tests/overworld-rom.test.ts` now smashes the
|
||||
rock and meets a Krabby); 123 Chromium/WebKit browser tests passed, 19
|
||||
skipped intentionally (a new Headbutt flow with a "headbutt" fixture room
|
||||
below a Route 29 tree); native and reference builds; reference, vendor and
|
||||
release checks; `git diff --check`. No emulator comparison of the tree
|
||||
scores or the shake; no CI or physical-device run. Unreachable in normal
|
||||
play so far: no open map has rocks, and Headbutt (the Ilex Forest tutor)
|
||||
and Rock Smash (a TM on Route 36) are not obtainable yet.
|
||||
|
||||
Next: the remaining field items, MAIL and pack reordering (board #27).
|
||||
Reference in new issue
Block a user