Port capture and the Route 29 catching tutorial
Checks / web (push) Canceled after 0s
Checks / web (pull_request) Canceled after 0s

Battle PACK opens the Balls pocket and runs PokeBallEffect: the Poké,
Great, Ultra and Master Ball multipliers, the original HP arithmetic
(including the overflow above 341 maximum HP), the sleep/freeze bonus
(BRN/PSN/PAR add nothing), HELD_CATCH_CHANCE and the catch draw.
GetPokeBallWobble draws per shake from WobbleProbabilities and picks the
break-free text. Trainer battles block the ball but still use it and the
turn.

A catch reloads the Pokémon as LoadEnemyMon does (the wild item roll is
redrawn, then the item restored), keeps its HP, status, item and DVs,
restores the moves and PP it appeared with, adds it to the party with
SetCaughtData, registers it and offers a nickname with InitName's
default. A catch with six Pokémon needs the PC and is refused.

catchtutorial runs BATTLETYPE_TUTORIAL as "DUDE": no send-out, an
automatic catch that keeps nothing and prompts that continue on their
own. Both Route 29 triggers, declining and the Dude's repeat offer run
from the ROM. The text reader now handles TX_LOW.

PLAN.md gains a status overview and done/remaining checklists; the
README, help dialog, routine map and handoff describe the milestone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sébastien QUEROLandClaude Opus 5.5 committed 2026-09-24 20:57:36 +02:00
1 parent dc10343520
commit 9ac111f262
20 files changed
+1101 -65

No files matched your search

+35 -1
View File
@@ -87,7 +87,7 @@ A trainer sighting whose script is refused is not restarted until the player mov
## Next slice
Route 29, Cherrygrove, Route 30 and Mr. Pokémon's house are enabled with item balls, hidden items, fruit trees and the daily reset, the Pokémon Center nurse, the recorded whiteout spawn, map trainers, the first rival battle and Elm's special call. NPCs roam. Next: capture with the catching tutorial, then party, bag and Pokégear menus over the native models. Other specials stay refused until translated.
Route 29, Cherrygrove, Route 30 and Mr. Pokémon's house are enabled with item balls, hidden items, fruit trees and the daily reset, the Pokémon Center nurse, the recorded whiteout spawn, map trainers, the first rival battle, Elm's special call, capture and the catching tutorial. NPCs roam. Next: the PC and boxes, then party, bag and Pokégear menus over the native models. Other specials stay refused until translated.
## Reflect and Light Screen
@@ -120,3 +120,37 @@ the house, both rival triggers with all three parties, a rival loss, the call
indoors, outdoors and on reload, the officer's naming (including blank names
and reload at the naming screen), and the Egg and Poké Ball handovers. Browser
tests cover the house, the rival battle and the naming field.
## Capture and the catching tutorial
`PokeBallEffect`, `BallMultiplierFunctionTable` (Poké, Great, Ultra and
Master Balls), `GetPokeBallWobble` with `WobbleProbabilities`,
`UseBallInTrainerBattle` and `BattleMenu_Pack`'s `.UseItem` in
`engine/items/item_effects.asm`, `engine/battle_anims/pokeball_wobble.asm`
and `engine/battle/core.asm`. The catch rate is computed with the original
8- and 16-bit arithmetic and kept bugs (no bonus for BRN/PSN/PAR, overflow
above 341 maximum HP). Only the random draws are kept from the throw
animation: one per shake until the ball clicks or the Pokémon breaks free.
The caught Pokémon follows the second `LoadEnemyMon` (the wild item roll
is redrawn and then restored), `GeneratePartyMonStats` with `wBattleMode`
set (wild moves, PP and HP) and `SetCaughtData`. Pokédex registration,
`NewDexDataText`, `AskGiveNicknameText` and the naming field with
`InitName`'s default follow. The ball is taken from the selected slot, as
`RemoveItemFromPocket` does with `wCurItemQuantity`.
`Script_catchtutorial` and `CatchTutorial` run the battle as
`BATTLETYPE_TUTORIAL`: `<PLAYER>` reads "DUDE" from the ROM, `DoBattle`
skips the send-out, and the auto input's PACK and ball choice go straight
to `PokeBallEffect`, which always catches and keeps nothing (`.FinishTutorial`).
Prompts continue on their own. The Dude's back picture, the ball animation,
capture music and the Pokédex page (`NewPokedexEntry`) are not presented.
`TX_LOW` text is now read as a line break.
Refused: `SendMonIntoBox` (a catch with a full party), the other ball
multipliers, Park/Safari Balls, a transformed target and a catch-rate
division by zero. Pure vectors cover the catch formula; local-ROM tests
cover capture, every break-free message, Master Ball draws, blank
nicknames, the blocked trainer ball, full-party rollback, both tutorial
triggers, declining and the repeat offer, and mid-battle reloads. Browser
tests cover PACK, catching and naming. No emulator comparison of the
capture routines has been run.