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

+51
View File
@@ -111,6 +111,8 @@ test("keyboard and touch D-pad navigate battle moves, cancel and run", async ({
await expect(menu.getByRole("button", { name: "FIGHT", exact: true })).toBeVisible();
// A real pointer press on the on-screen D-pad (synthetic events cannot be captured).
await page.locator('[data-game-button="down"]').click();
await expect(menu.getByRole("button", { name: "PACK", exact: true })).toHaveClass(/battle-selected/);
await page.keyboard.press("ArrowDown");
await expect(menu.getByRole("button", { name: "RUN", exact: true })).toHaveClass(/battle-selected/);
await page.keyboard.press("KeyX");
expect(await finish(page, "run")).toContain("Got away safely");
@@ -155,3 +157,52 @@ test("an unsupported battle effect closes the UI without persisting partial chan
expect(state.pokedex.seen).not.toContain(16);
expect(state.money).toBe(3001);
});
test("battle PACK throws Poké Balls, names the catch and saves it", async ({ page }) => {
await start(page, "catch");
const menu = page.locator("#battle-menu");
const messages: string[] = [];
let named = false;
for (let guard = 0; guard < 120 && !named; guard++) {
messages.push(await page.locator("#battle-text").innerText());
const pack = menu.getByRole("button", { name: "PACK", exact: true });
const nickname = menu.getByRole("textbox");
if (await nickname.count()) {
await expect(page.locator("#battle-text")).toHaveText("PIDGEY'S\nNICKNAME?");
await nickname.fill("PIDGE");
await menu.getByRole("button", { name: "OK", exact: true }).click();
named = true;
} else if (await pack.count()) {
await pack.click();
const ball = menu.getByRole("button", { name: /POKé BALL/ });
await expect(ball).toContainText("×");
await ball.click();
} else if (await menu.getByRole("button", { name: "YES", exact: true }).count()) {
await menu.getByRole("button", { name: "YES", exact: true }).click();
} else if (await menu.getByRole("button", { name: /Continue/ }).count()) {
await menu.getByRole("button", { name: /Continue/ }).click();
} else await page.clock.runFor(1200);
}
expect(named).toBe(true);
expect(messages.join("\n")).toContain("Gotcha!");
await finish(page);
await expect(page.locator("#battle")).toBeHidden();
const { state } = await exportState(page);
expect(state.party).toHaveLength(2);
expect(state.party[1]).toMatchObject({ species: 16, nickname: "PIDGE", level: 3 });
expect(state.pokedex.caught).toContain(16);
expect(state.bag.balls[0].quantity).toBeLessThan(10);
});
test("battle PACK closes with B and returns to the command menu", async ({ page }) => {
await start(page, "catch");
const menu = page.locator("#battle-menu");
for (let tick = 0; tick < 10 && !(await menu.getByRole("button", { name: "PACK", exact: true }).count()); tick++) {
if (await menu.getByRole("button", { name: /Continue/ }).count()) await page.keyboard.press("KeyX");
await page.clock.runFor(1200);
}
await menu.getByRole("button", { name: "PACK", exact: true }).click();
await expect(menu.getByRole("button", { name: /POKé BALL/ })).toBeVisible();
await page.keyboard.press("KeyZ");
await expect(menu.getByRole("button", { name: "FIGHT", exact: true })).toBeVisible();
});