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>
This commit is contained in:
1 parent
451464f7c6
commit
3bdca0099e
21 files changed
+1999
-131
No files matched your search
@@ -9,7 +9,7 @@ test.beforeEach(() =>
|
||||
test.skip(!existsSync(romPath), "Requires the local user ROM."),
|
||||
);
|
||||
|
||||
async function start(page: Page, room: boolean | "poster" = false) {
|
||||
async function start(page: Page, room: boolean | "poster" | "center" = false) {
|
||||
await page.route("**/src/game/runtime.ts", async (route) => {
|
||||
const response = await route.fetch(),
|
||||
source = await response.text();
|
||||
@@ -67,8 +67,15 @@ test("the bedroom PC puts away a decoration and saves the result", async ({
|
||||
await start(page, true);
|
||||
await page.keyboard.press("KeyX");
|
||||
await expect(page.locator("#game-notice")).toHaveText("");
|
||||
await expect(page.locator("#dialogue-text")).toHaveText("DECORATION");
|
||||
await expect(page.locator("#dialogue-text")).toContainText(
|
||||
"turned on the PC.",
|
||||
);
|
||||
await page.keyboard.press("KeyX");
|
||||
const choices = page.locator("#dialogue-choice");
|
||||
await choices
|
||||
.getByRole("option", { name: "DECORATION", exact: true })
|
||||
.click();
|
||||
await expect(page.locator("#dialogue-text")).toHaveText("DECORATION");
|
||||
await choices.getByRole("option", { name: "BED", exact: true }).click();
|
||||
await choices
|
||||
.getByRole("option", { name: "PUT IT AWAY", exact: true })
|
||||
@@ -116,3 +123,62 @@ test("the Town Map poster opens a native map and closes with B", async ({
|
||||
await expect(page.locator("#town-map-view")).toBeHidden();
|
||||
await expect(page.locator("#game-notice")).toHaveText("");
|
||||
});
|
||||
|
||||
test("the Pokémon Center PC deposits a Pokémon and an item", async ({
|
||||
page,
|
||||
}) => {
|
||||
await start(page, "center");
|
||||
const text = page.locator("#dialogue-text"),
|
||||
choices = page.locator("#dialogue-choice");
|
||||
await page.keyboard.press("KeyX");
|
||||
await expect(text).toContainText("turned on the PC.");
|
||||
await page.keyboard.press("KeyX");
|
||||
await choices.getByRole("option", { name: "BILL's PC", exact: true }).click();
|
||||
await expect(text).toContainText("BILL's PC");
|
||||
await page.keyboard.press("KeyX");
|
||||
await page.keyboard.press("KeyX");
|
||||
await choices
|
||||
.getByRole("option", { name: "DEPOSIT POKéMON", exact: true })
|
||||
.click();
|
||||
await choices.getByRole("option", { name: "PIDGEY :L4" }).click();
|
||||
await choices.getByRole("option", { name: "DEPOSIT", exact: true }).click();
|
||||
await expect(text).toHaveText("Stored PIDGEY!");
|
||||
await page.clock.runFor(2000);
|
||||
await expect(choices.getByRole("option", { name: "PIDGEY :L4" })).toHaveCount(
|
||||
0,
|
||||
);
|
||||
// B leaves the party list, then Bill's PC.
|
||||
await page.keyboard.press("KeyZ");
|
||||
await page.keyboard.press("KeyZ");
|
||||
await expect(choices.getByRole("option", { name: "TURN OFF" })).toBeVisible();
|
||||
await choices
|
||||
.getByRole("option", { name: /'s PC$/ })
|
||||
.last()
|
||||
.click();
|
||||
await page.keyboard.press("KeyX");
|
||||
await page.keyboard.press("KeyX");
|
||||
await choices
|
||||
.getByRole("option", { name: "DEPOSIT ITEM", exact: true })
|
||||
.click();
|
||||
const storage = page.locator("#mart");
|
||||
await expect(storage).toHaveAttribute("aria-label", "Item storage");
|
||||
await expect(page.locator("#mart-money")).toBeHidden();
|
||||
await storage.getByRole("button", { name: /POTION/ }).click();
|
||||
await storage.getByRole("button", { name: "Plus 1", exact: true }).click();
|
||||
await storage.getByRole("button", { name: "DEPOSIT", exact: true }).click();
|
||||
await expect(text).toContainText("Deposited 2 POTION(S).");
|
||||
await page.keyboard.press("KeyX");
|
||||
await storage.getByRole("button", { name: "BACK", exact: true }).click();
|
||||
await choices.getByRole("option", { name: "LOG OFF", exact: true }).click();
|
||||
await choices.getByRole("option", { name: "TURN OFF", exact: true }).click();
|
||||
await page.keyboard.press("KeyX");
|
||||
await page.clock.runFor(500);
|
||||
await expect(page.locator("#game-notice")).toHaveText("");
|
||||
const { state } = await backup(page);
|
||||
expect(state.party).toHaveLength(1);
|
||||
expect(
|
||||
state.storage.boxes[0].map((mon: { species: number }) => mon.species),
|
||||
).toEqual([16]);
|
||||
expect(state.pcItems).toEqual([{ item: 18, quantity: 2 }]);
|
||||
expect(state.bag.items).toEqual([{ item: 18, quantity: 3 }]);
|
||||
});
|
||||
Reference in new issue
Block a user