Port capture and the Route 29 catching tutorial
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:
1 parent
dc10343520
commit
9ac111f262
20 files changed
+1101
-65
No files matched your search
@@ -22,6 +22,7 @@ import {
|
||||
import {
|
||||
NICKNAME_PATTERN,
|
||||
PARTY_LENGTH,
|
||||
caughtData,
|
||||
generatePartyMon,
|
||||
type PartyMon,
|
||||
} from "../party/pokemon";
|
||||
@@ -162,6 +163,8 @@ export type ScriptEffect =
|
||||
wild?: { species: number; level: number };
|
||||
trainer?: { classId: number; id: number; winText?: number; lossText?: number };
|
||||
canLose?: boolean;
|
||||
/** catchtutorial: the Dude's demonstration (BATTLETYPE_TUTORIAL). */
|
||||
tutorial?: boolean;
|
||||
}
|
||||
/** newloadmap: the world enters this map after the script ends. */
|
||||
| { kind: "warp"; map: string; x: number; y: number };
|
||||
@@ -674,6 +677,17 @@ export class ScriptRun {
|
||||
value = result & 0x3f; // Script_startbattle also updates wScriptVar.
|
||||
break;
|
||||
}
|
||||
case 0x61: {
|
||||
// catchtutorial: CatchTutorial runs StartBattle as the Dude, then
|
||||
// Script_reloadmap. The battle result is not read.
|
||||
if (byte() !== C.BATTLETYPE_TUTORIAL || !wild || trainer)
|
||||
throw new UnsupportedScript(offset, opcode, " (battle type)");
|
||||
yield* flush();
|
||||
yield synchronous({ kind: "battle", wild, tutorial: true });
|
||||
wild = undefined;
|
||||
canLose = false;
|
||||
break;
|
||||
}
|
||||
case 0x60:
|
||||
// Script_reloadmapafterbattle: a loss continues with the whiteout.
|
||||
if ((battleResult & 0x3f) === 1) p = SYMBOLS.battleWhiteoutScript;
|
||||
@@ -772,11 +786,6 @@ export class ScriptRun {
|
||||
const player = this.host.player();
|
||||
// GeneratePartyMonStats draws the Attack/Defense byte first.
|
||||
const dvs = (this.host.random() << 8) | this.host.random();
|
||||
// SetCaughtData: time of day and level, then gender and landmark.
|
||||
const caughtData =
|
||||
((((((this.host.timeOfDay() + 1) & 3) << 6) | level) & 0xff) << 8) |
|
||||
(player.gender << 7) |
|
||||
this.host.landmark();
|
||||
const mon = generatePartyMon(data, {
|
||||
species,
|
||||
level,
|
||||
@@ -784,7 +793,12 @@ export class ScriptRun {
|
||||
otId: player.id,
|
||||
ot: this.host.text().player,
|
||||
dvs,
|
||||
caughtData,
|
||||
caughtData: caughtData(
|
||||
this.host.timeOfDay(),
|
||||
level,
|
||||
player.gender,
|
||||
this.host.landmark(),
|
||||
),
|
||||
});
|
||||
this.state.party.push(mon);
|
||||
this.state.pokedex.seen.add(species);
|
||||
@@ -1263,7 +1277,8 @@ export class ScriptRun {
|
||||
return number;
|
||||
case 0x10:
|
||||
// .BoxFreeSpace: MONS_PER_BOX minus sBoxCount. Nothing can be
|
||||
// deposited yet (no capture or PC), so the current box is empty.
|
||||
// deposited yet (catching with a full party is refused and the PC
|
||||
// is not ported), so the current box is empty.
|
||||
return MONS_PER_BOX;
|
||||
case 0x12:
|
||||
return this.host.position().x;
|
||||
|
||||
@@ -219,7 +219,9 @@ export function readTextEnd(
|
||||
// Button waits inside one message become page boundaries in the DOM.
|
||||
output = output.trimEnd() + "\n\n";
|
||||
break;
|
||||
case 0x05:
|
||||
case 0x07:
|
||||
// TX_LOW writes on the box's lower line; TX_SCROLL starts a new one.
|
||||
output += "\n";
|
||||
break;
|
||||
case 0x08: {
|
||||
|
||||
Reference in new issue
Block a user