Expand tutorials and clarify action blocking and expansion rules

This commit is contained in:
coyotte508 2026-09-27 09:20:42 +02:00
commit 46f2797c23
36 changed files with 1300 additions and 182 deletions

View file

@ -1,3 +1,4 @@
import { markerBlockers } from "./marker-blockers.js";
import { sha256 } from "@noble/hashes/sha2.js";
import {
ACTIONS,
@ -821,7 +822,16 @@ function finish(s) {
}
function execute(s, m, p) {
const a = s.players[p];
say(s, m.type === "act" ? "action" : m.type, { p, ...m });
say(s, m.type === "act" ? "action" : m.type, {
p,
...m,
...(m.type === "discard"
? {
blockers: markerBlockers(s, p, m.action),
markers: a.markers[m.action],
}
: {}),
});
switch (m.type) {
case "treasure":
takeFrom(a.treasures, m.values);
@ -1051,6 +1061,43 @@ function chooseAI(s, p) {
const moves = availableMoves(s, p);
check(moves.length, "No legal bot move");
const a = s.players[p];
function planValue(actions) {
const markers = { ...a.markers };
for (const action of actions) markers[action]++;
const planned = {
...s,
players: s.players.map((player, q) =>
q === p ? { ...player, markers } : player,
),
};
return ACTIONS.reduce((total, action) => {
if (!markers[action]) return total;
const useful =
{
fish: a.fish.length ? 2 : 5,
sell: a.fish.length ? 6 : 3,
explore: 6,
build: a.hutsLeft > 5 ? 6 : 3,
buy: 5,
draw: 5,
tourist: 4,
sail: 3,
rest: 1,
}[action] + (CHARACTERS[a.character]?.action === action ? 2 : 0);
// Value each action once, including both markers in this placement.
// Existing majorities gain nothing from extra markers. A blocked stack
// may become available later, but neutral markers never leave the board.
const neutralBlocked = markerBlockers(planned, p, action).some(
(blocker) => blocker.neutral,
);
const availability = majority(planned, p, action)
? 1
: neutralBlocked
? 0
: 0.4;
return total + useful * availability;
}, 0);
}
function value(m) {
if (m.type === "treasure")
return a.money < 3 ? sum(m.values) * 0.5 - 1 : -30;
@ -1087,36 +1134,7 @@ function chooseAI(s, p) {
? 3
: 0)
);
if (m.type === "plan") {
return m.actions.reduce(
(v, action, i) =>
v +
value({ type: "plan-single", action }) -
(i && action === m.actions[0] ? 0.1 : 0),
0,
);
}
if (m.type === "plan-single") {
const n = a.markers[m.action];
const need =
Math.max(0, ...s.players.map((x) => x.markers[m.action])) + 1;
const useful = {
fish: a.fish.length ? 2 : 5,
sell: a.fish.length ? 6 : 3,
explore: 6,
build: a.hutsLeft > 5 ? 6 : 3,
buy: 5,
draw: 5,
tourist: 4,
sail: 3,
rest: 1,
}[m.action];
return (
useful -
(n >= need ? 8 : n ? 0 : 1) +
(CHARACTERS[a.character]?.action === m.action ? 2 : 0)
);
}
if (m.type === "plan") return planValue(m.actions);
if (m.type === "discard") return -15;
if (m.type === "governor") return -10;
if (m.type === "rest")

21
engine/marker-blockers.js Normal file
View file

@ -0,0 +1,21 @@
import { CHARACTERS } from "./catalog.js";
export function markerBlockers(s, p, action) {
const count = s.players[p].markers[action];
if (!count) return [];
const rank = (q) => (q - s.first + s.players.length) % s.players.length;
const blockers = s.players.flatMap((player, q) => {
const n = player.markers[action];
return q !== p && (n > count || (n === count && rank(q) < rank(p)))
? [{ p: q, count: n, tied: n === count }]
: [];
});
if (s.players.length === 2) {
const n = s.neutral[action];
const tieAllowed =
CHARACTERS[s.players[p].character]?.action === action ||
s.players[p].governorAction === action;
if (n > count || (n === count && !tieAllowed))
blockers.push({ count: n, neutral: true, tied: n === count });
}
return blockers;
}

View file

@ -1,6 +1,6 @@
{
"name": "@boardgamers/vanuatu",
"version": "0.1.2",
"version": "0.1.4",
"private": true,
"type": "module",
"main": "dist/engine.js",
@ -14,7 +14,7 @@
"test:browser": "node test/browser.mjs",
"check": "pnpm test:locales && pnpm build && pnpm test && pnpm test:browser && pnpm test:tutorial:browser",
"test:locales": "node scripts/check-locales.mjs viewer/localization && node --test scripts/localization.test.mjs",
"test:tutorial:browser": "node test/tutorial-browser.mjs"
"test:tutorial:browser": "node test/tutorial-browser.mjs && node test/tutorial-walkthrough-browser.mjs"
},
"dependencies": {
"@boardgamers/protocol": "0.6.1",

84
test/ai.test.js Normal file
View file

@ -0,0 +1,84 @@
import test from "node:test";
import assert from "node:assert/strict";
import * as E from "../engine/index.js";
function planning(players = 3) {
const s = E.init(players, [], {}, "bot-planning");
s.actor = 0;
s.first = 0;
s.phase = "plan";
s.planningPass = 0;
s.board = {
"0,0": E.tileState("efate"),
"1,0": E.tileState("startWreck"),
"0,1": E.tileState("startFish"),
"1,1": E.tileState("startBoat"),
};
s.tourists = 2;
for (const player of s.players) {
player.boat = "1,0";
player.character = null;
}
return s;
}
test("a two-marker bot placement opens two useful actions instead of overstacking", () => {
const s = planning();
s.players[0].character = "builder";
const next = E.moveAI(s, 0);
const { actions } = next._history[0].move;
assert.equal(new Set(actions).size, 2);
assert.ok(actions.includes("build"));
assert.equal(
Object.values(s.players[0].markers).reduce((a, b) => a + b),
0,
);
});
function contested(players = 3) {
const s = planning(players);
s.planningPass = 2;
s.players[0].character = "fisherman";
s.players[0].money = 0;
Object.assign(s.players[0].markers, { fish: 1, draw: 1, sail: 2 });
s.board["1,0"].treasure = 0;
s.board["0,0"].goods = {};
s.board["0,0"].huts = [];
s.tourists = 0;
return s;
}
test("the bot reinforces a tied fishing stack only when turn order requires it", () => {
for (const first of [0, 1]) {
const s = contested();
s.first = first;
s.players[1].markers.fish = 1;
const next = E.moveAI(s, 0);
assert.deepEqual(next._history[0].move.actions, [
first === 1 ? "fish" : "rest",
]);
}
});
test("the bot accounts for persistent neutral stacks and matching character ties", () => {
for (const character of ["fisherman", null]) {
const s = contested(2);
s.players[0].character = character;
s.neutral.fish = 2;
const next = E.moveAI(s, 0);
assert.deepEqual(next._history[0].move.actions, [
character ? "fish" : "rest",
]);
}
});
test("bots complete games with 2–5 players, including Rising Waters", () => {
for (const count of [2, 3, 4, 5])
for (const expansions of [[], ["rising-waters"]]) {
let s = E.init(count, expansions, {}, "bot-full-game");
let turns = 0;
while (!s.finished && turns++ < 1000) s = E.moveAI(s, s.actor);
assert.equal(s.finished, true, `${count} players / ${expansions}`);
assert.ok(s.players.every((p) => Number.isFinite(p.score)));
}
});

View file

@ -44,6 +44,97 @@ const page = await browser.newPage({
page.on("pageerror", (e) => errors.push(e.message));
await page.goto(base + "/?new&hotseat");
await page.waitForSelector("[data-character-choice]");
// Every supported locale must render translated action tooltips, not English fallbacks.
const tooltipSource = "Sail 1–3 ocean spaces, paying 1 vatu per space.";
for (const locale of [
"en",
"fr",
"de",
"da",
"el",
"hi",
"it",
"ko",
"nl",
"pl",
"pt-BR",
"ro",
"ru",
"vi",
"zh-TW",
]) {
const catalog = JSON.parse(
await readFile(
new URL(`../viewer/localization/${locale}.json`, import.meta.url),
"utf8",
),
);
await page.goto(`${base}/?new&hotseat&locale=${locale}`);
await page.waitForFunction(
(expected) =>
document.querySelector('[data-action="sail"]')?.title === expected,
catalog[tooltipSource],
);
const titles = await page
.locator(".action-dock [data-action]")
.evaluateAll((buttons) => buttons.map((button) => button.title));
assert.equal(titles.length, 9);
for (const title of titles) {
assert.ok(
Object.values(catalog).includes(title),
`${locale}: tooltip must come from its catalogue`,
);
if (locale !== "en")
assert.ok(
!Object.hasOwn(catalog, title),
`${locale}: English tooltip fallback`,
);
}
}
await page.goto(base + "/?new&hotseat");
await page.waitForSelector("[data-character-choice]");
// Action descriptions remain available even before an action can be selected.
for (const action of E.ACTIONS) {
assert.ok(
(await page.locator(`[data-action="${action}"]`).getAttribute("title"))
.length > 30,
);
}
// A swipe over the board must continue scrolling the mobile page at its boundary.
await page.setViewportSize({ width: 390, height: 600 });
await page.evaluate(() => scrollTo(0, 0));
const boardScroll = page.locator(".map-scroll");
await boardScroll.scrollIntoViewIfNeeded();
await boardScroll.evaluate((el) => {
el.scrollTop = el.scrollHeight;
});
const boardRect = await boardScroll.boundingBox();
const beforeSwipe = await page.evaluate(() => scrollY);
const cdp = await page.context().newCDPSession(page);
await cdp.send("Emulation.setTouchEmulationEnabled", { enabled: true });
const touchX = Math.round(boardRect.x + boardRect.width / 2);
const touchY = Math.round(
Math.max(150, Math.min(350, boardRect.y + boardRect.height / 2)),
);
await cdp.send("Input.dispatchTouchEvent", {
type: "touchStart",
touchPoints: [{ x: touchX, y: touchY }],
});
for (let dy = 20; dy <= 140; dy += 20) {
await cdp.send("Input.dispatchTouchEvent", {
type: "touchMove",
touchPoints: [{ x: touchX, y: touchY - dy }],
});
await page.waitForTimeout(30);
}
await cdp.send("Input.dispatchTouchEvent", {
type: "touchEnd",
touchPoints: [],
});
await page.waitForFunction((before) => scrollY > before + 20, beforeSwipe);
await cdp.send("Emulation.setTouchEmulationEnabled", { enabled: false });
await cdp.detach();
await page.evaluate(() => scrollTo(0, 0));
// The overview remains reachable above the taller character-selection tray.
for (const width of [390, 1440]) {
await page.setViewportSize({ width, height: 1000 });
@ -218,7 +309,13 @@ for (const width of [1440, 390]) {
assert.ok(
await page
.locator(".board-highlights")
.evaluate((el) => el === el.parentElement.lastElementChild),
.evaluate((el) =>
[...el.parentElement.querySelectorAll(".map-cell")].every(
(cell) =>
cell.compareDocumentPosition(el) &
Node.DOCUMENT_POSITION_FOLLOWING,
),
),
);
assert.equal(
await page.locator(".turn-tray .primary[data-move]").count(),
@ -260,9 +357,16 @@ for (const width of [1440, 390]) {
/Not enough vatus/,
);
assert.match(
await page.locator(".turn-tray [data-move]").innerText(),
await page.locator(".turn-tray [data-move]").getAttribute("aria-label"),
/Retrieve without acting/,
);
await page.locator(".turn-tray .retrieve-warning").click();
assert.equal(
await page.locator("dialog[open] [data-confirmed-retrieval]").count(),
1,
);
assert.match(await page.locator("dialog p").innerText(), /another action/);
await page.locator("dialog [data-close]").last().click();
await page.screenshot({
path: `.local/qa/unaffordable-build-${width}.png`,
fullPage: true,
@ -422,9 +526,11 @@ for (const width of [1440, 390]) {
await page.evaluate(() => JSON.stringify(window.vanuatuDemo.state)),
position,
);
await page.locator("[data-help]").first().click();
await page.locator('[data-pref="colorBlind"]').check();
await page.locator("[data-close]").click();
if (
(await page.locator("[data-color-blind]").getAttribute("aria-pressed")) !==
"true"
)
await page.locator("[data-color-blind]").click();
assert.ok(await page.locator(".color-symbol").count());
assert.deepEqual(
await page.locator('[data-cell="0,0"] .resource-symbol').allTextContents(),
@ -526,7 +632,11 @@ assert.equal(
0,
);
await page.locator("[data-help]").first().click();
assert.equal(await page.locator('[data-pref="colorBlind"]').isChecked(), true);
assert.equal(await page.locator('[data-pref="colorBlind"]').count(), 0);
assert.equal(
await page.locator("[data-color-blind]").getAttribute("aria-pressed"),
"true",
);
await page.evaluate(() =>
emitter.receive("preferences", {
analysis: true,
@ -534,10 +644,15 @@ await page.evaluate(() =>
sound: true,
}),
);
assert.equal(await page.locator('[data-pref="colorBlind"]').isChecked(), false);
assert.equal(
await page.locator("[data-color-blind]").getAttribute("aria-pressed"),
"false",
);
assert.equal(await page.locator('[data-pref="sound"]').isChecked(), true);
assert.equal(await page.locator(".resource-symbol").count(), 0);
await page.locator('[data-pref="colorBlind"]').check();
await page.locator("[data-close]").click();
await page.locator("[data-color-blind]").click();
await page.locator("[data-help]").first().click();
await page.locator('[data-pref="sound"]').uncheck();
assert.deepEqual(
await page.evaluate(() =>

View file

@ -0,0 +1,73 @@
import test from "node:test";
import assert from "node:assert/strict";
import * as E from "../engine/index.js";
import { markerBlockers } from "../engine/marker-blockers.js";
import { CHARACTERS } from "../engine/catalog.js";
test("blocker explanations agree with majority including neutral and character ties", () => {
for (const n of [2, 3, 5]) {
const s = E.init(n, [], {}, "blockers");
for (let first = 0; first < n; first++)
for (const character of [null, ...Object.keys(CHARACTERS)]) {
s.first = first;
s.players[0].character = character;
for (const action of E.ACTIONS)
for (const ours of [1, 2, 3])
for (const theirs of [0, 1, 2, 3]) {
s.players.forEach(
(p, i) => (p.markers[action] = i === 0 ? ours : theirs),
);
s.neutral[action] = theirs;
assert.equal(
markerBlockers(s, 0, action).length === 0,
E.majority(s, 0, action),
);
}
}
}
});
test("discard log preserves blockers and counts before markers disappear", () => {
const s = E.init(3, [], {}, "log");
s.phase = "actions";
s.first = 0;
s.actor = 1;
s.players.forEach((p) => {
p.markers = Object.fromEntries(E.ACTIONS.map((a) => [a, 0]));
p.character = null;
});
s.players[0].markers.fish = 2;
s.players[1].markers.fish = 1;
s.players[1].markers.sail = 1;
s.players[2].markers.sail = 2;
const next = E.move(s, { type: "discard", action: "fish" }, 1);
const event = next.events.findLast(
(e) => e.type === "discard" && e.p === 1 && e.action === "fish",
);
assert.equal(event.markers, 1);
assert.deepEqual(event.blockers, [{ p: 0, count: 2, tied: false }]);
assert.equal(next.players[1].markers.fish, 0);
});
test("entering a fully blocked turn preserves the choice between stacks", () => {
const s = E.init(3, [], {}, "blocked-choice");
s.phase = "actions";
s.first = 0;
s.actor = 0;
s.players.forEach((p) => {
p.markers = Object.fromEntries(E.ACTIONS.map((a) => [a, 0]));
p.character = null;
p.score = 0;
p.treasures = [];
});
Object.assign(s.players[0].markers, { build: 1, fish: 2, sail: 2 });
s.players[0].money = 0;
Object.assign(s.players[1].markers, { fish: 1, sail: 1 });
s.players[2].markers.rest = 1;
const next = E.move(s, { type: "discard", action: "build" }, 0);
assert.equal(next.actor, 1);
assert.equal(next.players[1].markers.fish, 1);
assert.equal(next.players[1].markers.sail, 1);
assert.deepEqual(E.availableMoves(next, 1), [
{ type: "discard", action: "sail" },
{ type: "discard", action: "fish" },
]);
});

View file

@ -50,7 +50,7 @@ try {
},
});
});
await page.waitForFunction(() => window.progress?.total === 9);
await page.waitForFunction(() => window.progress?.total === 10);
const seen = new Set();
for (let i = 0; i < 70; i++) {
const progress = await page.evaluate(() => window.progress);
@ -60,6 +60,10 @@ try {
'.bgs-tutorial-playback button[title="Continue"]',
);
if ((await next.count()) && (await next.isEnabled())) await next.click();
else if (await page.locator("dialog[open] [data-move]").count())
await page.locator("dialog[open] [data-move]").first().click();
else if (await page.locator(".character-choice").count())
await page.locator(".character-choice").first().click();
else {
const move = page
.locator(".turn-tray [data-move]:not(:disabled)")
@ -76,7 +80,7 @@ try {
await page.waitForTimeout(40);
}
assert.equal(await page.evaluate(() => window.progress.completed), true);
assert.equal(seen.size, 10);
assert.equal(seen.size, 11);
assert.equal(
await page.evaluate(
() => document.documentElement.scrollWidth <= innerWidth,
@ -168,6 +172,8 @@ try {
await launch();
assert.equal(await page.locator(".fish-price b").innerText(), "3");
for (const action of ["sail", "fish", "sell"]) {
const next = page.locator(".bgs-tutorial-playback button").nth(3);
if (await next.isEnabled()) await next.click();
await page.locator(`[data-action="${action}"]`).click();
if (action === "sail")
await page.locator('.map-cell[data-cell="1,0"]').click();
@ -216,6 +222,11 @@ try {
removeItem: (key) => saved.delete(key),
},
});
await lesson.play(
availableMoves(lesson.snapshot.state, 0).find(
(m) => m.type === "character" && m.character === "builder",
),
);
await lesson.continue();
for (const actions of [["sail", "buy"], ["fish", "draw"], ["build"]]) {
const move = availableMoves(lesson.snapshot.state, 0).find(
@ -275,7 +286,7 @@ try {
);
await page.close();
console.log(
"Nine tutorial steps, completion controls, mobile/desktop layout, French/Dutch locale forwarding, fishing price and restored progress, and white-resource export passed.",
"Ten planning steps, completion controls, mobile/desktop layout, French/Dutch locale forwarding, fishing price and restored progress, and white-resource export passed.",
);
} finally {
await browser.close();

View file

@ -0,0 +1,125 @@
import assert from "node:assert/strict";
import { createServer } from "node:http";
import { readFile, mkdir } from "node:fs/promises";
import { chromium } from "playwright";
import { createTutorial } from "@boardgamers/protocol/tutorial";
import { chapters, chapterMetadata } from "../viewer/tutorials.js";
import { availableMoves, stripSecret } from "../engine/index.js";
const server = createServer(async (req, res) => {
try {
if (req.url === "/") {
res.setHeader("Content-Type", "text/html");
res.end(
'<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="stylesheet" href="/viewer.css"><div id="game"></div><script src="/viewer.js"></script>',
);
} else {
res.setHeader(
"Content-Type",
req.url.endsWith(".css") ? "text/css" : "text/javascript",
);
res.end(await readFile(new URL("../dist" + req.url, import.meta.url)));
}
} catch {
res.writeHead(404);
res.end();
}
});
await new Promise((r) => server.listen(0, "127.0.0.1", r));
const browser = await chromium.launch();
await mkdir(".local/qa", { recursive: true });
try {
for (const width of [390, 1440])
for (const { id } of chapterMetadata) {
const chapter = chapters[id];
const lesson = await createTutorial(chapter);
const p = await browser.newPage({ viewport: { width, height: 1000 } });
p.setDefaultTimeout(5000);
const errors = [];
p.on("pageerror", (e) => errors.push(e.message));
await p.goto(`http://127.0.0.1:${server.address().port}/`);
await p.evaluate(async (id) => {
window.progress = null;
await window.vanuatu.launchTutorial("#game", {
chapter: id,
locale: "en",
onProgress: (v) => (window.progress = v),
});
}, id);
let guard = 0;
while (!lesson.snapshot.completed && guard++ < 45) {
const snap = lesson.snapshot;
await p.waitForFunction(
(step) => window.progress?.step === step,
snap.step,
);
if (snap.canContinue) {
await p
.locator('.bgs-tutorial-playback button[title="Continue"]')
.click();
await lesson.continue();
continue;
}
const step = chapter.steps[snap.step];
const m = availableMoves(snap.state, 0)
.sort((a, b) => (a.path?.length ?? 0) - (b.path?.length ?? 0))
.find((m) => !step.validateMove?.(snap.state, m));
assert.ok(m, `${id}/${step.id}`);
const idx = stripSecret(snap.state, 0).legal.findIndex(
(a) => JSON.stringify(a) === JSON.stringify(m),
);
if (m.type === "character")
await p.locator(`[data-character-choice="${m.character}"]`).click();
else if (m.type === "plan")
for (const action of m.actions)
await p.locator(`[data-action="${action}"]`).click();
else if (m.type === "place") {
await p.locator(`[data-tile="${m.tile}"]`).click();
await p.locator(`.map-cell[data-cell="${m.cell}"]`).click();
} else if (["act", "discard"].includes(m.type)) {
await p.locator(`[data-action="${m.action}"]`).click();
const toggle = p.locator("[data-bonus]");
if (await toggle.count()) await toggle.setChecked(!!m.bonus);
const cell = m.cell ?? m.path?.at(-1);
if (cell) await p.locator(`.map-cell[data-cell="${cell}"]`).click();
} else if (m.type === "treasure")
await p.locator('[data-free="treasure"]').click();
else if (m.type === "governor")
await p.locator("[data-governor]").click();
const root = (await p.locator("dialog[open]").count())
? "dialog[open]"
: ".turn-tray";
await p.locator(`${root} [data-move="${idx}"]`).click();
if (await p.locator("[data-confirmed-retrieval]").count())
await p.locator("[data-confirmed-retrieval]").click();
assert.equal(await lesson.play(m), true, `${id}/${step.id}`);
}
assert.ok(lesson.snapshot.completed, id);
await p.waitForFunction(() => window.progress?.completed);
assert.deepEqual(errors, [], id);
assert.ok(
await p.evaluate(
() => document.documentElement.scrollWidth <= innerWidth,
),
`${id}: overflow`,
);
await p.screenshot({ path: `.local/qa/lesson-${id}-${width}.png` });
await p.reload();
await p.evaluate(async (id) => {
window.progress = null;
await window.vanuatu.launchTutorial("#game", {
chapter: id,
locale: "en",
onProgress: (v) => (window.progress = v),
});
}, id);
await p.waitForFunction(() => window.progress?.completed);
lesson.destroy();
await p.close();
console.log(
`${width}: ${id} completed and restored (${chapter.steps.length} steps)`,
);
}
} finally {
await browser.close();
server.close();
}

View file

@ -2,7 +2,55 @@ import test from "node:test";
import assert from "node:assert/strict";
import { createTutorial } from "@boardgamers/protocol/tutorial";
import { chapters } from "../viewer/tutorials.js";
import { availableMoves, move } from "../engine/index.js";
import { availableMoves, majority, move } from "../engine/index.js";
test("planning opponents spread their markers and release a blocked fishing action", () => {
const chapter = chapters.planning;
for (const choice of availableMoves(chapter.initialState(), 0)) {
let state = chapter.move(chapter.initialState(), choice);
for (const actions of [["sail", "fish"], ["draw", "rest"], ["tourist"]])
state = chapter.move(state, { type: "plan", actions });
assert.equal(state.phase, "actions");
for (const opponent of state.players.slice(1)) {
const stacks = Object.values(opponent.markers).filter(Boolean);
assert.equal(
stacks.reduce((a, b) => a + b, 0),
5,
);
assert.ok(
stacks.length >= 3,
`${choice.character}: ${opponent.name} spreads markers`,
);
assert.equal(Math.max(...stacks), 2);
}
assert.equal(state.players[1].markers.fish, 2);
assert.equal(majority(state, 0, "fish"), false);
state = chapter.move(
state,
availableMoves(state, 0).find(
(m) =>
m.action === "sail" && m.path.length === 1 && m.path[0] === "1,0",
),
);
assert.equal(state.players[1].markers.fish, 0);
assert.equal(majority(state, 0, "fish"), true);
const fish = availableMoves(state, 0).find((m) => m.action === "fish");
assert.ok(fish, `${choice.character}: the player can fish after Maya`);
state = chapter.move(state, fish);
assert.deepEqual(state.players[0].fish, [1]);
let turns = 0;
while (state.round === 1 && turns++ < 15) {
const legal = availableMoves(state, 0);
const next =
legal.find((m) => m.type === "act") ??
legal.find((m) => m.type === "rest" || m.type === "discard");
assert.ok(next, `${choice.character}: the round can continue`);
state = chapter.move(state, next);
}
assert.equal(state.round, 2, `${choice.character}: the round finishes`);
}
});
for (const [id, chapter] of Object.entries(chapters))
test(`tutorial ${id} is completable with real engine moves`, async () => {
const lesson = await createTutorial(chapter);
@ -36,6 +84,7 @@ test("the fishing lesson shows the sale's lower price before the next round rese
};
const lesson = await createTutorial(options);
for (const action of ["sail", "fish", "sell"]) {
while (lesson.snapshot.canContinue) await lesson.continue();
const state = lesson.snapshot.state;
const selected = availableMoves(state, 0).find(
(m) =>
@ -68,3 +117,71 @@ test("the fishing lesson shows the sale's lower price before the next round rese
assert.equal(resumed.snapshot.state.round, 1);
resumed.destroy();
});
test("water lesson demonstrates combined construction, the countdown and an island sinking", async () => {
const lesson = await createTutorial(chapters["rising-waters"]);
const seen = new Set();
while (!lesson.snapshot.completed) {
const { state, step, canContinue } = lesson.snapshot;
const current = chapters["rising-waters"].steps[step];
seen.add(current.id);
if (current.id === "coasts") {
assert.equal(state.players[0].money, 0);
assert.deepEqual(state.board["0,0"].dikes, ["0,1", "1,0"]);
assert.deepEqual(state.board["0,0"].huts, [0]);
assert.equal(state.waterCountdown, 2);
}
if (current.id === "tourist") assert.equal(state.waterCountdown, 1);
if (current.id === "flood") {
assert.equal(state.waterTriggered, true);
assert.equal(state.board["0,0"].water, 4);
assert.equal(state.board["0,0"].submerged, false);
assert.equal(state.board["2,1"].submerged, true);
assert.deepEqual(state.board["2,1"].huts, []);
assert.deepEqual(state.board["2,1"].goods, {});
assert.equal(state.board["2,1"].tourists, 0);
assert.equal(state.board["2,1"].drawings, 0);
assert.equal(state.round, 4);
}
if (canContinue) await lesson.continue();
else
await lesson.play(
availableMoves(state, 0).find((m) => !current.validateMove?.(state, m)),
);
}
assert.equal(seen.size, chapters["rising-waters"].steps.length);
lesson.destroy();
});
test("the export lesson explains both the ordinary reward and ship completion bonus", async () => {
for (const good of ["copra", "beef"]) {
const lesson = await createTutorial(chapters.trade);
let count = 0;
while (!lesson.snapshot.completed && count++ < 12) {
const { state, step, canContinue } = lesson.snapshot;
if (canContinue) {
await lesson.continue();
continue;
}
const current = chapters.trade.steps[step];
const selected = availableMoves(state, 0).find(
(m) =>
!current.validateMove?.(state, m) &&
(m.action !== "buy" || m.good === good),
);
assert.ok(selected, `${good}/${current.id}`);
assert.equal(await lesson.play(selected), true);
}
assert.equal(lesson.snapshot.completed, true);
const { state, text } = lesson.snapshot;
assert.equal(state.players[0].score, good === "copra" ? 3 : 7);
assert.equal(state.players[0].money, good === "copra" ? 1 : 0);
assert.equal(state.demands[0].filled.every(Boolean), good === "beef");
assert.equal(state.demands[1].filled.every(Boolean), false);
assert.match(
text,
good === "copra" ? /no completion bonus/ : /7 prosperity/,
);
lesson.destroy();
}
});

View file

@ -1,3 +1,7 @@
import { assets } from "./assets.js";
import { tilePreviewSvg } from "./board.js";
import { blockingHtml } from "./blocking.js";
import { translateText } from "./localization/index.js";
import { mountChat } from "@boardgamers/protocol/chat/dom";
import { icon as renderIcon, token as renderToken, esc } from "./art.js";
import { translator } from "./labels.js";
@ -115,7 +119,7 @@ export function mountActivity(
case "neutral":
return `${actor} ${e.actions.map((a) => icon(a)).join("")}${e.type === "neutral" ? ` <span class="neutral-key">●</span>` : ""}`;
case "character":
return `${actor} <span>${esc(CHARACTERS[e.character]?.["name"] ?? e.character)}</span>`;
return `${actor} <img class="event-character" src="${assets["character-" + CHARACTERS[e.character]?.art]}" alt=""><span>${esc(translateText(CHARACTERS[e.character]?.name ?? e.character, lang))}</span>`;
case "conversion":
return `${actor} ${token("coin", e.points * 2)} → ${token("point", e.points)}`;
case "treasure":
@ -129,7 +133,7 @@ export function mountActivity(
case "beg":
return `${actor} ${token("point", e.amount)} → ${token("coin", e.amount)}`;
case "discard":
return `${actor} ${icon("undo")} ${icon(e.action)}`;
return `${actor} ${renderIcon("warning", translateText("Retrieve without acting", lang))} ${icon(e.action)}${e.markers ? ` ×${e.markers}` : ""}${e.blockers ? `<span class="event-explanation">${blockingHtml(state, e.p, e.action, lang, e.blockers)}</span>` : ""}`;
case "governor":
return `${actor} ${icon(e.from)} → ${icon(e.to)}`;
case "rest":
@ -139,7 +143,7 @@ export function mountActivity(
case "round":
return `<b>${t("round")} ${e.round}/8</b>`;
case "place":
return `${actor} ${t("expand")}`;
return `${actor} <span class="event-tile" role="img" aria-label="${esc(t("expand") + " " + e.cell)}">${tilePreviewSvg(e.tile, { colorBlind, t, language: lang, prefix: "event-" + e.cell })}</span><span class="event-coordinate">${esc(e.cell)}</span>`;
case "flood":
return `${icon("water")} ${t("water")}`;
case "end":
@ -159,7 +163,10 @@ export function mountActivity(
list.innerHTML = (state.events ?? state.lastEvents ?? [])
.map((e) => ({ e, html: eventHtml(e) }))
.filter((x) => x.html)
.map(({ e, html }) => `<li><small>${e.round}</small>${html}</li>`)
.map(
({ e, html }) =>
`<li class="${e.type === "round" ? "round-divider" : ""}">${html}</li>`,
)
.join("");
if (following)
requestAnimationFrame(() => (list.scrollTop = list.scrollHeight));

View file

@ -7,6 +7,8 @@ export const esc = (x) =>
],
);
const paths = {
warning:
'<path d="M16 3 31 29H1Z" fill="currentColor" stroke="#754817" stroke-width="1.5" stroke-linejoin="round"/><path d="M16 10v10" stroke="#fff9df" stroke-width="3" stroke-linecap="round"/><circle cx="16" cy="24.5" r="1.6" fill="#fff9df"/>',
sail: '<path d="M12 3Q24 6 28 19L12 21Z" fill="currentColor" stroke="#244e53" stroke-width=".8"/><path d="M11 2v21M11 5v14" fill="none" stroke="#244e53" stroke-width="1.4"/><path d="m3 24 27-5-7 10H10Z" fill="currentColor" stroke="#244e53" stroke-width=".8"/><path d="m5 24 23-4" fill="none" stroke="#fff5d5" stroke-width="1.2"/>',
fish: '<path d="M4 16C10 4 21 5 26 12l5-5v18l-5-5C18 28 10 27 4 16Z" fill="#df83a4" stroke="#a6426a"/><circle cx="10" cy="14" r="1.5" fill="#713847"/>',
sell: '<path d="M3 10h26l-2 17H5z" fill="#d3a163" stroke="#754627"/><path d="M8 5h16l4 6H4z" fill="#f4bc65"/><path d="M8 16h16M8 21h16" stroke="#805938"/>',

14
viewer/blocking.js Normal file
View file

@ -0,0 +1,14 @@
import { markerBlockers } from "../engine/marker-blockers.js";
import { BLOCKED, TIE, IMPOSSIBLE } from "./learning.js";
import { translateText } from "./localization/index.js";
import { esc } from "./art.js";
export function blockingText(s, p, action, lang, saved) {
const blockers = saved ?? markerBlockers(s, p, action);
const t = (text) => translateText(text, lang);
return blockers.length
? `${t(BLOCKED)}: ${blockers.map((b) => `${b.neutral ? t("Neutral markers") : s.players[b.p].name} (${b.count})${b.tied ? ` — ${t(TIE)}` : ""}`).join("; ")}`
: t(IMPOSSIBLE);
}
export function blockingHtml(s, p, action, lang, saved) {
return esc(blockingText(s, p, action, lang, saved));
}

View file

@ -93,14 +93,16 @@ export function boardSvg(
)
.join("");
let svg = `<svg class="${preview ? "tile-art" : "archipelago"}${overview ? " overview" : ""}" viewBox="${x0} ${y0} ${x1 - x0} ${y1 - y0}" role="group" aria-label="${preview ? esc(t(s.board["0,0"].type === "island" ? "island" : "sea")) : "Vanuatu"}"><defs>${defs}<filter id="${prefix}-boat-shadow" x="-25%" y="-25%" width="150%" height="150%"><feDropShadow dx="0" dy="0" stdDeviation=".9" flood-color="#fff9df" flood-opacity="1"/><feDropShadow dx="0" dy="2" stdDeviation="1.5" flood-opacity=".45"/></filter></defs>`;
let dikes = "";
for (const c of all) {
const tile = s.board[c.id],
legal = targetSet.has(c.id),
const legal = targetSet.has(c.id),
ghost = !s.board[c.id] && !!hoverTile && legal,
tile = s.board[c.id] ?? (ghost ? tileState(hoverTile) : null),
spec = tile ? TILES[tile.id] : null;
svg += `<g class="map-cell ${tile ? "occupied" : ""} ${legal ? "legal" : ""} ${selected === c.id ? "selected" : ""}" ${preview ? "" : `data-cell="${c.id}"`} ${legal ? `role="button" tabindex="0" aria-label="${esc(t(tile?.type === "island" ? "island" : "sea"))} ${c.id}"` : ""}>`;
svg += `<g class="map-cell ${s.board[c.id] ? "occupied" : ""} ${ghost ? "placement-preview" : ""} ${legal ? "legal" : ""} ${selected === c.id ? "selected" : ""}" ${preview ? "" : `data-cell="${c.id}"`} ${legal ? `role="button" tabindex="0" aria-label="${esc(t(tile?.type === "island" ? "island" : "sea"))} ${c.id}"` : ""}>`;
svg += `<title>${esc(tile ? `${t(tile.type === "island" ? "island" : "sea")} · ${c.id}${tile.submerged ? ` · ${"Submerged"}` : ""}` : "Tile space")}</title><path class="cell-surface" d="${tilePath(c.x, c.y)}"/>`;
if (tile) {
svg += tileImage(spec, c, false, prefix);
svg += tileImage(spec, c, ghost, prefix);
if (tile.submerged) {
svg += `<path d="${tilePath(c.x, c.y)}" fill="#1c708ca6"/>${svgIcon("water", c.x - 25, c.y - 25, 50)}`;
} else if (tile.type === "sea") {
@ -163,9 +165,10 @@ export function boardSvg(
},
{
kind: "draw",
value: preview
? `${tile.drawings}/${spec.drawings}`
: tile.drawings,
value:
preview || ghost
? `${tile.drawings}/${spec.drawings}`
: tile.drawings,
help: `${label("draw")}: ${tile.drawings}/${spec.drawings}`,
},
]);
@ -178,11 +181,10 @@ export function boardSvg(
const mx = c.x + dx * 0.48,
my = c.y + dy * 0.48,
l = Math.hypot(dx, dy);
svg += `<g><title>${esc(label("dike"))}</title><line x1="${mx - (dy / l) * 22}" y1="${my + (dx / l) * 22}" x2="${mx + (dy / l) * 22}" y2="${my - (dx / l) * 22}" stroke="#654429" stroke-width="9" stroke-linecap="round"/><line x1="${mx - (dy / l) * 22}" y1="${my + (dx / l) * 22}" x2="${mx + (dy / l) * 22}" y2="${my - (dx / l) * 22}" stroke="#d1aa67" stroke-width="5" stroke-linecap="round"/></g>`;
dikes += `<g><title>${esc(label("dike"))}</title><line x1="${mx - (dy / l) * 22}" y1="${my + (dx / l) * 22}" x2="${mx + (dy / l) * 22}" y2="${my - (dx / l) * 22}" stroke="#654429" stroke-width="9" stroke-linecap="round"/><line x1="${mx - (dy / l) * 22}" y1="${my + (dx / l) * 22}" x2="${mx + (dy / l) * 22}" y2="${my - (dx / l) * 22}" stroke="#d1aa67" stroke-width="5" stroke-linecap="round"/></g>`;
}
}
} else if (hoverTile && legal)
svg += tileImage(TILES[hoverTile], c, true, prefix);
}
if (!tile)
svg += `<text x="${c.x}" y="${c.y + 7}" class="empty-label">${legal ? "+" : "·"}</text>`;
svg += `<path class="cell-ring" d="${tilePath(c.x, c.y)}"/>`;
@ -206,12 +208,15 @@ export function boardSvg(
`<path class="cell-highlight ${targetSet.has(c.id) ? "legal" : ""} ${selected === c.id ? "selected" : ""}" data-highlight-cell="${c.id}" d="${tilePath(c.x, c.y)}"/>`,
)
.join("")}</g>`;
return svg + "</svg>";
// Coastal pieces must be painted after both neighbouring tiles and outlines.
return (
svg + `<g class="board-dikes" pointer-events="none">${dikes}</g></svg>`
);
}
export function tilePreviewSvg(id, options) {
return boardSvg(
{ boardLayout: 2, board: { "0,0": tileState(id) }, players: [] },
{ ...options, preview: true, prefix: `preview-${id}` },
{ ...options, preview: true, prefix: options?.prefix ?? `preview-${id}` },
);
}

23
viewer/learning.js Normal file
View file

@ -0,0 +1,23 @@
export const EXTEND_TITLE = "Extend the archipelago";
export const EXTEND_WHO =
"The first player places the two revealed tiles in either order.";
export const EXTEND_HOW =
"Select a tile, choose a highlighted space, then confirm. Repeat for the remaining tile. Each tile must touch at least two placed tiles. Islands cannot touch islands; ocean tiles must touch an island.";
export const EXTEND_WHEN =
"Extend at the start of rounds 2–7, before choosing characters. The next pair is a preview for the following round. There are no tiles to place in round 8.";
export const ROUND_TITLE = "How a round works";
export const ROUND_HELP =
"Prepare the round and extend the map; choose characters; place markers in passes of 2, 2, 1; take turns resolving one action stack; resolve Rest bonuses. Repeat for 8 rounds. Before planning, check your boat position, money and the actions needed to reach your goal.";
export const REMAINING_TILES = "Tiles still to place";
export const FIRST_HELP =
"The first player does not rotate automatically. Take the First player token with Rest to become first player next round. Otherwise, the current first player stays first. Ties in marker counts follow turn order, starting with the first player. With the same number of markers, you can block a later player from taking that action until you remove yours.";
export const RETRIEVE_HELP =
"Choose one action stack to retrieve without acting. All your markers on that action are removed. Retrieval is automatic only when it is the sole remaining move.";
export const BLOCKED = "Blocked by";
export const TIE = "Tie: earlier in turn order";
export const IMPOSSIBLE =
"No legal action with your current position and resources.";
export const EXTEND_RULE =
"The first player places both revealed tiles in either order. Each tile must touch at least two placed tiles. Islands cannot touch each other; an ocean tile must touch an island.";

View file

@ -850,7 +850,5 @@
"épuisé": "opbrugt",
"— next catch on this tile": "— næste fangst på denne brik",
"— prochaine prise sur cette tuile": "— næste fangst på denne brik",
"🏝️ Vanuatu": "🏝️ Vanuatu",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "En hytte {p0} koster {p1}. En tegning {p2} giver {p3}. At transportere en turist {p4} giver {p5} for hver hytte på den ø, uanset farve. Hvile {p6} lader dig vælge en hemmelig bonus, der afgøres i slutningen af runden.",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "På lige runder angiver terningen antallet af handlinger før oversvømmelsen. Hver tilstødende havkyst uden dige tilføjer 1 vand. Byg et dige {p0} for {p1} med Byg-handlingen. Ved 5 vande synker en ø; hvis 3 øer synker, taber alle. Hver hytte på en ø med 1 / 2 / 3 / 4 vande mister 1 / 3 / 5 / 7 velstand ved spillets afslutning."
"🏝️ Vanuatu": "🏝️ Vanuatu"
}

View file

@ -224,7 +224,7 @@
"Exporter des marchandises": "Waren exportieren",
"Exporter gratuitement un second cube identique de la réserve.": "Exportiere kostenlos einen zweiten gleichen Würfel aus dem Vorrat.",
"Extend at the start of rounds 2–7, before choosing characters. The next pair is a preview for the following round. There are no tiles to place in round 8.": "Erweitere zu Beginn der Runden 2–7 vor der Charakterwahl. Das nächste Paar zeigt die Plättchen der folgenden Runde. In Runde 8 werden keine Plättchen gelegt.",
"Extend the archipelago": "Den Archipel erweitern",
"Extend the archipelago": "Das Archipel erweitern",
"Faire du commerce": "Handeln",
"Fermer": "Schließen",
"Fin de partie": "Spielende",
@ -850,7 +850,5 @@
"épuisé": "erschöpft",
"— next catch on this tile": "— nächster Fang auf diesem Feld",
"— prochaine prise sur cette tuile": "— nächster Fang auf diesem Feld",
"🏝️ Vanuatu": "🏝️ Vanuatu",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "Eine Hütte {p0} kostet {p1}. Eine Zeichnung {p2} bringt {p3}. Einen Touristen zu befördern {p4} bringt {p5} für jede Hütte auf dieser Insel, egal welcher Farbe. Ausruhen {p6} lässt dich einen geheimen Bonus wählen, der am Ende der Runde ausgewertet wird.",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "In geraden Runden gibt der Würfel an, wie viele Aktionen vor der Flut stattfinden. Jede angrenzende Ozeanküste ohne Deich fügt 1 Wasser hinzu. Baue einen Deich {p0} für {p1} mit der Aktion Bauen. Bei 5 Wassern versinkt eine Insel; wenn 3 Inseln versinken, verlieren alle. Jede Hütte auf einer Insel mit 1 / 2 / 3 / 4 Wassern verliert 1 / 3 / 5 / 7 Wohlstand am Spielende."
"🏝️ Vanuatu": "🏝️ Vanuatu"
}

View file

@ -224,7 +224,7 @@
"Exporter des marchandises": "Εξαγωγή αγαθών",
"Exporter gratuitement un second cube identique de la réserve.": "Εξήγαγε δωρεάν έναν δεύτερο ίδιο κύβο από το απόθεμα.",
"Extend at the start of rounds 2–7, before choosing characters. The next pair is a preview for the following round. There are no tiles to place in round 8.": "Επέκτεινε στην αρχή των γύρων 2–7, πριν επιλέξετε χαρακτήρες. Το επόμενο ζευγάρι προορίζεται για τον επόμενο γύρο. Στον γύρο 8 δεν τοποθετούνται πλακίδια.",
"Extend the archipelago": "Επέκτεινε το αρχιπέλαγος",
"Extend the archipelago": "Επέκταση του αρχιπελάγους",
"Faire du commerce": "Εμπόριο",
"Fermer": "Κλείσιμο",
"Fin de partie": "Τέλος παιχνιδιού",
@ -850,7 +850,5 @@
"épuisé": "εξαντλημένο",
"— next catch on this tile": "— επόμενη ψαριά σε αυτό το πλακίδιο",
"— prochaine prise sur cette tuile": "— επόμενη ψαριά σε αυτό το πλακίδιο",
"🏝️ Vanuatu": "🏝️ Vanuatu",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "Μια καλύβα {p0} κοστίζει {p1}. Ένα σχέδιο {p2} κερδίζει {p3}. Η μεταφορά ενός τουρίστα {p4} κερδίζει {p5} για κάθε καλύβα σε αυτό το νησί, οποιουδήποτε χρώματος. Η ανάπαυση {p6} σου επιτρέπει να επιλέξεις ένα μυστικό μπόνους, που επιλύεται στο τέλος του γύρου.",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "Σε ζυγούς γύρους, το ζάρι δίνει τον αριθμό των ενεργειών πριν την πλημμύρα. Κάθε γειτονική ωκεάνια ακτή χωρίς ανάχωμα προσθέτει 1 νερό. Χτίσε ένα ανάχωμα {p0} για {p1} με την ενέργεια Χτίσιμο. Στα 5 νερά ένα νησί βυθίζεται· αν βυθιστούν 3 νησιά, όλοι χάνουν. Κάθε καλύβα σε νησί με 1 / 2 / 3 / 4 νερά χάνει 1 / 3 / 5 / 7 ευημερία στο τέλος του παιχνιδιού."
"🏝️ Vanuatu": "🏝️ Vanuatu"
}

View file

@ -850,7 +850,5 @@
"épuisé": "épuisé",
"— next catch on this tile": "— next catch on this tile",
"— prochaine prise sur cette tuile": "— prochaine prise sur cette tuile",
"🏝️ Vanuatu": "🏝️ Vanuatu",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end."
"🏝️ Vanuatu": "🏝️ Vanuatu"
}

View file

@ -850,7 +850,5 @@
"épuisé": "تمام شده",
"— next catch on this tile": "؛ صید بعدی در این کاشی",
"— prochaine prise sur cette tuile": "؛ صید بعدی در این کاشی",
"🏝️ Vanuatu": "🏝️ Vanuatu",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "یک کلبه {p0} هزینهٔ {p1} دارد. یک نقاشی {p2} مقدار {p3} می‌دهد. آوردن گردشگر {p4} به‌ازای هر کلبه در آن جزیره، با هر رنگی، {p5} می‌دهد. استراحت {p6} به شما اجازه می‌دهد یک پاداش پنهان انتخاب کنید که در پایان دور اعمال می‌شود.",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "در دورهای زوج، تاس تعداد اقدام‌های باقی‌مانده تا بالا آمدن آب را تعیین می‌کند. هر ساحل مجاور اقیانوس که سیل‌بند ندارد، ۱ آب اضافه می‌کند. با اقدام ساخت، یک سیل‌بند {p0} با هزینهٔ {p1} بسازید. با ۵ آب، جزیره غرق می‌شود؛ اگر ۳ جزیره غرق شوند، همه می‌بازند. هر کلبه در جزیره‌ای با ۱ / ۲ / ۳ / ۴ آب، در پایان بازی ۱ / ۳ / ۵ / ۷ شکوفایی از دست می‌دهد."
"🏝️ Vanuatu": "🏝️ Vanuatu"
}

View file

@ -224,7 +224,7 @@
"Exporter des marchandises": "Exporter des marchandises",
"Exporter gratuitement un second cube identique de la réserve.": "Exporter gratuitement un second cube identique de la réserve.",
"Extend at the start of rounds 2–7, before choosing characters. The next pair is a preview for the following round. There are no tiles to place in round 8.": "L’archipel s’étend au début des manches 2 à 7, avant le choix des personnages. La paire suivante annonce la prochaine manche. Il n’y a pas de tuiles à poser en manche 8.",
"Extend the archipelago": "Étendre l'archipel",
"Extend the archipelago": "Étendre l’archipel",
"Faire du commerce": "Faire du commerce",
"Fermer": "Fermer",
"Fin de partie": "Fin de partie",
@ -392,7 +392,7 @@
"Rest lets you choose a secret bonus. You receive it at the end of the round, after all action markers have been removed.": "Se reposer permet de choisir un bonus secret. Vous le recevez en fin de manche, quand tous les marqueurs d’action ont été retirés.",
"Retour au plateau": "Retour au plateau",
"Retrieve markers": "Reprendre les pions",
"Retrieve without acting": "Reprendre sans agir",
"Retrieve without acting": "Retirer sans agir",
"Revenus": "Revenus",
"Richesse": "Richesse",
"Rising Waters": "La Montée des eaux",
@ -850,7 +850,5 @@
"épuisé": "épuisé",
"— next catch on this tile": "— prochaine prise sur cette tuile",
"— prochaine prise sur cette tuile": "— prochaine prise sur cette tuile",
"🏝️ Vanuatu": "🏝️ Vanuatu",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "Une cabane {p0} coûte {p1}. Un dessin {p2} rapporte {p3}. Transporter un touriste {p4} rapporte {p5} par cabane sur l’île, quelle que soit sa couleur. Le repos {p6} permet de choisir un bonus secret, appliqué en fin de manche.",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "Aux manches paires, le dé indique le nombre d’actions avant l’inondation. Chaque côte bordant une case d’océan et dépourvue de digue ajoute 1 eau. Construisez une digue {p0} pour {p1} avec l’action Construire. À 5 eaux, une île est submergée ; si 3 îles sont submergées, tout le monde perd. En fin de partie, chaque cabane sur une île avec 1 / 2 / 3 / 4 eaux fait perdre 1 / 3 / 5 / 7 points de prospérité."
"🏝️ Vanuatu": "🏝️ Vanuatu"
}

View file

@ -224,7 +224,7 @@
"Exporter des marchandises": "माल निर्यात करो",
"Exporter gratuitement un second cube identique de la réserve.": "रिज़र्व से दूसरा समान घन मुफ़्त में निर्यात करो।",
"Extend at the start of rounds 2–7, before choosing characters. The next pair is a preview for the following round. There are no tiles to place in round 8.": "दौर 2–7 की शुरुआत में पात्र चुनने से पहले विस्तार करें। अगली जोड़ी अगले दौर की झलक है। दौर 8 में टाइलें नहीं रखी जातीं।",
"Extend the archipelago": "द्वीपसमूह बढ़ाएँ",
"Extend the archipelago": "द्वीपसमूह का विस्तार",
"Faire du commerce": "व्यापार करो",
"Fermer": "बंद करें",
"Fin de partie": "खेल समाप्त",
@ -850,7 +850,5 @@
"épuisé": "समाप्त",
"— next catch on this tile": "— इस टाइल पर अगली पकड़",
"— prochaine prise sur cette tuile": "— इस टाइल पर अगली पकड़",
"🏝️ Vanuatu": "🏝️ Vanuatu",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "झोपड़ी {p0} का खर्च {p1} है। रेत का चित्र {p2} बनाने पर {p3} मिलता है। पर्यटक {p4} को द्वीप पर ले जाने से वहाँ की हर झोपड़ी के लिए {p5} मिलता है, चाहे झोपड़ी किसी भी रंग की हो। आराम {p6} से एक गुप्त बोनस चुनें, जो दौर के अंत में मिलता है।",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "सम दौरों में, पासा बताता है कि बाढ़ से पहले कितनी क्रियाएँ होंगी। बिना बाँध वाला हर समुद्र-तट 1 पानी जोड़ता है। निर्माण क्रिया से {p1} में एक बाँध {p0} बनाएँ। 5 पानी पर द्वीप डूब जाता है; 3 द्वीप डूबने पर सब हार जाते हैं। खेल के अंत में 1 / 2 / 3 / 4 पानी वाले द्वीप की हर झोपड़ी 1 / 3 / 5 / 7 समृद्धि खोती है।"
"🏝️ Vanuatu": "🏝️ Vanuatu"
}

View file

@ -224,7 +224,7 @@
"Exporter des marchandises": "Esportare merci",
"Exporter gratuitement un second cube identique de la réserve.": "Esporta gratuitamente un secondo cubo identico dalla riserva.",
"Extend at the start of rounds 2–7, before choosing characters. The next pair is a preview for the following round. There are no tiles to place in round 8.": "Espandi all’inizio dei round 2–7, prima di scegliere i personaggi. La coppia successiva anticipa il prossimo round. Nel round 8 non si piazzano tessere.",
"Extend the archipelago": "Estendi l'arcipelago",
"Extend the archipelago": "Espandere l’arcipelago",
"Faire du commerce": "Commerciare",
"Fermer": "Chiudi",
"Fin de partie": "Fine partita",
@ -850,7 +850,5 @@
"épuisé": "esaurito",
"— next catch on this tile": "— prossima pesca su questa tessera",
"— prochaine prise sur cette tuile": "— prossima pesca su questa tessera",
"🏝️ Vanuatu": "🏝️ Vanuatu",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "Una capanna {p0} costa {p1}. Un disegno {p2} guadagna {p3}. Trasportare un turista {p4} guadagna {p5} per ogni capanna su quell'isola, di qualsiasi colore. Riposare {p6} ti permette di scegliere un bonus segreto, risolto alla fine del round.",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "Nei round pari, il dado indica il numero di azioni prima dell'inondazione. Ogni costa oceanica adiacente senza diga aggiunge 1 acqua. Costruisci una diga {p0} per {p1} con l'azione Costruisci. A 5 acque un'isola affonda; se affondano 3 isole, tutti perdono. Ogni capanna su un'isola con 1 / 2 / 3 / 4 acque perde 1 / 3 / 5 / 7 prosperità a fine partita."
"🏝️ Vanuatu": "🏝️ Vanuatu"
}

View file

@ -850,7 +850,5 @@
"épuisé": "고갈됨",
"— next catch on this tile": "— 이 타일에서 다음에 잡을 물고기의 가치",
"— prochaine prise sur cette tuile": "— 이 타일의 다음 어획량",
"🏝️ Vanuatu": "🏝️ 바누아투",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "오두막 {p0} 비용은 {p1}입니다. 그림 {p2}은(는) {p3}을(를) 얻습니다. 관광객 수송 {p4}은(는) 그 섬의 모든 색 오두막마다 {p5}을(를) 얻습니다. 휴식 {p6}은(는) 라운드 종료 시 해결되는 비밀 보너스를 선택하게 합니다.",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "짝수 라운드에는 주사위로 침수 전 행동 수를 정합니다. 제방 없이 바다와 맞닿은 해안마다 물이 1씩 늘어납니다. 건설 행동으로 {p1}을(를) 내고 제방 {p0}을(를) 지으세요. 물이 5가 되면 섬이 가라앉고, 섬 3개가 가라앉으면 모두 패배합니다. 물이 1 / 2 / 3 / 4인 섬의 오두막마다 게임 종료 시 번영 1 / 3 / 5 / 7을 잃습니다."
"🏝️ Vanuatu": "🏝️ 바누아투"
}

View file

@ -850,7 +850,5 @@
"épuisé": "uitgeput",
"— next catch on this tile": "— volgende vangst op deze tegel",
"— prochaine prise sur cette tuile": "— volgende vangst op deze tegel",
"🏝️ Vanuatu": "🏝️ Vanuatu",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "Een hut {p0} kost {p1}. Een tekening {p2} levert {p3} op. Een toerist vervoeren {p4} levert {p5} op voor elke hut op dat eiland, ongeacht de kleur. Rusten {p6} laat je een geheime bonus kiezen, afgehandeld aan het einde van de ronde.",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "Op even rondes geeft de dobbelsteen het aantal acties vóór de overstroming. Elke aangrenzende oceaankust zonder dijk voegt 1 water toe. Bouw een dijk {p0} voor {p1} met de actie Bouwen. Bij 5 water zinkt een eiland; als 3 eilanden zinken, verliest iedereen. Elke hut op een eiland met 1 / 2 / 3 / 4 water verliest 1 / 3 / 5 / 7 welvaart aan het einde van het spel."
"🏝️ Vanuatu": "🏝️ Vanuatu"
}

View file

@ -224,7 +224,7 @@
"Exporter des marchandises": "Eksportuj towary",
"Exporter gratuitement un second cube identique de la réserve.": "Wyeksportuj za darmo drugi identyczny sześcian z rezerwy.",
"Extend at the start of rounds 2–7, before choosing characters. The next pair is a preview for the following round. There are no tiles to place in round 8.": "Rozbuduj archipelag na początku rund 2–7, przed wyborem postaci. Kolejna para zapowiada następną rundę. W rundzie 8 nie układa się kafelków.",
"Extend the archipelago": "Powiększ archipelag",
"Extend the archipelago": "Rozbudowa archipelagu",
"Faire du commerce": "Handluj",
"Fermer": "Zamknij",
"Fin de partie": "Koniec gry",
@ -850,7 +850,5 @@
"épuisé": "wyczerpany",
"— next catch on this tile": "— następny połów na tym kafelku",
"— prochaine prise sur cette tuile": "— prochaine prise sur cette tuile",
"🏝️ Vanuatu": "🏝️ Vanuatu",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "Chata {p0} kosztuje {p1}. Rysunek {p2} daje {p3}. Przewiezienie turysty {p4} daje {p5} za każdą chatę na tej wyspie, dowolnego koloru. Odpoczynek {p6} pozwala wybrać tajny bonus, rozpatrywany na koniec rundy.",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "W parzystych rundach kość wskazuje liczbę akcji przed powodzią. Każde sąsiadujące wybrzeże oceanu bez wału dodaje 1 wodę. Zbuduj wał {p0} za {p1} akcją Budowy. Przy 5 wodach wyspa tonie; jeśli zatoną 3 wyspy, wszyscy przegrywają. Każda chata na wyspie z 1 / 2 / 3 / 4 wodami traci 1 / 3 / 5 / 7 dobrobytu na koniec gry."
"🏝️ Vanuatu": "🏝️ Vanuatu"
}

View file

@ -224,7 +224,7 @@
"Exporter des marchandises": "Exportar mercadorias",
"Exporter gratuitement un second cube identique de la réserve.": "Exportar gratuitamente um segundo cubo idêntico da reserva.",
"Extend at the start of rounds 2–7, before choosing characters. The next pair is a preview for the following round. There are no tiles to place in round 8.": "Expanda no início das rodadas 2–7, antes de escolher personagens. O próximo par é uma prévia da rodada seguinte. Não há peças para colocar na rodada 8.",
"Extend the archipelago": "Estender o arquipélago",
"Extend the archipelago": "Expandir o arquipélago",
"Faire du commerce": "Comerciar",
"Fermer": "Fechar",
"Fin de partie": "Fim de jogo",
@ -850,7 +850,5 @@
"épuisé": "esgotado",
"— next catch on this tile": "— próxima captura neste tile",
"— prochaine prise sur cette tuile": "— próxima pesca nesta peça",
"🏝️ Vanuatu": "🏝️ Vanuatu",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "Uma cabana {p0} custa {p1}. Um desenho {p2} rende {p3}. Transportar um turista {p4} rende {p5} por cada cabana naquela ilha, de qualquer cor. Descansar {p6} permite escolher um bônus secreto, resolvido no fim da rodada.",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "Em rodadas pares, o dado determina o número de ações antes da inundação. Cada costa oceânica adjacente sem dique adiciona 1 água. Construa um dique {p0} por {p1} com a ação Construir. Com 5 águas uma ilha afunda; se 3 ilhas afundarem, todos perdem. Cada cabana em uma ilha com 1 / 2 / 3 / 4 águas perde 1 / 3 / 5 / 7 de prosperidade no fim do jogo."
"🏝️ Vanuatu": "🏝️ Vanuatu"
}

View file

@ -224,7 +224,7 @@
"Exporter des marchandises": "Exportă bunuri",
"Exporter gratuitement un second cube identique de la réserve.": "Exportă gratuit un al doilea cub identic din rezervă.",
"Extend at the start of rounds 2–7, before choosing characters. The next pair is a preview for the following round. There are no tiles to place in round 8.": "Extinde la începutul rundelor 2–7, înainte de alegerea personajelor. Perechea următoare anunță runda viitoare. În runda 8 nu se plasează plăci.",
"Extend the archipelago": "Extinde arhipelagul",
"Extend the archipelago": "Extinderea arhipelagului",
"Faire du commerce": "Fă comerț",
"Fermer": "Închide",
"Fin de partie": "Sfârșitul partidei",
@ -850,7 +850,5 @@
"épuisé": "epuizat",
"— next catch on this tile": "— următoarea captură pe această piesă",
"— prochaine prise sur cette tuile": "— următoarea captură pe această piesă",
"🏝️ Vanuatu": "🏝️ Vanuatu",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "O colibă {p0} costă {p1}. Un desen {p2} aduce {p3}. Transportarea unui turist {p4} aduce {p5} pentru fiecare colibă de pe acea insulă, de orice culoare. Odihna {p6} îți permite să alegi un bonus secret, rezolvat la sfârșitul rundei.",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "În rundele pare, zarul indică numărul de acțiuni înainte de inundație. Fiecare coastă adiacentă unui ocean și fără dig adaugă 1 apă. Construiește un dig {p0} pentru {p1} cu acțiunea Construire. La 5 ape, o insulă se scufundă; dacă 3 insule se scufundă, toată lumea pierde. Fiecare colibă de pe o insulă cu 1 / 2 / 3 / 4 ape pierde 1 / 3 / 5 / 7 prosperitate la sfârșitul jocului."
"🏝️ Vanuatu": "🏝️ Vanuatu"
}

View file

@ -224,7 +224,7 @@
"Exporter des marchandises": "Экспортировать товары",
"Exporter gratuitement un second cube identique de la réserve.": "Бесплатно экспортируйте второй такой же куб из резерва.",
"Extend at the start of rounds 2–7, before choosing characters. The next pair is a preview for the following round. There are no tiles to place in round 8.": "Расширяйте архипелаг в начале раундов 2–7, до выбора персонажей. Следующая пара предназначена для будущего раунда. В раунде 8 плитки не размещаются.",
"Extend the archipelago": "Расширить архипелаг",
"Extend the archipelago": "Расширение архипелага",
"Faire du commerce": "Торговать",
"Fermer": "Закрыть",
"Fin de partie": "Конец партии",
@ -850,7 +850,5 @@
"épuisé": "исчерпано",
"— next catch on this tile": "— следующий улов на этом тайле",
"— prochaine prise sur cette tuile": "— следующий улов на этой клетке",
"🏝️ Vanuatu": "🏝️ Вануату",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "Хижина {p0} стоит {p1}. Рисунок {p2} приносит {p3}. Перевозка туриста {p4} приносит {p5} за каждую хижину на этом острове, любого цвета. Отдых {p6} позволяет выбрать секретный бонус, который разыгрывается в конце раунда.",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "В чётных раундах кубик указывает количество действий до наводнения. Каждое прилегающее к океану побережье без дамбы добавляет 1 воду. Построй дамбу {p0} за {p1} действием «Строительство». При 5 водах остров тонет; если затонут 3 острова, все проигрывают. Каждая хижина на острове с 1 / 2 / 3 / 4 водами теряет 1 / 3 / 5 / 7 процветания в конце игры."
"🏝️ Vanuatu": "🏝️ Вануату"
}

View file

@ -850,7 +850,5 @@
"épuisé": "đã cạn kiệt",
"— next catch on this tile": "— giá trị mẻ cá tiếp theo trên ô này",
"— prochaine prise sur cette tuile": "— mẻ cá tiếp theo trên ô này",
"🏝️ Vanuatu": "🏝️ Vanuatu",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "Một cái chòi {p0} tốn {p1}. Một bức vẽ {p2} kiếm được {p3}. Vận chuyển một du khách {p4} kiếm được {p5} cho mỗi chòi trên đảo đó, bất kể màu nào. Nghỉ ngơi {p6} cho phép bạn chọn một phần thưởng bí mật, được giải quyết vào cuối vòng.",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "Ở các vòng chẵn, xúc xắc cho biết số hành động trước khi ngập lụt. Mỗi bờ biển liền kề đại dương không có đê sẽ thêm 1 nước. Hãy xây đê {p0} với giá {p1} bằng hành động Xây dựng. Khi đạt 5 nước, một hòn đảo bị chìm; nếu 3 hòn đảo bị chìm, mọi người đều thua. Mỗi túp lều trên đảo có 1 / 2 / 3 / 4 nước sẽ mất 1 / 3 / 5 / 7 thịnh vượng khi kết thúc ván."
"🏝️ Vanuatu": "🏝️ Vanuatu"
}

View file

@ -850,7 +850,5 @@
"épuisé": "已枯竭",
"— next catch on this tile": "— 此板塊下次捕魚的價值",
"— prochaine prise sur cette tuile": "— 此板塊的下次漁獲",
"🏝️ Vanuatu": "🏝️ Vanuatu",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.": "一間小屋 {p0} 花費 {p1}。一幅沙畫 {p2} 獲得 {p3}。運送一位遊客 {p4} 為該島上每間小屋(任何顏色)獲得 {p5}。休息 {p6} 讓你選擇一個秘密獎勵,在回合結束時結算。",
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.": "在偶數回合,骰子決定洪水前的行動次數。每個沒有堤防的相鄰海岸加1點水量。使用建造行動建造堤防 {p0},花費 {p1}。水量達5時島嶼沉沒;若有3座島嶼沉沒,所有人落敗。遊戲結束時,水量為1 / 2 / 3 / 4的島嶼上每間小屋損失1 / 3 / 5 / 7點繁榮。"
"🏝️ Vanuatu": "🏝️ Vanuatu"
}

View file

@ -1,3 +1,4 @@
import { chapterMetadata } from "./tutorials.js";
import { mountLocalization } from "./localization/index.js";
import { mountLesson } from "./tutorial-mount.js";
import "./style.css";
@ -9,7 +10,7 @@ const localization = mountLocalization(
params.get("locale") ?? "en",
);
if (params.has("lesson")) {
const names = ["planning", "fishing", "islands"];
const names = chapterMetadata.map((chapter) => chapter.id);
const chapter = params.get("lesson");
const next = names[names.indexOf(chapter) + 1];
await mountLesson(document.querySelector("#game"), {
@ -17,9 +18,10 @@ if (params.has("lesson")) {
chapter,
nextChapter: next
? {
title: next,
title: chapterMetadata.find((chapter) => chapter.id === next).title,
open: () => {
location.search = "?lesson=" + next;
location.search =
"?lesson=" + next + "&locale=" + (params.get("locale") ?? "en");
},
}
: undefined,

View file

@ -1,3 +1,11 @@
import {
EXTEND_TITLE,
EXTEND_RULE,
ROUND_TITLE,
ROUND_HELP,
FIRST_HELP,
RETRIEVE_HELP,
} from "./learning.js";
import {
icon as renderIcon,
token as renderToken,
@ -20,6 +28,20 @@ export function rulesHtml(lang = "en") {
[icon("point"), token("coin", 10), token("point", 5)],
),
],
[ROUND_TITLE, ROUND_HELP],
["First player", FIRST_HELP],
[EXTEND_TITLE, EXTEND_RULE],
[
"Characters",
message(
"Each character improves one action, once per round. Choose your next character before returning your old one; you cannot keep the same character for consecutive rounds. Treasures {p0} may be sold at any time for their value in {p1}.",
[icon("explore"), icon("coin")],
),
],
[
"Five markers, up to five actions",
"You may place one marker on each of five different actions and perform all five this round, if each is possible. Stacking markers improves your majority, not the number of times you act. Place them in three passes: 2, 2, then 1.",
],
[
"Plan, then act",
message(
@ -27,6 +49,15 @@ export function rulesHtml(lang = "en") {
[icon("first")],
),
],
[
"Two markers beat one",
"If you have 1 marker on Fish and Maya has 2, Maya can fish before you. Your marker stays there. After she fishes and removes both her markers, you may fish on a later turn if you then have the majority and fish remain.",
],
[
"When you cannot act",
"If you cannot afford Build yet, you can choose another action where you have the majority and keep Build for later. Resolving Build now means retrieving its markers without building. If you have no majority anywhere, you must retrieve one stack without acting. When resolving an action you can perform, you must perform it.",
],
["Retrieve markers", RETRIEVE_HELP],
[
"Be in the right place",
message(
@ -52,7 +83,7 @@ export function rulesHtml(lang = "en") {
[
"Develop the islands",
message(
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour. Rest {p6} lets you choose a secret bonus, resolved at the end of the round.",
"A hut {p0} costs {p1}. A drawing {p2} earns {p3}. Transporting a tourist {p4} earns {p5} for every hut on that island, of any colour.",
[
icon("build"),
token("coin", 3),
@ -60,16 +91,32 @@ export function rulesHtml(lang = "en") {
token("point", 3),
icon("tourist"),
token("coin", 1),
icon("rest"),
],
),
],
[
"Characters",
message(
"Each character improves one action, once per round. Choose your next character before returning your old one; you cannot keep the same character for consecutive rounds. Treasures {p0} may be sold at any time for their value in {p1}.",
[icon("explore"), icon("coin")],
),
"Rest",
esc(
t(
"Secretly choose one of the remaining Rest tokens. Receive its bonus at the end of the round:",
),
) +
'<span class="rest-bonuses" role="list">' +
[
icon("first") + " " + esc(t("First player")),
token("coin", 1) + " " + esc(t("Vatu")),
token("point", 1) + " " + esc(t("Prosperity")),
token("coin", 1) +
" " +
esc(t("Vatu")) +
" + " +
token("point", 1) +
" " +
esc(t("Prosperity")),
]
.map((bonus) => '<span role="listitem">' + bonus + "</span>")
.join("") +
"</span>",
],
[
"Final scoring",
@ -90,12 +137,36 @@ export function rulesHtml(lang = "en") {
`Place 2, then 3 neutral markers before choosing characters. You must also beat the neutral stack to act; the matching character lets you tie it. Available characters change each round. Boats cannot end their movement on the same space.`,
],
[
"Rising Waters",
message(
"On even rounds, the die gives the number of actions before flooding. Every adjacent ocean coast without a dike adds 1 water. Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.",
[icon("dike"), token("coin", 1)],
),
"Rising Waters (expansion only)",
[
esc(
t(
"In rounds 2, 4, 6 and 8, a die rolled at the start of the round sets a countdown. During the action phase, each performed action reduces it by 1. At 0, the waters rise immediately after that action, before the next player acts.",
),
),
esc(
t(
"Add 1 water marker to each island for each side adjacent to an Ocean tile without a dike on that side. Sides facing empty board spaces do not count.",
),
),
message(
"Build a dike {p0} for {p1} with the Build action. At 5 waters an island sinks; if 3 islands sink, everyone loses. Each hut on an island with 1 / 2 / 3 / 4 waters loses 1 / 3 / 5 / 7 prosperity at game end.",
[icon("dike"), token("coin", 1)],
),
].join("<br><br>"),
],
];
return `<div class="rules">${paragraphs.map(([h, p]) => `<section><h3>${esc(t(h))}</h3><p translate="no">${p.includes("<") ? p : esc(t(p))}</p></section>`).join("")}</div><p class="rules-links"><a href="https://www.quined.nl/wp-content/uploads/2019/01/Vanuatu_Rulebook_${lang === "fr" ? "FR-WEBversion" : "UK_WEBversion-4"}.pdf" target="_blank" rel="noopener">${esc(t("Original rulebook"))} ↗</a> · <a href="https://quined.nl/wp-content/uploads/2017/06/Vanuatu2p_EN.pdf" target="_blank" rel="noopener">${esc(t("Two-player rules"))} ↗</a></p>`;
const sectionIcons = {
"First player": "first",
[EXTEND_TITLE]: "overview",
"Five markers, up to five actions": "marker",
"Retrieve markers": "undo",
"Be in the right place": "sail",
Trade: "sell",
"Develop the islands": "build",
Rest: "rest",
"Final scoring": "point",
"Rising Waters (expansion only)": "water",
};
return `<div class="rules">${paragraphs.map(([h, p]) => `<section><h3>${sectionIcons[h] ? icon(sectionIcons[h]) + " " : ""}${esc(t(h))}</h3><p translate="no">${p.includes("<") ? p : esc(t(p))}</p></section>`).join("")}</div><p class="rules-links"><a href="https://www.quined.nl/wp-content/uploads/2019/01/Vanuatu_Rulebook_${lang === "fr" ? "FR-WEBversion" : "UK_WEBversion-4"}.pdf" target="_blank" rel="noopener">${esc(t("Original rulebook"))} ↗</a> · <a href="https://quined.nl/wp-content/uploads/2017/06/Vanuatu2p_EN.pdf" target="_blank" rel="noopener">${esc(t("Two-player rules"))} ↗</a></p>`;
}

View file

@ -247,13 +247,13 @@
box-shadow: inset 3px 0 #ae793f;
}
.vanuatu .action-dock .retrieve-only {
background: #eeece1;
box-shadow: inset 3px 0 #8c9890;
background: #fff0d8;
box-shadow: inset 3px 0 #ad5d16;
}
.vanuatu .retrieve-only-icon .icon {
width: 14px;
height: 14px;
color: #697e74;
width: 17px;
height: 17px;
color: #ad5d16;
}
.vanuatu .action-dock .chosen {
background: #f5d99f;
@ -310,7 +310,7 @@
position: relative;
width: 100%;
overflow: auto;
overscroll-behavior: contain;
overscroll-behavior: auto;
scrollbar-width: thin;
min-height: 490px;
height: min(69vh, 740px);
@ -991,7 +991,7 @@
padding: 12px 20px;
height: 100%;
overflow: auto;
overscroll-behavior: contain;
overscroll-behavior: auto;
scrollbar-width: thin;
list-style: none;
}
@ -1047,7 +1047,7 @@
flex: 1;
max-height: none;
min-height: 0;
overscroll-behavior: contain;
overscroll-behavior: auto;
}
.vanuatu .chat-panel input {
background: #fffdf5;
@ -1249,7 +1249,7 @@ body:has(.vanuatu) {
box-shadow: inset 0 3px #ae793f;
}
.vanuatu .action-dock .retrieve-only {
box-shadow: inset 0 3px #8c9890;
box-shadow: inset 0 3px #ad5d16;
}
.vanuatu .action-dock .chosen {
box-shadow:
@ -1548,3 +1548,80 @@ body:has(.vanuatu) {
min-height: 40px;
}
}
.vanuatu .expand-help {
flex-basis: 100%;
margin: 4px 0;
font-size: 12px;
line-height: 1.45;
}
.vanuatu .expand-help summary {
cursor: pointer;
padding: 6px 0;
}
.vanuatu .retrieval-help {
flex-basis: 100%;
margin: 4px 0;
font-size: 12px;
line-height: 1.5;
}
.vanuatu .event-list .round-divider {
margin-top: 12px;
padding: 8px 0;
border-bottom: 1px solid var(--line);
border-top: 1px solid var(--line);
}
.vanuatu .event-character {
width: 32px;
height: 40px;
object-fit: cover;
border-radius: 4px;
}
.vanuatu .event-tile {
width: 82px;
display: inline-flex;
}
.vanuatu .event-tile svg {
width: 100%;
height: 72px;
}
.vanuatu .event-explanation {
flex-basis: 100%;
font-size: 11px;
line-height: 1.4;
}
.vanuatu .event-list li {
flex-wrap: wrap;
}
.vanuatu .retrieve-warning {
background: #fff0d8;
border: 2px solid #ad5d16;
color: #743d0d;
font-weight: 700;
}
.vanuatu .retrieve-warning:hover:not(:disabled) {
background: #ffe0ac;
}
.vanuatu .retrieval-tray {
border-left: 4px solid #ad5d16;
}
.vanuatu .retrieval-tray .tray-title {
color: #743d0d;
}
.vanuatu .rest-bonuses {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 8px;
}
.vanuatu .rest-bonuses > span {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 6px 10px;
border: 1px solid var(--line);
border-radius: 999px;
background: #f0eddd;
}

56
viewer/tutorial-copy.js Normal file
View file

@ -0,0 +1,56 @@
export const LESSON = {
character:
"Choose a character. Its bonus can be used once this round. Next round, choose a new character before returning this one.",
fishingStart:
"Your markers are already placed for this route: sail to the fish, catch them, then sell beside your hut. Watch your vatus and the fish price.",
fishingHold:
"The catch is now in your hold, not money yet. Your boat is beside your hut, so you can sell it. Without your own hut here, you would need to sail elsewhere.",
islandStart:
"You are the Builder and your boat is beside the island. Turn your 3 vatus into a hut, then add a drawing and a tourist.",
usedCharacter:
"The Builder saved you 2 vatus and is now used for this round. Other players can also develop this island: huts belong to players, but drawings and tourists stay on the island.",
tradeStart:
"Explore the wreck, sell its treasure, then compare two exports: with or without completing a ship.",
explore:
"Explore this wreck. Take treasure worth 2; only 1 treasure marker will remain on this sea tile.",
keepTreasure:
"Treasures can be kept for twice their value in prosperity at game end, or sold at any time for their value in vatus. Selling uses no action marker.",
sellTreasure:
"You have 1 vatu. Sell your treasure for 2 more to afford the beef export, which costs 3.",
export:
"Export beef from the island beside your boat. It costs 3 vatus and earns 5 prosperity. It also fills the ship's last space for 2 extra prosperity.",
tradeDone:
"You earned 7 prosperity from one export. Goods fill the first ship that needs them. Completed ships are replaced at the start of the next round.",
tradeCompare:
"Copra costs 2 vatus and earns 3 prosperity. It goes to the second ship, which still needs beef: no completion bonus. Beef costs 3 vatus and fills the first ship's last space: 5 prosperity + 2 for completing the ship = 7.",
tradeChoose:
"Export copra or beef from the island beside your boat. Compare the cost and prosperity shown before confirming your choice.",
tradeIncomplete:
"You earned 3 prosperity for the copra. The second ship still needs beef, so you received no completion bonus. Completing a ship adds 2 prosperity to the exported good's usual reward. Try the lesson again with beef to see the difference.",
restStart:
"Rest lets you choose a secret bonus. You receive it at the end of the round, after all action markers have been removed.",
restChoice:
"Choose the First player token. The other bonuses are 1 vatu, 1 prosperity, or both.",
extendStart:
"Round 2 has begun. You hold the First player marker, so you place the new tiles. The other players wait during this step.",
extendCharacter:
"The map is ready. Choose your character for this round. The newly revealed pair of tiles is a preview for the next round.",
waterStart:
"This optional expansion adds dikes and flooding. Protect the islands together: if three sink, everyone loses. Otherwise, prosperity still decides the winner.",
waterCountdown:
"This position starts in round 4 with 3 actions before flooding. The starting island already has 3 water markers and one dike. Build before the countdown reaches zero.",
waterBuild:
"On the starting island, build a hut and a dike together for 4 vatus. Place the new dike towards the sea tile with fish value 2, where your boat is.",
waterCoasts:
"Two coasts are now protected. Only the side towards the sea tile with the other boats remains exposed. Each unprotected side touching a sea tile adds 1 water; empty board spaces add none.",
waterFish:
"Fish once. The countdown falls from 2 to 1. Only performed actions count: retrieving markers without acting does not advance it.",
waterTourist:
"Bring a tourist to the starting island. This is the last action before flooding: the waters rise immediately afterwards, before the next player acts.",
waterResult:
"Your island gained 1 water and survived at 4. The other island reached 5 and sank: its huts, goods, drawings and tourists were removed. A submerged island is inaccessible.",
waterScoring:
"If three islands sink, everyone loses. At game end, each hut on an island with 1 / 2 / 3 / 4 water loses 1 / 3 / 5 / 7 prosperity, in addition to normal scoring.",
waterDone:
"A dike protects one coast, not the whole island. Existing water stays. Watch both the countdown and the exposed coasts before spending your Build action.",
};

View file

@ -1,23 +1,41 @@
import { LESSON } from "./tutorial-copy.js";
import { FIRST_HELP } from "./learning.js";
import {
EXTEND_TITLE,
EXTEND_WHO,
EXTEND_HOW,
EXTEND_WHEN,
REMAINING_TILES,
} from "./learning.js";
import * as E from "../engine/index.js";
export const chapterMetadata = [
{
id: "planning",
version: 2,
version: 4,
title: "Plan your day",
description: "Place five markers and understand action majorities.",
},
{
id: "fishing",
version: 1,
version: 2,
title: "From sea to market",
description: "Sail, fish and sell your catch beside your hut.",
},
{
id: "islands",
version: 1,
version: 2,
title: "An island economy",
description: "Build a hut, draw in the sand and welcome a tourist.",
},
{ id: "trade", version: 2, title: "Trade", description: LESSON.tradeStart },
{ id: "rest", version: 1, title: "Rest", description: LESSON.restStart },
{ id: "expansion", version: 2, title: EXTEND_TITLE, description: EXTEND_WHO },
{
id: "rising-waters",
version: 1,
title: "Rising Waters (expansion only)",
description: LESSON.waterStart,
},
];
function prepared(phase = "actions") {
const s = E.init(3, [], {}, "vanuatu-lesson");
@ -39,30 +57,117 @@ function prepared(phase = "actions") {
s.tourists = 2;
return s;
}
function play(s, m) {
function play(s, m, opponentMove = E.moveAI) {
let next = E.move(s, m, 0),
n = 0;
while (!next.finished && next.actor !== 0 && n++ < 100)
next = E.moveAI(next, next.actor);
next = opponentMove(next, next.actor);
return next;
}
// Demonstrate several stacks and useful action sequences instead of the general
// bot's scoring strategy. Pick only legal moves so the player's choices stay free.
const planningOpponents = {
1: {
characters: ["fisherman", "navigator"],
passes: [["fish", "sail"], ["fish", "draw"], ["rest"]],
actions: ["fish", "sail", "draw", "rest"],
},
2: {
characters: ["diver", "builder"],
passes: [["explore", "build"], ["explore", "tourist"], ["rest"]],
actions: ["explore", "build", "tourist", "rest"],
},
};
function planningOpponent(s, p) {
if (s.round !== 1) return E.moveAI(s, p);
const script = planningOpponents[p];
const legal = E.availableMoves(s, p);
let selected;
if (s.phase === "character")
selected = script.characters
.map((character) => legal.find((m) => m.character === character))
.find(Boolean);
else if (s.phase === "plan")
selected = legal.find(
(m) =>
m.type === "plan" &&
m.actions.join() === script.passes[s.planningPass].join(),
);
else if (s.phase === "actions")
selected = script.actions
.map((action) =>
legal.find(
(m) =>
m.type === "act" &&
m.action === action &&
(action !== "sail" || m.path.length === 1),
),
)
.find(Boolean);
return selected ? E.move(s, selected, p) : E.moveAI(s, p);
}
const planCount = (s) =>
Object.values(s.players[0].markers).reduce((a, b) => a + b, 0);
const only = (action) => (s, m) =>
m.action === action ? undefined : `Choose ${action} for this step.`;
export const chapters = {
expansion: {
game: "vanuatu",
id: "expansion",
version: 2,
initialState: () => {
const s = prepared("expand");
s.round = 2;
return s;
},
move: (s, m) => E.move(s, m, 0),
steps: [
{ id: "round", title: EXTEND_TITLE, text: LESSON.extendStart },
{
id: "first-tile",
title: EXTEND_TITLE,
text: EXTEND_HOW,
complete: (s) => s.upcoming.length === 1,
validateMove: (s, m) => (m.type === "place" ? undefined : EXTEND_HOW),
},
{
id: "second-tile",
title: REMAINING_TILES,
text: EXTEND_WHO,
complete: (s) => s.phase !== "expand",
validateMove: (s, m) => (m.type === "place" ? undefined : EXTEND_HOW),
},
{
id: "character",
title: "Choose a character",
text: LESSON.extendCharacter,
complete: (s) => !!s.players[0].character,
validateMove: (s, m) =>
m.type === "character" ? undefined : LESSON.extendCharacter,
},
],
completion: { title: EXTEND_TITLE, text: EXTEND_WHEN },
},
planning: {
game: "vanuatu",
id: "planning",
version: 2,
version: 4,
initialState: () => {
const s = prepared("plan");
s.characters = [];
s.options.characters = false;
const s = prepared("character");
s.players[1].boat = "1,0";
s.players[2].boat = "0,1";
return s;
},
move: play,
move: (s, m) => play(s, m, planningOpponent),
steps: [
{
id: "character",
title: "Choose a character",
text: LESSON.character,
complete: (s) => s.phase === "plan",
validateMove: (s, m) =>
m.type === "character" ? undefined : LESSON.character,
},
{
id: "five-actions",
title: "Five markers, up to five actions",
@ -124,7 +229,7 @@ export const chapters = {
fishing: {
game: "vanuatu",
id: "fishing",
version: 1,
version: 2,
initialState: () => {
const s = prepared();
s.board["0,0"].huts = [0];
@ -138,6 +243,7 @@ export const chapters = {
},
move: play,
steps: [
{ id: "route", title: "From sea to market", text: LESSON.fishingStart },
{
id: "sail",
title: "Find a fishing ground",
@ -155,6 +261,7 @@ export const chapters = {
complete: (s) => s.players[0].fish.includes(2),
validateMove: only("fish"),
},
{ id: "hold", title: "Fish in hold", text: LESSON.fishingHold },
{
id: "sell",
title: "Sell your catch",
@ -171,7 +278,7 @@ export const chapters = {
islands: {
game: "vanuatu",
id: "islands",
version: 1,
version: 2,
initialState: () => {
const s = prepared();
s.players[0].character = "builder";
@ -181,6 +288,7 @@ export const chapters = {
},
move: play,
steps: [
{ id: "route", title: "An island economy", text: LESSON.islandStart },
{
id: "hut",
title: "Build a beach hut",
@ -191,6 +299,11 @@ export const chapters = {
? undefined
: "Build a hut with the Builder bonus enabled.",
},
{
id: "shared-island",
title: "Character bonus",
text: LESSON.usedCharacter,
},
{
id: "drawing",
title: "Draw in the sand",
@ -211,4 +324,174 @@ export const chapters = {
text: "Prosperity comes from trade, drawings, characters and endgame scoring. Keep enough vatus to fund the actions you plan.",
},
},
trade: {
game: "vanuatu",
id: "trade",
version: 2,
initialState: () => {
const s = prepared();
s.players[0].boat = "0,1";
s.players[0].money = 1;
for (const a of ["explore", "buy", "rest"]) s.players[0].markers[a] = 1;
s.demands[0] = {
id: 10,
goods: ["kava", "copra", "beef"],
filled: [true, true, false],
};
s.demands[1] = {
id: 3,
goods: ["beef", "beef", "copra"],
filled: [false, false, false],
};
return s;
},
move: play,
steps: [
{ id: "route", title: "Trade", text: LESSON.tradeStart },
{
id: "explore",
title: "Explore",
text: LESSON.explore,
complete: (s) => s.players[0].treasures.includes(2),
validateMove: only("explore"),
},
{ id: "choice", title: "Explore", text: LESSON.keepTreasure },
{
id: "sell-treasure",
title: "Sell treasures",
text: LESSON.sellTreasure,
complete: (s) => s.players[0].money === 3,
validateMove: (s, m) =>
m.type === "treasure" ? undefined : LESSON.sellTreasure,
},
{ id: "compare", title: "Export", text: LESSON.tradeCompare },
{
id: "export",
title: "Export",
text: LESSON.tradeChoose,
complete: (s) => s._history.some((h) => h.move.action === "buy"),
validateMove: (s, m) =>
m.action === "buy" && ["copra", "beef"].includes(m.good)
? undefined
: LESSON.tradeChoose,
},
],
completion: {
title: "Trade",
text: (s) =>
s.players[0].score === 7 ? LESSON.tradeDone : LESSON.tradeIncomplete,
},
},
rest: {
game: "vanuatu",
id: "rest",
version: 1,
initialState: () => {
const s = prepared();
s.first = 1;
s.players[0].markers.rest = 1;
return s;
},
move: play,
steps: [
{ id: "bonus", title: "Rest", text: LESSON.restStart },
{
id: "rest",
title: "Rest",
text: LESSON.restStart,
complete: (s) => s.phase === "rest",
validateMove: only("rest"),
},
{
id: "token",
title: "Choose a rest token",
text: LESSON.restChoice,
complete: (s) => s.round === 2 && s.first === 0,
validateMove: (s, m) =>
m.type === "rest" && m.token === "first"
? undefined
: LESSON.restChoice,
},
],
completion: { title: "First player", text: FIRST_HELP },
},
"rising-waters": {
game: "vanuatu",
id: "rising-waters",
version: 1,
initialState: () => {
const s = prepared();
s.options.risingWaters = true;
s.round = 4;
s.waterCountdown = 3;
s.players[0].boat = "1,0";
s.players[0].money = 4;
for (const a of ["build", "fish", "tourist", "sail", "rest"])
s.players[0].markers[a] = 1;
s.board["0,0"].water = 3;
s.board["0,0"].dikes = ["0,1"];
s.board["2,1"] = E.tileState("a1");
Object.assign(s.board["2,1"], {
water: 4,
huts: [1],
tourists: 1,
drawings: 1,
});
s.players[1].hutsLeft = 7;
s.dikesLeft = 19;
return s;
},
move: play,
steps: [
{
id: "expansion",
title: "Rising Waters (expansion only)",
text: LESSON.waterStart,
},
{
id: "timing",
title: "How a round works",
text: "In rounds 2, 4, 6 and 8, a die rolled at the start of the round sets a countdown. During the action phase, each performed action reduces it by 1. At 0, the waters rise immediately after that action, before the next player acts.",
},
{
id: "countdown",
title: "Actions until the waters rise",
text: LESSON.waterCountdown,
},
{
id: "dike",
title: "Build",
text: LESSON.waterBuild,
complete: (s) =>
s.board["0,0"].dikes.includes("1,0") &&
s.board["0,0"].huts.includes(0),
validateMove: (s, m) =>
m.action === "build" && m.cell === "0,0" && m.hut && m.dike === "1,0"
? undefined
: LESSON.waterBuild,
},
{ id: "coasts", title: "Dike", text: LESSON.waterCoasts },
{
id: "fish",
title: "Catch the fish",
text: LESSON.waterFish,
complete: (s) => s.waterCountdown === 1,
validateMove: only("fish"),
},
{
id: "tourist",
title: "Welcome a visitor",
text: LESSON.waterTourist,
complete: (s) => s.waterTriggered,
validateMove: (s, m) =>
m.action === "tourist" && m.cell === "0,0"
? undefined
: LESSON.waterTourist,
},
{ id: "flood", title: "Rising Waters", text: LESSON.waterResult },
{ id: "score", title: "Final scoring", text: LESSON.waterScoring },
],
completion: { title: "Rising Waters", text: LESSON.waterDone },
},
};

View file

@ -1,3 +1,6 @@
import { blockingHtml, blockingText } from "./blocking.js";
import { FIRST_HELP, RETRIEVE_HELP } from "./learning.js";
import { EXTEND_WHO, EXTEND_HOW, REMAINING_TILES } from "./learning.js";
import morphdom from "morphdom";
import {
ACTIONS,
@ -18,7 +21,11 @@ import { translator, characterHelp } from "./labels.js";
import { mountActivity } from "./activity.js";
import { rulesHtml } from "./rules.js";
import { createMoveSound } from "./sound.js";
import { languages, resolveLocale } from "./localization/index.js";
import {
languages,
resolveLocale,
translateText,
} from "./localization/index.js";
const total = (a) => a.reduce((a, b) => a + b, 0);
const unique = (a) => [...new Set(a)];
function coastArrow(cell, edge) {
@ -27,6 +34,20 @@ function coastArrow(cell, edge) {
angle = (Math.atan2(b.y - a.y, b.x - a.x) * 180) / Math.PI;
return `<svg class="icon" viewBox="0 0 32 32" role="img" aria-label="Coast"><path d="M6 16h20m-8-8 8 8-8 8" fill="none" stroke="currentColor" stroke-width="2.5" transform="rotate(${angle} 16 16)"/></svg>`;
}
const actionHelp = {
sail: "Sail 1–3 ocean spaces, paying 1 vatu per space.",
fish: "Take a fish tile from your ocean space. Its value equals the fish remaining there.",
explore:
"Take a treasure tile from your ocean space. Treasures can be sold for vatus or kept for final scoring.",
sell: "Sell fish beside one of your huts at the current market price. The price then falls by 1.",
build:
"Build a hut on an adjacent island for 3 vatus. Each hut scores 2 prosperity per tourist at game end.",
buy: "Export a good from an adjacent island to a ship that needs it. Pay 1/2/3 vatus for kava/copra/beef and earn 1/3/5 prosperity.",
draw: "Make a sand drawing on an adjacent island to earn 3 prosperity.",
tourist:
"Bring a tourist to an adjacent island and earn 1 vatu for every hut there, of any colour.",
rest: "Choose a rest token. Its bonus is resolved at the end of the round.",
};
const symbols = ["●", "◆", "▲", "■", "✦"];
export function mountGame(target, options = {}) {
const root = document.createElement("div");
@ -120,7 +141,7 @@ export function mountGame(target, options = {}) {
if (m.type === "plan" || m.type === "neutral")
return m.actions.map((a) => icon(a)).join("");
if (m.type === "discard")
return `${icon("undo")} ${"Retrieve without acting"} ${icon(m.action)}`;
return `${icon("warning", "Retrieve without acting")} ${icon(m.action)}`;
if (m.type === "rest") return restContent(m.token);
if (m.type === "governor") return `${icon(m.from)} → ${icon(m.to)}`;
if (m.type === "treasure")
@ -161,8 +182,12 @@ export function mountGame(target, options = {}) {
const idx = (s.legal ?? []).indexOf(m);
return btn(
actionDetail(m),
`data-move="${idx}" ${pending ? "disabled" : ""}`,
primary ? "primary move-option" : "move-option",
`title="${esc(m.type === "discard" ? translateText("Retrieve without acting", lang) : m.action ? translateText(actionHelp[m.action], lang) : t(m.type === "plan" || m.type === "neutral" ? "plan" : m.type))}" data-move="${idx}" ${m.type === "discard" ? `aria-label="${esc(translateText("Retrieve without acting", lang))} — ${esc(translateText(t(m.action), lang))}"` : ""} ${pending ? "disabled" : ""}`,
m.type === "discard"
? "move-option retrieve-warning"
: primary
? "primary move-option"
: "move-option",
);
}
function restContent(key) {
@ -174,7 +199,7 @@ export function mountGame(target, options = {}) {
}
function playerCard(p, i) {
const c = CHARACTERS[p.character];
return `<section class="player-card ${i === s.actor && !s.finished ? "active" : ""} ${i === player ? "own" : ""}" style="--player:${p.color}"><div class="player-name">${btn(`${avatars[i] ? `<img class="player-avatar" src="${esc(avatars[i])}" alt="">` : ""}<span>${colorBlind ? symbols[i] + " " : ""}${esc(p.name)}</span>`, `data-bgs-player="${i}"`, "profile")} ${s.first === i ? icon("first", t("first")) : ""}<strong class="score">${token("point", p.score)}</strong></div><div class="player-supplies">${token("coin", p.money)}<span class="hand" title="${t("fishStock")}">${p.fish.length ? p.fish.map((n) => token("fish", n)).join("") : token("fish", 0)}</span><span class="hand" title="${t("treasure")}">${p.treasures.length ? p.treasures.map((n) => token("explore", n)).join("") : token("explore", 0)}</span>${token("build", p.hutsLeft)}</div>${c ? `<button type="button" class="character-owned ${p.used ? "used" : ""}" data-character="${p.character}"><img src="${assets["character-" + c.art]}" alt=""><span>${charName(p.character)}</span>${p.used ? icon("check") : icon(c.action ?? "point")}</button>` : ""}${i === player ? `<div class="free-actions">${legal().some((m) => m.type === "treasure") ? btn(`${icon("explore")} → ${icon("coin")}`, `data-free="treasure" title="${t("treasure")}"`) : ""}${legal().some((m) => m.type === "beg") ? btn(`${icon("point")} → ${icon("coin")}`, `data-free="beg" title="${t("beg")}"`) : ""}</div>` : ""}</section>`;
return `<section class="player-card ${i === s.actor && !s.finished ? "active" : ""} ${i === player ? "own" : ""}" style="--player:${p.color}"><div class="player-name">${btn(`${avatars[i] ? `<img class="player-avatar" src="${esc(avatars[i])}" alt="">` : ""}<span>${colorBlind ? symbols[i] + " " : ""}${esc(p.name)}</span>`, `data-bgs-player="${i}"`, "profile")} ${s.first === i ? btn(icon("first", translateText(FIRST_HELP, lang)), `data-first-help aria-label="${t("first")}"`, "icon-button") : ""}<strong class="score">${token("point", p.score)}</strong></div><div class="player-supplies">${token("coin", p.money)}<span class="hand" title="${t("fishStock")}">${p.fish.length ? p.fish.map((n) => token("fish", n)).join("") : token("fish", 0)}</span><span class="hand" title="${t("treasure")}">${p.treasures.length ? p.treasures.map((n) => token("explore", n)).join("") : token("explore", 0)}</span>${token("build", p.hutsLeft)}</div>${c ? `<button type="button" class="character-owned ${p.used ? "used" : ""}" data-character="${p.character}"><img src="${assets["character-" + c.art]}" alt=""><span>${charName(p.character)}</span>${p.used ? icon("check") : icon(c.action ?? "point")}</button>` : ""}${i === player ? `<div class="free-actions">${legal().some((m) => m.type === "treasure") ? btn(`${icon("explore")} → ${icon("coin")}`, `data-free="treasure" title="${t("treasure")}"`) : ""}${legal().some((m) => m.type === "beg") ? btn(`${icon("point")} → ${icon("coin")}`, `data-free="beg" title="${t("beg")}"`) : ""}</div>` : ""}</section>`;
}
function dock() {
const planning = ["plan", "neutral"].includes(s.phase) && working().length;
@ -205,21 +230,25 @@ export function mountGame(target, options = {}) {
working().some((m) => m.type === "discard" && m.action === a) &&
!working().some((m) => m.type === "act" && m.action === a);
const explain =
planning &&
s.phase === "plan" &&
!allowed &&
draft.length < (s.planningPass === 2 ? 1 : 2);
const hint = explain
? ({
fish: "Fishing requires fish on your boat's space. Plan Sail first if needed.",
explore:
"Exploring requires treasure on your boat's space. Plan Sail first if needed.",
sell: own()?.fish.length
? undefined
: "Selling requires fish. Plan Fish first if your hold is empty.",
}[a] ??
"This action is not possible with your current resources and planned actions. Plan its prerequisites first.")
: "";
(s.phase === "actions" && own()?.markers[a] > 0 && !allowed) ||
(planning &&
s.phase === "plan" &&
!allowed &&
draft.length < (s.planningPass === 2 ? 1 : 2));
const hint =
explain && s.phase === "actions"
? blockingText(s, player, a, lang)
: explain
? ({
fish: "Fishing requires fish on your boat's space. Plan Sail first if needed.",
explore:
"Exploring requires treasure on your boat's space. Plan Sail first if needed.",
sell: own()?.fish.length
? undefined
: "Selling requires fish. Plan Fish first if your hold is empty.",
}[a] ??
"This action is not possible with your current resources and planned actions. Plan its prerequisites first.")
: "";
const stacks = s.players
.map((p, i) =>
p.markers[a]
@ -228,8 +257,8 @@ export function mountGame(target, options = {}) {
)
.join("");
return btn(
`<span class="action-symbol">${icon(a)}</span><span class="action-content"><span class="action-label">${t(a)}</span><span class="action-stacks">${stacks}${retrieveOnly ? `<span class="retrieve-only-icon">${icon("undo", "Retrieve without acting")}</span>` : ""}${s.neutral[a] ? `<span class="marker-stack neutral" title="${"Neutral markers"}">${s.neutral[a]}</span>` : ""}${countDraft ? `<span class="draft-marker" title="${"Markers being placed"}">+${countDraft}</span>` : ""}</span></span>`,
`data-action="${a}" ${retrieveOnly ? `title="${"Retrieve without acting"}"` : ""} ${allowed ? "" : explain ? `aria-disabled="true" data-unavailable="${esc(hint)}" title="${esc(hint)}"` : "disabled"} aria-pressed="${action === a}"`,
`<span class="action-symbol">${icon(a)}</span><span class="action-content"><span class="action-label">${t(a)}</span><span class="action-stacks">${stacks}${retrieveOnly ? `<span class="retrieve-only-icon">${icon("warning", "Retrieve without acting")}</span>` : ""}${s.neutral[a] ? `<span class="marker-stack neutral" title="${"Neutral markers"}">${s.neutral[a]}</span>` : ""}${countDraft ? `<span class="draft-marker" title="${"Markers being placed"}">+${countDraft}</span>` : ""}</span></span>`,
`data-action="${a}" title="${esc(translateText(actionHelp[a], lang) + (retrieveOnly ? "\n" + translateText("Retrieve without acting", lang) + "\n" + blockingText(s, player, a, lang) : hint ? "\n" + translateText(hint, lang) : ""))}" ${allowed ? "" : explain ? `aria-disabled="true" data-unavailable="${esc(hint)}"` : "disabled"} aria-pressed="${action === a}"`,
`${action === a ? "chosen" : ""} ${allowed ? "available" : ""} ${retrieveOnly ? "retrieve-only" : ""}`,
);
},
@ -270,7 +299,7 @@ export function mountGame(target, options = {}) {
const m = moves.find(
(m) => m.type === "place" && m.tile === tile && m.cell === selected,
);
return `<div class="turn-tray"><div class="tray-title">${t("expand")}</div><div class="tile-choices">${tileChoices.map((id) => btn(`<img src="${assets[TILES[id].art]}" alt="${TILES[id].type === "island" ? t("island") : t("sea")}">`, `data-tile="${id}" aria-pressed="${tile === id}"`)).join("")}</div>${m ? moveButton(m, true) : ""}</div>`;
return `<div class="turn-tray"><div class="tray-title">${t("expand")} <small>${esc(translateText(REMAINING_TILES, lang))}: ${s.upcoming.length}</small></div><details class="expand-help"><summary>${t("help")}</summary><p>${esc(t(EXTEND_WHO))}</p><p>${esc(t(EXTEND_HOW))}</p></details><div class="tile-choices">${tileChoices.map((id) => btn(`<img src="${assets[TILES[id].art]}" alt="${TILES[id].type === "island" ? t("island") : t("sea")}">`, `data-tile="${id}" aria-pressed="${tile === id}"`)).join("")}</div>${m ? moveButton(m, true) : ""}</div>`;
}
if (s.phase === "rest")
return `<div class="turn-tray"><strong>${t("restChoice")}</strong>${moves
@ -303,7 +332,7 @@ export function mountGame(target, options = {}) {
: targets.length && !selected
? `${icon("sail")} ${"Choose a space"}`
: "";
return `<div class="turn-tray"><div class="tray-title">${selectedAction ? `${icon(action)} ${t(action)}` : t("actions")}</div>${hasBonus && hasNormal ? `<label class="bonus-switch" title="${charHelp(own()?.character)}"><input type="checkbox" data-bonus ${bonus ? "checked" : ""}>${charName(own()?.character)}</label>` : ""}<span class="pick-hint">${pickText}</span><div class="move-options">${opts.map((m) => moveButton(m, true)).join("")}${discard ? moveButton(discard) : ""}</div>${governor ? btn(`${icon("marker")} ↔`, `data-governor title="${t("governor")}"`) : ""}${selectedAction ? titled(t("cancel"), icon("close"), "data-cancel", "icon-button") : ""}</div>`;
return `<div class="turn-tray ${discard ? "retrieval-tray" : ""}"><div class="tray-title">${selectedAction ? `${icon(action)} ${t(action)}` : t("actions")}</div>${discard ? `<p class="retrieval-help">${blockingHtml(s, player, action, lang)}<br>${esc(translateText(RETRIEVE_HELP, lang))}</p>` : !selectedAction && moves.some((m) => m.type === "discard") ? `<p class="retrieval-help">${esc(translateText(RETRIEVE_HELP, lang))}</p>` : ""}${hasBonus && hasNormal ? `<label class="bonus-switch" title="${charHelp(own()?.character)}"><input type="checkbox" data-bonus ${bonus ? "checked" : ""}>${charName(own()?.character)}</label>` : ""}<span class="pick-hint">${pickText}</span><div class="move-options">${opts.map((m) => moveButton(m, true)).join("")}${discard ? moveButton(discard) : ""}</div>${governor ? btn(`${icon("marker")} ↔`, `data-governor title="${t("governor")}"`) : ""}${selectedAction ? titled(t("cancel"), icon("close"), "data-cancel", "icon-button") : ""}</div>`;
}
function tradeShips() {
const help = `Foreign trade\n${colorBlind ? "K: kava · C: copra · B: beef." : "Green: kava · White: copra · Red: beef."}\nEach export fills the first ship (1 → 3) still needing that good. ✓ = already delivered.\nCompleting a ship adds 2 prosperity points.`;
@ -473,12 +502,29 @@ export function mountGame(target, options = {}) {
);
return;
}
if ("firstHelp" in d) {
showDialog(
`<h2>${t("first")}</h2><p>${esc(translateText(FIRST_HELP, lang))}</p>`,
);
return;
}
if ("unavailable" in d) {
showDialog(`<h2>${t(d.action)}</h2><p>${esc(d.unavailable)}</p>`);
return;
}
if ("move" in d) {
send(s.legal[Number(d.move)]);
const move = s.legal[Number(d.move)];
if (
move?.type === "discard" &&
!("confirmedRetrieval" in d) &&
legal().some((m) => m.type !== "discard")
) {
showDialog(
`<h2>${icon("warning", "Retrieve without acting")} ${esc(translateText("Retrieve without acting", lang))} — ${esc(translateText(t(move.action), lang))}</h2><p>${esc(translateText("You can still take another action. Retrieve this stack without acting?", lang))}</p><div class="move-options">${btn(t("cancel"), "data-close")}${btn(icon("warning", "Retrieve without acting") + " " + t("confirm"), `data-move="${d.move}" data-confirmed-retrieval`, "retrieve-warning")}</div>`,
);
return;
}
send(move);
return;
}
if ("bgsPlayer" in d) {
@ -593,7 +639,7 @@ export function mountGame(target, options = {}) {
}
if ("help" in d) {
showDialog(
`<h2>${t("help")}</h2><div class="preferences"><label><input type="checkbox" data-pref="colorBlind" ${colorBlind ? "checked" : ""}>${t("colorBlind")}</label><label><input type="checkbox" data-pref="sound" ${sound ? "checked" : ""}>${t("sound")}</label>${
`<h2>${t("help")}</h2><div class="preferences"><label><input type="checkbox" data-pref="sound" ${sound ? "checked" : ""}>${t("sound")}</label>${
hostedLocale
? ""
: `<select data-language aria-label="Language">${Object.entries(