Open Route 30 with map trainers and multi-Pokémon trainer battles
Map trainers run the ROM's TalkToTrainerScript and SeenByTrainerScript. _CheckTrainerBattle runs before tile events at the end of each step and on idle ticks; TrainerWalkToPlayer builds wMovementBuffer natively, and writeobjectxy keeps the trainer where it stopped. The interpreter gains the trainer header commands, wRunningTrainerBattleScript and hidden items (HiddenItemScript). Trainers with several Pokémon send out the next one through EnemyPartyMonEntrance and FindMonInOTPartyToSwitchIntoBattle, including its BattleRandom fallback. AI_SwitchOrTryItem, CheckAbleToSwitch and AI_Switch are translated with their original bugs, and wPlayerUsedMoves is recorded. The Shift-mode switch offer, trainer items, Pursuit on a switch, Perish Song and Spikes remain refused. Route 30 and its Berry house are enabled; Mr. Pokémon's house and Route 31 stay closed. A refused trainer sighting does not restart until the player moves, so a rollback cannot trap the player in view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0d1bedb3b1
commit
e00dfab42e
18 files changed
+1156
-62
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { CrystalAssets } from "../src/game/rom/assets";
|
||||
import { generatePartyMon } from "../src/game/party/pokemon";
|
||||
import { GameWorld } from "../src/game/world/world";
|
||||
import { martFixtureWorld } from "./mart-fixture";
|
||||
|
||||
// Test-only script on an already accessible clerk. The actual trainer party,
|
||||
@@ -28,3 +29,24 @@ export function trainerFixtureWorld(assets: CrystalAssets, tail = [0x60, 0x33, 0
|
||||
return world;
|
||||
}
|
||||
|
||||
|
||||
/** Route 30 is enabled in production; only the start (below Bug Catcher
|
||||
* Don's sight line, with a level 20 Totodile) is a test fixture. */
|
||||
export function route30FixtureWorld(assets: CrystalAssets) {
|
||||
let seed = 7;
|
||||
const world = new GameWorld(assets, () => new Date("2026-09-22T12:00:00"), () => {
|
||||
seed = (seed * 1103515245 + 12345) >>> 0;
|
||||
return (seed >>> 16) & 255;
|
||||
});
|
||||
const mon = generatePartyMon(assets.pokemon, {
|
||||
species: 158, level: 20, item: 0, otId: world.playerId,
|
||||
ot: "CHRIS", dvs: 0xffff, caughtData: 0,
|
||||
});
|
||||
mon.moves = [10, 0, 0, 0]; // Scratch
|
||||
mon.pp = [35, 0, 0, 0];
|
||||
world.state.party = [mon];
|
||||
world.state.pokedex.seen.add(158);
|
||||
world.state.pokedex.caught.add(158);
|
||||
world.restore({ ...world.save(), map: "26:1", x: 1, y: 11, direction: "up" });
|
||||
return world;
|
||||
}
|
||||
Reference in new issue
Block a user