Clarify tutorial summaries and add next-chapter playback

This commit is contained in:
coyotte508 2026-09-16 09:29:45 +02:00
commit 956121fd47
8 changed files with 29 additions and 16 deletions

View file

@ -11,7 +11,7 @@
"test:tutorial": "node --test src/tutorial/*.spec.ts"
},
"dependencies": {
"@boardgamers/protocol": "0.3.1",
"@boardgamers/protocol": "0.3.3",
"fuji-engine": "workspace:*"
},
"devDependencies": {

View file

@ -8,7 +8,7 @@ import { lessons } from "./tutorial/lessons";
import "./lib/theme.css";
import "./tutorial/tutorial.css";
export const mountTutorial: TutorialMount = async (target, { chapter, onProgress }) => {
export const mountTutorial: TutorialMount = async (target, { chapter, onProgress, nextChapter }) => {
const lesson = lessons.find((entry) => entry.id === chapter);
if (!lesson) throw Error("Unknown chapter");
target.className = "tutorial-session";
@ -51,7 +51,7 @@ export const mountTutorial: TutorialMount = async (target, { chapter, onProgress
});
const app = mount(App, { target: game, props: { store } });
await tick();
const cleanupGuide = mountTutorialGuide(guide, controller);
const cleanupGuide = mountTutorialGuide(guide, controller, { nextChapter });
const resize = new ResizeObserver(() => {
target.style.setProperty("--tutorial-height", `${guide.getBoundingClientRect().height}px`);
});

View file

@ -220,7 +220,7 @@ export const firstSteps: TutorialOptions<State, Move> = {
.slice()
.reverse()
.find((e) => e.journey?.name === "You")?.journey;
return `You reached Hilltop lookout! Your lead was ${(result?.own ?? 0) - (result?.highest ?? 0)} and you lost ${result?.loss ?? 0} stamina. A small lead costs more stamina; a tie or lower means you stay put. The journal records the comparison. Mika and Ren have also resolved their journeys, and the lava has spread. A new round is ready.`;
return `You reached Hilltop lookout! Your lead was ${(result?.own ?? 0) - (result?.highest ?? 0)} and you lost ${result?.loss ?? 0} stamina. A small lead costs more stamina; a tie or lower means you stay put. Mika and Ren have moved, the lava has spread and a new round begins.`;
},
target: "journal",
hint: "The whole team must escape. Keep an eye on teammates' destinations as well as your own. Every round ends with lava spreading after everyone has resolved their journey.",

View file

@ -108,7 +108,8 @@ export const equipmentLesson: TutorialOptions<State, Move> = {
],
completion: {
title: "Equipment helps the whole team",
text: "You moved without losing stamina, and Ren used your loan to reach his destination. Everyone has moved, the lava has spread and your die has returned for the new round. A card can improve your own dice, help a teammate, or both. Check its timing before using it: for example, Torch works during planning, whereas Shovel and Map work during equipment. An arm injury prevents equipment use.",
hint: "Torch works during planning; Shovel and Map during equipment. An arm injury prevents equipment use.",
text: "You moved without losing stamina, and your loan helped Ren move. The lava has spread and your die has returned. Equipment can help you or a teammate; check when each card can be used.",
target: "journal",
},
};
@ -209,7 +210,7 @@ export const terrainLesson: TutorialOptions<State, Move> = {
],
completion: {
title: "Your Rope is ready",
text: "You collected a Rope on arrival. New equipment must wait until the next round: your teammates have now moved and the lava has spread, so that round has begun and your Rope is available. The equipment token is gone, but the printed reroll arrow can help again on a later visit.",
text: "You collected a Rope on arrival. It becomes usable next round, which has now begun. The equipment token is gone; the printed reroll arrow can help again on a later visit.",
target: "equipment:rope",
},
};

View file

@ -124,3 +124,15 @@
display: none;
}
}
.bgs-tutorial-guide .bgs-tutorial-next-chapter {
height: 36px;
padding: 0 10px;
display: inline-flex;
align-items: center;
gap: 6px;
white-space: nowrap;
}
.bgs-tutorial-guide [hidden] {
display: none;
}

10
pnpm-lock.yaml generated
View file

@ -34,8 +34,8 @@ importers:
packages/viewer:
dependencies:
'@boardgamers/protocol':
specifier: 0.3.1
version: 0.3.1
specifier: 0.3.3
version: 0.3.3
fuji-engine:
specifier: workspace:*
version: link:../engine
@ -61,8 +61,8 @@ importers:
packages:
'@boardgamers/protocol@0.3.1':
resolution: {integrity: sha512-FF8OUEvAZ+BKjZZ3Ab8Dw7oQh6TJOKMNkmRHqoabeE4clSp8lMRnHGGEakZdi7DplDJpstnya2fgBk2hX82UrA==}
'@boardgamers/protocol@0.3.3':
resolution: {integrity: sha512-AS+x84WHXRudW6xt/s/5I3xYmNTQFbZEBp3V+41w0I2RirSr2fWjYnYf0p11nwTbZ6G5upivKz/sjYLtk8HOYA==}
'@jridgewell/gen-mapping@0.3.13':
resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}
@ -631,7 +631,7 @@ packages:
snapshots:
'@boardgamers/protocol@0.3.1':
'@boardgamers/protocol@0.3.3':
dependencies:
zod: 4.6.2

View file

@ -1,4 +1,4 @@
packages:
- packages/*
minimumReleaseAgeExclude:
- "@boardgamers/protocol@0.2.2 || 0.3.0 || 0.3.1"
- "@boardgamers/protocol@0.2.2 || 0.3.0 || 0.3.1 || 0.3.3"

View file

@ -85,7 +85,7 @@ try {
assert.equal(await page.locator(".dev-toolbar, .expedition-chat").count(), 0);
await guide.getByRole("button", { name: "Continue", exact: true }).click();
await step(2);
await guide.getByRole("button", { name: "Show me", exact: true }).click();
await guide.getByRole("button", { name: "Show area", exact: true }).click();
await page.locator('[data-tutorial="tile:1,3"]').click();
await step(3);
await guide.getByRole("button", { name: "Continue", exact: true }).click();
@ -94,14 +94,14 @@ try {
await step(5);
await page.reload();
await step(5);
await guide.getByRole("button", { name: "Show me", exact: true }).click();
await guide.getByRole("button", { name: "Show area", exact: true }).click();
for (const index of [3, 4, 5]) await page.locator(".personal .dice-row .die").nth(index).click();
await page.getByRole("button", { name: /Reroll 3 dice/ }).click();
await step(6);
await page.reload();
await step(6);
assert.match(await guide.innerText(), /pink 5/);
await guide.getByRole("button", { name: "Show me", exact: true }).click();
await guide.getByRole("button", { name: "Show area", exact: true }).click();
await page.locator(".personal .die.bgs-tutorial-highlight").click();
await page.getByRole("button", { name: "Set selected die aside", exact: true }).click();
await step(7);
@ -256,7 +256,7 @@ try {
assert.equal(frames[0].lava, frames.at(-1).lava, "Victory needs no further lava wave");
assert.match(await guide.innerText(), /whole team wins immediately/);
const bounds = await guide
.locator(".bgs-tutorial-playback button")
.locator(".bgs-tutorial-playback button:visible")
.evaluateAll((buttons) => buttons.map((b) => b.getBoundingClientRect().top));
assert.equal(new Set(bounds).size, 1, "Playback controls stay on one row");
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth > innerWidth + 1), false);