POKéGEAR in the start menu runs the clock, Town Map and phone cards with the original joypad rules. Calls to Elm and Mom run their callee scripts, with the out-of-area and out-of-hours cases and HangUp's corrected timing. Mom saves a quarter of trainer prizes once asked, talking to her at home opens BankOfMom (GET, SAVE, CHANGE and the DST checks) with its digit amount box, and MomTriesToBuySomething buys items and dolls with her savings. Saves gain Mom's money, her next item and its trigger balance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3456aa4e11
commit
209778cabe
29 files changed
+2726
-47
No files matched your search
@@ -11,7 +11,7 @@ test.beforeEach(() =>
|
||||
|
||||
async function start(
|
||||
page: Page,
|
||||
room: boolean | "poster" | "center" | "candy" = false,
|
||||
room: boolean | "poster" | "center" | "candy" | "pokegear" | "mom" = false,
|
||||
) {
|
||||
await page.route("**/src/game/runtime.ts", async (route) => {
|
||||
const response = await route.fetch(),
|
||||
@@ -295,3 +295,95 @@ test("a Rare Candy levels up and evolves a Pokémon through the pack", async ({
|
||||
expect([state.party[0].species, state.party[0].level]).toEqual([156, 14]);
|
||||
expect(state.bag.items).toEqual([{ item: 18, quantity: 5 }]);
|
||||
});
|
||||
|
||||
test("the Pokégear shows its cards and calls Elm", async ({ page }) => {
|
||||
await start(page, "pokegear");
|
||||
const text = page.locator("#dialogue-text"),
|
||||
choices = page.locator("#dialogue-choice"),
|
||||
gear = page.locator("#pokegear"),
|
||||
card = page.locator("#pokegear-card");
|
||||
await page.keyboard.press("Enter");
|
||||
await choices.getByRole("option", { name: /^POKéGEAR/ }).click();
|
||||
await expect(gear).toBeVisible();
|
||||
await expect(gear.locator('[aria-current="true"]')).toHaveText("CLOCK");
|
||||
await expect(card).toContainText("TUESDAY");
|
||||
await expect(card).toContainText("12:00 PM");
|
||||
await expect(text).toHaveText("Press any button to exit.");
|
||||
await page.keyboard.press("ArrowRight");
|
||||
await expect(card).toContainText("▶ NEW BARK TOWN");
|
||||
await expect(card.locator("canvas")).toHaveAttribute(
|
||||
"aria-label",
|
||||
"Town Map: NEW BARK TOWN, you are here",
|
||||
);
|
||||
await expect(page.locator("#native-dialogue")).toBeHidden();
|
||||
await page.keyboard.press("ArrowUp");
|
||||
await expect(card).toContainText("▶ ROUTE 29");
|
||||
// The on-screen controls drive the Pokégear too.
|
||||
const right = page.locator('[data-game-button="right"]');
|
||||
await right.scrollIntoViewIfNeeded();
|
||||
const bounds = (await right.boundingBox())!;
|
||||
await page.mouse.move(
|
||||
bounds.x + bounds.width / 2,
|
||||
bounds.y + bounds.height / 2,
|
||||
);
|
||||
await page.mouse.down();
|
||||
await page.mouse.up();
|
||||
await page.locator("#game-screen").focus();
|
||||
await expect(card.getByRole("list", { name: "Phone numbers" })).toContainText(
|
||||
"PROF.ELM:",
|
||||
);
|
||||
await expect(text).toHaveText(/Whom do you want\s+to call\?/);
|
||||
await page.keyboard.press("ArrowDown");
|
||||
await page.keyboard.press("KeyX");
|
||||
await expect(card).toContainText("CALL");
|
||||
await expect(card).toContainText("CANCEL");
|
||||
await page.keyboard.press("KeyX");
|
||||
await expect(text).toHaveText("……");
|
||||
await page.clock.runFor(1000);
|
||||
await expect(text).toHaveText("Hello, CHRIS?");
|
||||
await page.keyboard.press("KeyX");
|
||||
await page.keyboard.press("KeyX");
|
||||
await page.keyboard.press("KeyX");
|
||||
await expect(text).toHaveText("Click!");
|
||||
await page.clock.runFor(3000);
|
||||
await expect(text).toHaveText(/Whom do you want\s+to call\?/);
|
||||
await page.keyboard.press("KeyZ");
|
||||
await expect(gear).toBeHidden();
|
||||
await choices.getByRole("option", { name: /^EXIT/ }).click();
|
||||
await page.clock.runFor(500);
|
||||
await expect(page.locator("#game-notice")).toHaveText("");
|
||||
});
|
||||
|
||||
test("Mom keeps the player's money with the digit box", async ({ page }) => {
|
||||
await start(page, "mom");
|
||||
const text = page.locator("#dialogue-text"),
|
||||
choices = page.locator("#dialogue-choice"),
|
||||
box = choices.locator(".mom-bank");
|
||||
await page.keyboard.press("KeyX");
|
||||
await expect(text).toHaveText(/Hi! Welcome home!/);
|
||||
await page.keyboard.press("KeyX");
|
||||
await page.keyboard.press("KeyX");
|
||||
await expect(text).toHaveText(/Or is this about\s+your money\?/);
|
||||
await choices.getByRole("button", { name: "YES" }).click();
|
||||
await expect(text).toHaveText(/What do you want\s+to do\?/);
|
||||
await choices.getByRole("option", { name: "SAVE" }).click();
|
||||
await expect(text).toHaveText(/How much do you\s+want to save\?/);
|
||||
await expect(box).toContainText("SAVED¥2300");
|
||||
await expect(box).toContainText("HELD¥3000");
|
||||
await expect(box).toContainText("DEPOSIT¥000000");
|
||||
await expect(box.locator(".mom-bank-cursor")).toHaveCount(1);
|
||||
// The keyboard moves to the thousands and raises it; the on-screen
|
||||
// buttons raise it again.
|
||||
for (let i = 0; i < 3; i++) await page.keyboard.press("ArrowLeft");
|
||||
await page.keyboard.press("ArrowUp");
|
||||
await expect(box).toContainText("DEPOSIT¥001000");
|
||||
await choices.getByRole("button", { name: "Increase digit" }).click();
|
||||
await expect(box).toContainText("DEPOSIT¥002000");
|
||||
await page.locator("#game-screen").focus();
|
||||
await page.keyboard.press("KeyX");
|
||||
await expect(text).toHaveText(/Your money's safe\s+here! Get going!/);
|
||||
await page.keyboard.press("KeyX");
|
||||
await expect(page.locator("#native-dialogue")).toBeHidden();
|
||||
const { state } = await backup(page);
|
||||
expect([state.money, state.momsMoney]).toEqual([1000, 4300]);
|
||||
});
|
||||
Reference in new issue
Block a user