Files
Crystal/tests/foundation-fixture.ts
T
Sébastien QUEROLandClaude Opus 5.5 45275ba83b
Checks / web (push) Canceled after 0s
Port evolution, Rare Candy, evolution stones and vitamins
Pokémon that levelled up evolve after a won battle, following
EvolveAfterBattle's checks over the ROM's evolution bytes, with the
evolution screen that B can stop and move learning outside battle. The pack
uses Rare Candy, stones (with ABLE/NOT ABLE labels) and vitamins, and its
pocket tabs now sit in their own row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 16:21:59 +02:00

54 lines
1.5 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 ("candy": the first at
* level 13, with a Rare Candy); otherwise outdoors. */
export function foundationFixture(
assets: CrystalAssets,
room: boolean | "poster" | "center" | "candy",
) {
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" || room === "candy") {
world.state.party = [155, 16].map((species, i) =>
generatePartyMon(assets.pokemon, {
species,
level: room === "candy" && !i ? 13 : 8 - i * 4,
item: 0,
otId: world.playerId,
ot: "CHRIS",
dvs: 0x9abc,
caughtData: 0,
}),
);
world.state.bag.items = [{ item: 18, quantity: 5 }]; // POTION
if (room === "candy") world.state.bag.items.push({ item: 0x20, quantity: 1 });
}
const save = world.save();
const [map, x, y] =
room === "center" || room === "candy"
? ["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;
}