Port the trainer card and the play time

The player's name in the start menu opens TrainerCard: page 1 with the
name, ID, money, Pokédex count and play time, page 2 with the Johto
leaders and the badges owned, turned and closed with the original
buttons. The card picture, leader faces and animated badges come from the
ROM with _CGB_TrainerCard's palettes. GameTimer now counts the play time
from the end of the introduction, capped at 999:59:59, and saves keep it.

Closes #23

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sébastien QUEROLandClaude Opus 5.5 committed 2026-10-01 13:32:14 +02:00
1 parent 38b9562bd3
commit 47698565ab
24 files changed
+954 -30

No files matched your search

+34
View File
@@ -354,6 +354,40 @@ test("the Pokégear shows its cards and calls Elm", async ({ page }) => {
await expect(page.locator("#game-notice")).toHaveText("");
});
test("the trainer card turns to the badges and back", async ({ page }) => {
await start(page, "pokegear");
const choices = page.locator("#dialogue-choice"),
card = page.locator("#trainer-card"),
info = page.locator("#trainer-card-info"),
body = page.locator("#trainer-card-page");
await page.keyboard.press("Enter");
await choices.getByRole("option", { name: /^CHRIS/ }).click();
await expect(card).toBeVisible();
await expect(page.locator("#native-dialogue")).toBeHidden();
await expect(info).toContainText("NAME/");
await expect(info).toContainText("CHRIS");
await expect(info).toContainText("ID NO");
await expect(info).toContainText("MONEY");
await expect(page.locator("#trainer-card-pic")).toHaveAttribute(
"aria-label",
"Chris",
);
await expect(body).toContainText("PLAY TIME");
await expect(body).toContainText("BADGES▶");
await page.keyboard.press("ArrowRight");
await expect(body.locator("canvas")).toHaveAttribute(
"aria-label",
"0 of 8 Johto badges",
);
await page.keyboard.press("ArrowLeft");
await expect(body).toContainText("PLAY TIME");
await page.keyboard.press("KeyZ");
await expect(card).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"),