Files
Crystal/tests/foundation-fixture.ts
T
Sébastien QUEROLandClaude Opus 5.5 3bdca0099e
Checks / web (push) Canceled after 0s
Port the PC and boxes
Read TileCollisionStdScripts from the ROM so the Pokémon Center PC runs
PokemonCenterPC: Bill's PC (deposit, withdraw, release, change and name
boxes), the player's item storage (withdraw, deposit, toss, mail box) and
Oak's Pokédex rating. The house PC now opens the full player's PC menu.

A catch with a full party goes to the current box through SendMonIntoBox;
a full box keeps the ball, and filling it queues Bill's call as a memory
script after the battle. Saves gain boxes, box names and PC items,
migrated by absence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 17:12:26 +02:00

52 lines
1.3 KiB
TypeScript

import { CrystalAssets } from "../src/game/rom/assets";
import { GameWorld } from "../src/game/world/world";
import { OW } from "../src/game/world/constants";
import { generatePartyMon } from "../src/game/party/pokemon";
/** `room` places the player at the bedroom PC or poster, "center" at
* Cherrygrove's Pokémon Center PC with two Pokémon; otherwise outdoors. */
export function foundationFixture(
assets: CrystalAssets,
room: boolean | "poster" | "center",
) {
const world = new GameWorld(
assets,
() => new Date("2026-09-22T12:00:00"),
() => 0,
);
world.state.scenes["24:4"] = 1;
world.state.bag.keyItems.push(OW.BICYCLE);
if (room === "center") {
world.state.party = [155, 16].map((species, i) =>
generatePartyMon(assets.pokemon, {
species,
level: 8 - i * 4,
item: 0,
otId: world.playerId,
ot: "CHRIS",
dvs: 0x9abc,
caughtData: 0,
}),
);
world.state.bag.items = [{ item: 18, quantity: 5 }]; // POTION
}
const save = world.save();
const [map, x, y] =
room === "center"
? ["26:5", 9, 2]
: room === "poster"
? ["24:7", 6, 1]
: room
? ["24:7", 2, 2]
: ["24:4", 9, 6];
world.restore({
...save,
map,
x,
y,
direction: "up",
objects: [],
});
return world;
}