Teach mission planning, preview intended routes and lazy-load locales

This commit is contained in:
coyotte508 2026-10-31 19:53:33 +01:00
parent 6f663893a0
commit b201aceec4
31 changed files with 3537 additions and 1447 deletions

View file

@ -9,7 +9,7 @@
## BGS tables and clock
Read [integration notes](docs/realtime-host.md) before touching lifecycle code. Protocol **0.8** is published; native presence, wakeups and table progress already exist. Do not rebuild them with viewer heartbeat moves.
Read [integration notes](docs/realtime-host.md) before touching lifecycle code. Protocol **0.10.0** is published; native presence, wakeups and table progress already exist. Do not rebuild them with viewer heartbeat moves.
- Preserve `tableMode: "live"`, `timeControl: "engine"`, `rating: "none"`. Readiness expires after two minutes; BGS uses a ten-second launch countdown. Expiry/disconnection before launch returns to waiting, not cancellation. Reconnection during flight does not pause or restart it.
- A campaign stays within one game. **Play again** creates a new game at the same table; only versioned `tableProgress` crosses that boundary. Careers are keyed by account ID, not seat, and remain table-local. Reject unknown checkpoint schemas rather than erasing progress.
@ -19,8 +19,14 @@ Read [integration notes](docs/realtime-host.md) before touching lifecycle code.
## Publication and verification
- GitHub remote: `boardgamers/space-alert`. BGS slug `space-alert`, version **1**, stays **private** until explicitly requested otherwise. Git pushes do not update BGS.
- `npm test`, `npm run build`, then `npm pack`; upload the tarball with entry `bgs/engine.js` and `dist/viewer.js` with global `SpaceAlert`. Follow [README](README.md#build-for-bgs); `bgs/gameinfo.json` is a metadata template, not a snapshot of the deployed package version.
- BGS admin API base: `https://admin.boardgamers.space/api/admin/gameinfo/space-alert`. Load the bearer token from `~/.bgs` without printing it. Read/back up `/1` and `/meta` first; POST the tarball to `/1/engine`, POST the viewer to `/1/viewer/file?filename=viewer.js&bundle=<content-hash>`, then PUT `/1` with the returned asset metadata while preserving unrelated settings. Verify the private flag, clock/table settings and downloaded viewer bytes afterward. Bump the package version for engine changes.
- `npm test`, `npm run build`, then `npm pack`; upload the tarball with entry `bgs/engine.js` and the complete viewer bundle (`dist/viewer.js` plus `dist/locales/*.json`, preserving paths) with global `SpaceAlert`. Follow [README](README.md#build-for-bgs); `bgs/gameinfo.json` is a metadata template, not a snapshot of the deployed package version.
- BGS admin API base: `https://admin.boardgamers.space/api/admin/gameinfo/space-alert`. Load the bearer token from `~/.bgs` without printing it. Read/back up `/1` and `/meta` first; POST the tarball to `/1/engine`, POST each viewer bundle file to `/1/viewer/file?filename=<relative-path>&bundle=<content-hash>`, then PUT `/1` with the returned asset metadata while preserving unrelated settings. Verify the private flag, clock/table settings and downloaded viewer bytes afterward. Bump the package version for engine changes.
- Follow the current [Adding a game guide](https://docs.boardgamers.space/guide/adding-a-game); the sibling monorepo has the same source at `apps/docs/docs/guide/adding-a-game.md`. The public-release checklist is not satisfied merely by this private playtest.
- Stage only `viewer.js` and the current hashed `locales/*.json` in a clean release directory; exclude `viewer-meta.json`. The sibling `scripts/publish-viewer.mjs --game space-alert --version 1 --dir <release> --entry viewer.js --token ~/.bgs --record <backup> --apply --activate` uploads and verifies every file before switching the viewer URL. Do not update only the entry script.
- Publish `version.tutorial` from `bgs/gameinfo.json` with the viewer; IDs and progress versions must match the controller. Use English base titles and empty descriptions, not translated subtitles. In-game translations are authored EN/FR JSON chunks; other BGS locales currently fall back to English.
- `/meta` protects `translations` and `optionTranslations`; round-tripping those fields does not publish them. As in Puerto Rico, use BGS's dedicated `/meta/translate` or `/meta/translate-all` for platform catalog/setup/chapter metadata only, and verify hashes and chapter labels afterward. Do not use translation APIs for authored in-game/tutorial catalogs.
- Upload the original, tightly bounded transparent `bgs/pictogram.svg` with `PUT /assets/pictogram`, content type `image/svg+xml`. The server crops transparent borders and normalizes it. Save only the intended metadata fields (description, etc.), not a stale full metadata snapshot.
- Engine upload immediately changes the requested package; installation/activation is asynchronous. Verify tarball/download integrity and distinguish requested metadata from confirmed activation. Keep `public: false`, `timeControl: "engine"`, `tableMode: "live"`, and `rating: "none"`; never create production test tables or alter existing missions just to check a release.
- Lifecycle changes need multi-client checks: expired readiness, background/disconnected tabs, late commands, reconnect, and Play again with seats reordered/careers retained. Rules tests alone do not validate deployed table behavior or phone audio. Broader expansion playtesting remains necessary before public release.
## BGS publication and Git delivery

View file

@ -2,7 +2,7 @@
A playable local adaptation of **Space Alert** and **The New Frontier**, with a deterministic engine and a French/English browser viewer. Repository: [boardgamers/space-alert](https://github.com/boardgamers/space-alert).
**Status: local playtest, under rules review.** The game runs through programming, ship resolution and scoring. The BGS adapter is implemented and tested against an isolated platform instance. Public release still needs human playtesting.
**Status: private BGS playtest, under rules review.** The game runs through programming, ship resolution and scoring. The BGS adapter is implemented and tested against an isolated platform instance. Public release still needs human playtesting.
## Play locally
@ -13,7 +13,7 @@ npm test
npm run dev
```
Open <http://127.0.0.1:5250>. Start with **Flight school / École de vol**: eight exercises use the real engine. Start with **Planning turns**: one crew member, a highlighted destination, two movement actions, and an empty turn. Choose left, right or a deck change to reach the destination; try the start/pause practice clock, then watch each turn execute. A missed destination can be retried. The later exercises have editable programs and a teammate already maintaining the computer; they cover firing, energy, malfunctions, battlebots/interceptors, double actions, phasing and specializations.
Open <http://127.0.0.1:5250>. Start with **Flight school / École de vol**: nine exercises use the real engine. Start with **Planning turns**: one crew member, a highlighted destination, two movement actions, and an empty turn. Choose left, right or a deck change to reach the destination; start the planning clock, finish early, and watch all three turns execute. A second attempt runs out of time with empty turns. The next chapter reveals a threat, locks the first group at its deadline, then executes the complete seven-turn training mission. A missed destination can be retried. The later exercises have editable programs and a teammate already maintaining the computer; they cover firing, energy, malfunctions, battlebots/interceptors, double actions, phasing and specializations.
For a full mission, expand **Local session / Session locale**. Select 1–5 humans, the crew, mission, threat pools and optional modules. In solo, you control four androids and have access to the full action deck. In multiplayer testing, open another tab with `?seat=1`, etc. Readiness lasts two minutes; everyone must be ready together. The local mission starts after a three-second countdown. If someone misses the window, the crew keeps waiting. Click a card half to fill the next empty editable turn. Click a filled turn to clear it; Backspace undoes your last placement for the selected crew member. Left/right arrow keys queue horizontal movement; up/down queue a deck change, using an available card. Typing in fields is unaffected. Shift-click or Combine retains multi-card selection; then choose a turn. Advance individual phases to lock previous turns, or let the shared clock do so. After programming, the captain can resolve one step at a time or finish the mission; everyone can inspect the replay and log.
@ -68,7 +68,7 @@ npm install --no-save --package-lock=false ../boardgamers-mono/packages/protocol
npm run build
```
Upload the generated engine tarball and `dist/viewer.js` through BGS admin. Use the metadata in [`bgs/gameinfo.json`](bgs/gameinfo.json): engine entry `bgs/engine.js`, viewer global `SpaceAlert`, game-managed time control, and no Elo. Keep the version private during playtesting. BGS assigns uploaded asset URLs; the example intentionally has no viewer URL. See [the integration notes](docs/realtime-host.md) for clock, table and career behavior.
Upload the generated engine tarball and the complete viewer bundle (`dist/viewer.js` plus `dist/locales/*.json`) through BGS admin, keeping their relative paths in the same immutable bundle. The entry point remains `viewer.js`; `viewer-meta.json` is only a local build report. Use the metadata in [`bgs/gameinfo.json`](bgs/gameinfo.json): engine entry `bgs/engine.js`, viewer global `SpaceAlert`, game-managed time control, and no Elo. Keep the version private during playtesting. BGS assigns uploaded asset URLs; the example intentionally has no viewer URL. See [the integration notes](docs/realtime-host.md) for clock, table and career behavior.
### Playable tutorials
@ -76,14 +76,39 @@ Upload the generated engine tarball and `dist/viewer.js` through BGS admin. Use
Open `/learn?chapter=basics&locale=fr` on the local preview server. Lessons use
`@boardgamers/protocol/tutorial` for validated action history, checkpoints,
previous/replay/restart controls, and browser-local progress. The BGS viewer
registers the same `mountLesson` through `launchTutorial`; chapter metadata still
needs configuring when the viewer is published. Nothing has been published by
this local change.
registers the same `mountLesson` through `launchTutorial`. Publish its chapter
metadata together with the viewer; chapter versions must match saved progress.
Tutorials mount the ordinary console, ship, card controls and program slots.
The first chapter hides unrelated systems, card sides and crew members. Both
ship decks retain the same room height. Resolution is untimed and uses the
ordinary resolution controls; the planning clock never drives individual turns.
The speaker toggle enables short synthesized action cues (off initially).
During planning, each visible action has a small intended-room marker. Hover or
focus a turn to show a translucent crew marker there; the solid crew stays in its
actual room. This preview assumes movement succeeds and stops when hidden cards
or crew-dependent movement make the route unknown.
Short synthesized action cues are enabled by default and unlock on the first interaction; the speaker toggle preserves the user’s mute choice.
[BGS playable tutorial API](https://codeberg.org/boardgamers/boardgamers/src/branch/main/apps/docs/docs/guide/tutorials.md)
### Localization
English source chapter titles live in `bgs/gameinfo.json`; translated titles use
BGS metadata `optionTranslations` (for example `tutorial.chapters.basics.title`).
A translated title is not a chapter description. Chapter IDs and progress versions
are independent of language.
In-game copy lives in `preview/locales/<locale>.json`. The viewer and tutorials load
only the requested catalog, using BGS preferences / tutorial launch locale. English
and French are currently available; regional French tags resolve to French and
unsupported languages fall back to English. Language changes preserve the table,
selected android, and program. Failed catalog requests fall back to English and
can be retried; stale requests cannot replace a newer language choice.
To add a language, create a catalog with the English keys and named placeholders,
and register its source filename in `preview/i18n.js` and `preview/server.js`. The
build validates key/placeholder parity, emits content-hashed JSON language files,
and embeds only their filenames. URLs resolve relative to the viewer script, so
BGS asset proxies and deployments under subdirectories work. Run `npm test` and
`npm run build` before uploading the **whole viewer bundle**.

View file

@ -12,7 +12,7 @@
"engine": {
"package": {
"name": "@boardgamers/space-alert",
"version": "0.1.2"
"version": "0.1.6"
},
"entryPoint": "bgs/engine.js"
},
@ -241,51 +241,57 @@
"chapters": [
{
"id": "basics",
"version": 3,
"title": "Commencer ici : programmer les tours",
"description": "Start here: planning turns"
"version": 4,
"title": "Start here: planning turns",
"description": ""
},
{
"id": "planning-phases",
"version": 2,
"title": "The clock and planning phases",
"description": ""
},
{
"id": "first-shot",
"version": 2,
"title": "Votre premier tir",
"description": "Your first shot"
"title": "Your first shot",
"description": ""
},
{
"id": "energy",
"version": 2,
"title": "Énergie et coordination",
"description": "Energy and coordination"
"title": "Energy and coordination",
"description": ""
},
{
"id": "repairs",
"version": 2,
"title": "Réparer une panne",
"description": "Repairing a malfunction"
"title": "Repairing a malfunction",
"description": ""
},
{
"id": "battlebots",
"version": 2,
"title": "Robots et intercepteurs",
"description": "Battlebots and interceptors"
"title": "Battlebots and interceptors",
"description": ""
},
{
"id": "double-actions",
"version": 2,
"title": "Deux actions, dans l’ordre",
"description": "Two actions, in order"
"title": "Two actions, in order",
"description": ""
},
{
"id": "phasing",
"version": 2,
"title": "Menaces de l’extension",
"description": "Expansion threats"
"title": "Expansion threats",
"description": ""
},
{
"id": "specializations",
"version": 2,
"title": "Spécialisations",
"description": "Specializations"
"title": "Specializations",
"description": ""
}
]
}
@ -304,6 +310,65 @@
"releaseYear": 2008,
"tags": [
"cooperative"
]
],
"optionTranslations": {
"fr": {
"tutorial.chapters.basics.title": {
"label": "Commencer ici : programmer les tours",
"translatedFrom": {
"hash": "4a22aa1dcb1eebe9"
}
},
"tutorial.chapters.first-shot.title": {
"label": "Votre premier tir",
"translatedFrom": {
"hash": "c3f20469e7380f25"
}
},
"tutorial.chapters.energy.title": {
"label": "Énergie et coordination",
"translatedFrom": {
"hash": "bd4494096f44bf35"
}
},
"tutorial.chapters.repairs.title": {
"label": "Réparer une panne",
"translatedFrom": {
"hash": "6ec76f37d1db03af"
}
},
"tutorial.chapters.battlebots.title": {
"label": "Robots et intercepteurs",
"translatedFrom": {
"hash": "dac9cb08473d893b"
}
},
"tutorial.chapters.double-actions.title": {
"label": "Deux actions, dans l’ordre",
"translatedFrom": {
"hash": "71a2a375cf06780d"
}
},
"tutorial.chapters.phasing.title": {
"label": "Menaces de l’extension",
"translatedFrom": {
"hash": "4aed91fa1b00f780"
}
},
"tutorial.chapters.specializations.title": {
"label": "Spécialisations",
"translatedFrom": {
"hash": "b2561b50e122a682"
}
},
"tutorial.chapters.planning-phases.title": {
"label": "Le chrono et les phases",
"translatedFrom": {
"hash": "f138f99de90125e8"
}
}
}
},
"description": "Keep your spaceship alive: spend 10 minutes planning together as threats are announced, then watch the entire mission execute, turn by turn."
}
}

12
bgs/pictogram.svg Normal file
View file

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" width="256" height="256">
<title>Space Alert</title>
<!-- Original ship symbol; transparent canvas cropped to the hull and exhaust. -->
<path fill="#9ce5ed" d="M27 110h10v18H27zm32 0h10v18H59zm32 0h10v18H91z"/>
<path fill="#344f5d" stroke="#a0b7c1" stroke-width="3" stroke-linejoin="round" d="M2 42 27 16 48 12 56 2h16l8 10 21 4 25 26v62l-14 12H16L2 104Z"/>
<path fill="#7bced5" d="m40 24 8-8h32l8 8-9 10H49Z"/>
<path fill="#142b39" d="M12 44h30v30H12zm37 0h30v30H49zm37 0h30v30H86zM12 82h30v22H12zm37 0h30v22H49zm37 0h30v22H86z"/>
<path fill="none" stroke="#d8ba72" stroke-width="4" d="M49 42h30"/>
<path fill="none" stroke="#df8c7c" stroke-width="4" d="M12 42h30"/>
<path fill="none" stroke="#87b8e8" stroke-width="4" d="M86 42h30"/>
<path fill="#ffdc85" d="m67 49-11 14h8l-3 10 12-15h-8Z"/>
</svg>

After

Width:  |  Height:  |  Size: 883 B

View file

@ -1,4 +1,8 @@
import { createLessonTutorial, completedTurns } from "../src/tutorial-controller.js";
import { translate, loadLocale } from "../preview/i18n.js";
import {
createLessonTutorial,
completedTurns,
} from "../src/tutorial-controller.js";
import { LESSONS } from "../src/tutorials.js";
import { snapshot } from "../src/view.js";
import { mountConsole } from "../preview/app.js";
@ -7,24 +11,60 @@ import { createSoundDesign } from "../preview/sound.js";
import html from "../preview/index.html";
import css from "../preview/style.css";
export async function mountLesson(target, { chapter = "basics", locale = "en", onProgress, nextChapter, standalone = false } = {}) {
const t = (fr, en) => locale === "fr" ? fr : en;
const index = LESSONS.findIndex(l => l.id === chapter);
export async function mountLesson(
target,
{
chapter = "basics",
locale = "en",
onProgress,
nextChapter,
standalone = false,
} = {},
) {
locale = await loadLocale(locale);
const t = (key, params) => translate(locale, key, params);
const index = LESSONS.findIndex((l) => l.id === chapter);
if (index < 0) throw Error("Unknown tutorial chapter");
const sound = createSoundDesign();
let soundOn = true, disposed = false, lastStep = -1, lastTurn = 0, lastTick = performance.now();
let playing = false, previousStage, playbackBusy = false;
const shotExerciseEnded = s => chapter === "first-shot" && s.state.tutorial.stopAtTarget &&
s.state.game.resolution?.turn >= 3 && ["threats", "computer", "appear"].includes(s.state.game.resolution.step);
const canPlay = s => !shotExerciseEnded(s) && s.state.stage === "resolution" && !s.completed && !s.state.game.resolution?.outcome && !(chapter === "basics" && completedTurns(s.state) >= 3);
let soundOn = true,
disposed = false,
lastStep = -1,
lastTurn = 0,
lastTick = performance.now();
let playing = false,
previousStage,
previousPhase,
previousThreats,
playbackBusy = false;
const shotExerciseEnded = (s) =>
chapter === "first-shot" &&
s.state.tutorial.stopAtTarget &&
s.state.game.resolution?.turn >= 3 &&
["threats", "computer", "appear"].includes(s.state.game.resolution.step);
const canPlay = (s) =>
!shotExerciseEnded(s) &&
s.state.stage === "resolution" &&
!s.completed &&
!s.state.game.resolution?.outcome &&
!(chapter === "basics" && completedTurns(s.state) >= 3);
let storage;
try { storage = window.localStorage; soundOn = storage.getItem("space-alert:tutorial-sound") !== "off"; } catch {}
try {
storage = window.localStorage;
soundOn = storage.getItem("space-alert:tutorial-sound") !== "off";
} catch {}
// Unlock audio on the first real interaction, respecting browser autoplay rules.
const unlockSound = () => sound.enable(soundOn);
target.ownerDocument.addEventListener("pointerdown", unlockSound, true);
target.ownerDocument.addEventListener("keydown", unlockSound, true);
const tutorial = await createLessonTutorial(chapter, { locale, storage, onProgress });
target.innerHTML = html.split("<body>")[1].split('<script type="module"')[0].split("</body>")[0];
const tutorial = await createLessonTutorial(chapter, {
locale,
storage,
onProgress,
});
target.innerHTML = html
.split("<body>")[1]
.split('<script type="module"')[0]
.split("</body>")[0];
const style = document.createElement("style");
style.textContent = css;
target.prepend(style);
@ -33,8 +73,10 @@ export async function mountLesson(target, { chapter = "basics", locale = "en", o
const guide = document.createElement("section");
guide.className = "native-guide";
target.querySelector("#basics-guide").before(guide);
if (chapter === "basics") {
target.querySelector("#planning").append(target.querySelector("#basics-guide"));
if (chapter === "basics" || chapter === "planning-phases") {
target
.querySelector("#planning")
.append(target.querySelector("#basics-guide"));
target.querySelector("#ship").classList.add("training-ship");
}
const programControls = document.createElement("div");
@ -42,27 +84,38 @@ export async function mountLesson(target, { chapter = "basics", locale = "en", o
target.querySelector("#hand").after(programControls);
if (chapter === "first-shot") {
const threats = target.querySelector("#threats");
const heading = target.querySelector("#threat-title").closest(".section-heading");
const heading = target
.querySelector("#threat-title")
.closest(".section-heading");
const objective = document.createElement("section");
objective.className = "lesson-target";
target.querySelector("#planning").append(objective);
objective.append(heading, threats);
}
const goChapter = id => {
if (standalone) location.assign(`/learn?chapter=${encodeURIComponent(id)}&locale=${encodeURIComponent(locale)}`);
const goChapter = (id) => {
if (standalone)
location.assign(
`/learn?chapter=${encodeURIComponent(id)}&locale=${encodeURIComponent(locale)}`,
);
};
const play = async move => {
if (!await tutorial.play(move)) throw Error(tutorial.snapshot.error || t("Action indisponible", "Action unavailable"));
const play = async (move) => {
if (!(await tutorial.play(move)))
throw Error(tutorial.snapshot.error || t("tutorial.action_unavailable"));
};
async function tick() {
const now = performance.now();
const ms = Math.floor(now - lastTick);
lastTick = now;
if (tutorial.snapshot.state.tutorial.clockRunning && tutorial.snapshot.state.stage === "programming")
if (
tutorial.snapshot.state.tutorial.clockRunning &&
tutorial.snapshot.state.stage === "programming"
)
await play({ type: "practice-tick", ms });
}
const ui = mountConsole(target, {
tutorial: true, missions: [],
tutorial: true,
missions: [],
locale,
command: play,
openLesson: goChapter,
async tutorialPost(path, body) {
@ -73,76 +126,222 @@ export async function mountLesson(target, { chapter = "basics", locale = "en", o
} else if (path === "/api/lesson-deadline") {
await play({ type: "practice-deadline" });
lastTick = performance.now();
} else if (path === "/api/lesson-next") await play({ type: "practice-phase" });
} else if (path === "/api/lesson-next")
await play({
type: chapter === "basics" ? "practice-run" : "practice-phase",
});
else throw Error("Unsupported tutorial action");
},
cue: (kind, pan) => sound.cue(kind, pan),
});
ui.setPreferences({ locale });
ui.setPlayer(0);
const escape = value => String(value).replace(/[&<>"']/g, c => ({ '&':'&amp;', '<':'&lt;', '>':'&gt;', '"':'&quot;', "'":'&#39;' })[c]);
const label = [t("Découvrir", "Discover"), t("Préparer", "Plan"), t("Exécuter", "Execute")];
const transport = (action, icon, title, disabled = false) => `<button data-guide="${action}" class="quiet icon-button" title="${title}" aria-label="${title}" ${disabled ? 'disabled' : ''}>${pictogram(icon)}</button>`;
function renderGuide(s) {
const planned = s.state.game.programs[0].some(slot => slot?.cards?.length);
const readyToFire = chapter === "first-shot" && [1, 2].every(i => s.state.game.programs[0][i]?.cards?.length);
const missed = LESSONS[index].basics && s.step === 2 && completedTurns(s.state) >= 3 && !s.completed;
programControls.innerHTML = `${canPlay(s) ? transport("playback", playing ? "pause" : "right", playing ? t("Pause", "Pause") : t("Lire le programme", "Play program")) : ""}${!LESSONS[index].basics && chapter !== "first-shot" && s.step === 1 && s.state.phase === 1 ? transport("phase", "step", t("Phase 2", "Phase 2"), s.busy) : ""}${!LESSONS[index].basics && s.step === 1 ? `<button data-guide="run" class="primary icon-button" aria-keyshortcuts="Enter" title="${t("Exécuter le programme", "Run program")} · ↵" aria-label="${t("Exécuter le programme", "Run program")}" ${(chapter === "first-shot" ? !readyToFire : !planned) || s.busy ? "disabled" : ""}>${pictogram("step")}<kbd>↵</kbd></button>` : ""}`;
guide.innerHTML = `<div class="native-guide-row"><nav class="basics-stages" aria-label="${t("Étapes", "Steps")}">${label.map((name, i) => `<button data-guide-step="${i}" class="quiet ${Math.min(s.step, 2) === i ? 'active' : ''}" ${i > s.step || s.busy ? 'disabled' : ''} ${s.step === i ? 'aria-current="step"' : ''}><span class="step-number">${i + 1}</span><span>${name}</span></button>`).join('')}</nav><div class="native-guide-tools">${standalone ? `<a href="/">${t("Partie locale", "Local game")}</a>` : ''}${transport("sound", soundOn ? "speaker" : "muted", soundOn ? t("Couper les sons", "Mute sounds") : t("Activer les sons", "Enable sounds"))}</div></div>
<h1>${escape(s.title)}</h1><p class="native-guide-text">${escape(missed ? t("Destination manquée. Revenez préparer un autre trajet.", "Destination missed. Go back and plan another route.") : s.text)}</p>
<div class="native-guide-controls">${transport("restart", "rewind", t("Recommencer l’exercice", "Restart exercise"), s.busy)}${transport("previous", "left", t("Étape précédente", "Previous step"), s.step === 0 || s.busy)}${transport("replay", "restart", t("Rejouer cette étape", "Replay step"), s.busy || s.step === 0)}${s.canContinue ? `<button data-guide="continue" class="primary icon-button" title="${t("Commencer", "Start")}" aria-label="${t("Commencer", "Start")}">${pictogram("right")}</button>` : ''}${s.completed && (nextChapter || standalone && LESSONS[index + 1]) ? `<button data-guide="next" class="primary icon-label"><span>${t("Exercice suivant", "Next exercise")}</span>${pictogram("right")}</button>` : ''}</div>
${s.error ? `<p role="alert">${escape(s.error)}</p>` : ''}`;
const escape = (value) =>
String(value).replace(
/[&<>"']/g,
(c) =>
({
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#39;",
})[c],
);
const stageFor = (s) =>
chapter === "planning-phases"
? s.step === 2
? 1
: s.step === 3
? 2
: s.step
: chapter === "basics" && s.step >= 4
? Math.min(s.step - 3, 2)
: Math.min(s.step, 2);
const label =
chapter === "planning-phases"
? [
t("tutorial.discover"),
t("phases.first"),
t("phases.second"),
t("tutorial.execute"),
]
: [t("tutorial.discover"), t("basics.plan"), t("tutorial.execute")];
const transport = (action, icon, title, disabled = false) =>
`<button data-guide="${action}" class="quiet icon-button" title="${title}" aria-label="${title}" ${disabled ? "disabled" : ""}>${pictogram(icon)}</button>`;
function missionOverview() {
return `<div class="mission-overview"><div class="mission-flow">${[
["clock", "plan"],
["lock", "lock"],
["step", "play"],
]
.map(
([icon, key], i) =>
`${i ? `<span class="flow-arrow" aria-hidden="true">${pictogram("right")}</span>` : ""}<div class="mission-concept">${pictogram(icon)}<strong>${t(`overview.${key}`)}</strong><small>${t(`overview.${key}_detail`)}</small></div>`,
)
.join(
"",
)}</div><div class="mission-timeline"><span>${t("overview.turns")}</span><div class="mission-groups">${[
{ first: 1, last: 3 },
{ first: 4, last: 7 },
{ first: 8, last: 12 },
]
.map(
({ first, last }, i) =>
`<div class="mission-group ${i ? "later" : ""}" title="${t("timing.phase_group", { phase: i + 1, first, last })}">${Array.from({ length: last - first + 1 }, (_, n) => `<span>${first + n}</span>`).join("")}</div>`,
)
.join("")}</div>${pictogram("step")}</div></div>`;
}
const unsubscribe = tutorial.subscribe(s => {
function renderGuide(s) {
const planned = s.state.game.programs[0].some(
(slot) => slot?.cards?.length,
);
const readyToFire =
chapter === "first-shot" &&
[1, 2].every((i) => s.state.game.programs[0][i]?.cards?.length);
const stage =
chapter === "planning-phases" ? Math.min(s.step, 3) : stageFor(s);
const phaseLesson = chapter === "planning-phases";
const deadline = chapter === "basics" && s.step >= 4;
const missed =
LESSONS[index].basics &&
s.step === 2 &&
completedTurns(s.state) >= 3 &&
!s.completed;
programControls.innerHTML = `${chapter === "basics" && s.step === 3 ? transport("timeout", "clock", t("timing.next_scenario"), s.busy) : ""}${canPlay(s) ? transport("playback", playing ? "pause" : "right", playing ? t("basics.pause") : t("tutorial.play_program")) : ""}${!LESSONS[index].basics && chapter !== "first-shot" && s.step === 1 && s.state.phase === 1 ? transport("phase", "step", t("app.phase_2"), s.busy) : ""}${!LESSONS[index].basics && s.step === 1 ? `<button data-guide="run" class="primary icon-button" aria-keyshortcuts="Enter" title="${t("basics.run_program")} · ↵" aria-label="${t("basics.run_program")}" ${(chapter === "first-shot" ? !readyToFire : !planned) || s.busy ? "disabled" : ""}>${pictogram("step")}<kbd>↵</kbd></button>` : ""}`;
if (phaseLesson && s.state.stage === "programming" && s.step > 0) {
const ready =
s.state.game.programs[0][(s.state.phase === 1 ? 1 : 4) - 1]?.cards
?.length;
const phaseLeft = Math.max(
0,
Math.ceil(
(s.state.missionStartAt +
s.state.mission.phaseEndsMs[s.state.phase - 1] -
s.state.observedAt) /
1000,
),
);
const phaseTime = `${Math.floor(phaseLeft / 60)}:${String(phaseLeft % 60).padStart(2, "0")}`;
programControls.innerHTML = `<div class="phase-lesson-controls">${s.state.phase === 1 ? transport("phase-deadline", "forward", t("phases.skip"), !ready || !s.state.game.threats.length || s.busy) : `<button data-guide="run" class="primary icon-button" aria-keyshortcuts="Enter" title="${t("phases.execute")} · ↵" aria-label="${t("phases.execute")}" ${!ready || s.busy ? "disabled" : ""}>${pictogram("step")}<kbd>↵</kbd></button>`}<div class="practice-clock"><div><strong data-practice-time></strong><small>${t("phases.deadline", { phase: s.state.phase, time: phaseTime })}</small></div>${transport("phase-clock", s.state.tutorial.clockRunning ? "pause" : "clock", t(s.state.tutorial.clockRunning ? "basics.pause" : "basics.start_clock"))}</div></div>`;
}
guide.innerHTML = `<div class="native-guide-row"><nav class="basics-stages" aria-label="${t("tutorial.steps")}">${label.map((name, i) => `<button data-guide-step="${deadline ? i + 3 : i}" class="quiet ${stage === i ? "active" : ""}" ${i > stage || s.busy ? "disabled" : ""} ${stage === i ? 'aria-current="step"' : ""}><span class="step-number">${i + 1}</span><span>${name}</span></button>`).join("")}</nav><div class="native-guide-tools">${standalone ? `<a href="/">${t("tutorial.local_game")}</a>` : ""}${transport("sound", soundOn ? "speaker" : "muted", soundOn ? t("tutorial.mute_sounds") : t("tutorial.enable_sounds"))}</div></div>
<h1>${escape(s.title)}</h1>${s.step === 0 && (chapter === "basics" || phaseLesson) ? missionOverview() : ""}${chapter === "basics" || chapter === "first-shot" ? `<small class="lesson-scope">${t("timing.exercise", { turns: 3 })}${chapter === "basics" ? ` · ${deadline ? 2 : 1}/2` : ""}</small>` : ""}<p class="native-guide-text">${escape(missed ? t("tutorial.destination_missed_go_back_and_plan_another_route") : s.text)}</p>
<div class="native-guide-controls">${transport("restart", "rewind", t("tutorial.restart_exercise"), s.busy)}${transport("previous", "left", t("tutorial.previous_step"), s.step === 0 || s.busy)}${transport("replay", "restart", t("tutorial.replay_step"), s.busy || s.step === 0)}${s.canContinue ? `<button data-guide="continue" class="primary icon-button" title="${t("tutorial.start")}" aria-label="${t("tutorial.start")}">${pictogram("right")}</button>` : ""}${s.completed && (nextChapter || (standalone && LESSONS[index + 1])) ? `<button data-guide="next" class="primary icon-label"><span>${t("tutorial.next_exercise")}</span>${pictogram("right")}</button>` : ""}</div>
${s.error ? `<p role="alert">${escape(s.error)}</p>` : ""}`;
}
const unsubscribe = tutorial.subscribe((s) => {
if (disposed) return;
if (s.state.stage === "resolution" && previousStage === "programming") playing = true;
if (s.state.stage === "resolution" && previousStage === "programming") {
playing = true;
sound.cue("start");
}
if (s.state.stage === "programming") {
if (previousPhase !== undefined && s.state.phase > previousPhase)
sound.cue("lock");
else if (
previousThreats !== undefined &&
s.state.game.threats.length > previousThreats
)
sound.cue("alert");
}
previousPhase = s.state.phase;
previousThreats = s.state.game.threats.length;
previousStage = s.state.stage;
if (!canPlay(s)) playing = false;
if (s.step !== lastStep) {
ui.resetTutorial();
if (s.completed && lastStep >= 0 && s.step > lastStep) sound.cue("complete");
if (s.completed && lastStep >= 0 && s.step > lastStep)
sound.cue("complete");
lastStep = s.step;
}
const turn = completedTurns(s.state);
if (turn > lastTurn && lastTurn >= 0 && !s.completed) {
const action = s.state.game.programs[0][turn - 1]?.cards?.[0];
const actions = action ? s.state.game.cards[action.id]?.sides[action.side] : [];
sound.cue(actions?.length ? "turn" : "wait", actions?.includes("red") ? -.5 : actions?.includes("blue") ? .5 : 0);
const actions = action
? s.state.game.cards[action.id]?.sides[action.side]
: [];
sound.cue(
actions?.length ? "turn" : "wait",
actions?.includes("red") ? -0.5 : actions?.includes("blue") ? 0.5 : 0,
);
}
lastTurn = turn;
const view = snapshot(s.state, 0);
view.tutorial = { ...s.state.tutorial, nativeStep: s.step };
view.tutorial = {
...s.state.tutorial,
nativeStep: s.completed ? 3 : stageFor(s),
nativeCheckpoint: s.step,
};
view.explorers = [];
view.careerIds = [];
target.dataset.tutorialStep = String(s.step);
target.dataset.tutorialStep = String(
s.completed || (chapter === "basics" && s.step === 3) ? 3 : stageFor(s),
);
target.dataset.tutorialStage = s.state.stage;
ui.render(view);
const focus = {
"first-shot": ["white-upper-A"], energy: ["white-lower-B", "white-upper-A"],
repairs: ["blue-upper-B"], battlebots: ["blue-upper-C", "red-upper-C"],
"double-actions": ["white-upper-A", "blue-upper-A"], phasing: ["white-upper-A"],
specializations: ["blue-lower-C"],
}[chapter] ?? [];
for (const system of focus) target.querySelector(`[data-inspect="system-${system}"]`)?.classList.add("lesson-focus");
const focus =
{
"first-shot": ["white-upper-A"],
energy: ["white-lower-B", "white-upper-A"],
repairs: ["blue-upper-B"],
battlebots: ["blue-upper-C", "red-upper-C"],
"double-actions": ["white-upper-A", "blue-upper-A"],
phasing: ["white-upper-A"],
specializations: ["blue-lower-C"],
}[chapter] ?? [];
for (const system of focus)
target
.querySelector(`[data-inspect="system-${system}"]`)
?.classList.add("lesson-focus");
renderGuide(s);
});
const onClick = async event => {
const onClick = async (event) => {
const button = event.target.closest("button");
if (!button || tutorial.snapshot.busy) return;
const action = button.dataset.guide;
if (action === "sound") {
soundOn = !soundOn;
try { storage?.setItem("space-alert:tutorial-sound", soundOn ? "on" : "off"); } catch {}
sound.enable(soundOn); sound.cue("select"); renderGuide(tutorial.snapshot); return;
try {
storage?.setItem("space-alert:tutorial-sound", soundOn ? "on" : "off");
} catch {}
sound.enable(soundOn);
sound.cue("select");
renderGuide(tutorial.snapshot);
return;
}
if (action === "phase-deadline") {
await play({ type: "practice-phase-deadline" });
lastTick = performance.now();
return;
}
if (action === "phase-clock") {
await tick();
await play({
type: "practice-clock",
running: !tutorial.snapshot.state.tutorial.clockRunning,
});
lastTick = performance.now();
return;
}
if (action === "timeout") {
await play({ type: "practice-timeout" });
lastTick = performance.now();
return;
}
if (action === "phase") {
await play({ type: "practice-phase" });
return;
}
if (action === "phase") { await play({ type: "practice-phase" }); return; }
if (action === "run") {
await play({ type: "practice-run" });
return;
}
if (action === "playback") {
playing = !playing; renderGuide(tutorial.snapshot); return;
playing = !playing;
renderGuide(tutorial.snapshot);
return;
}
if (!action && button.dataset.guideStep === undefined) return;
playing = false;
@ -154,8 +353,12 @@ export async function mountLesson(target, { chapter = "basics", locale = "en", o
while (tutorial.snapshot.step > step) await tutorial.previousStep();
} else if (action === "continue") await tutorial.continue();
else if (action === "previous") await tutorial.previousStep();
else if (action === "replay") { if (tutorial.snapshot.completed) await tutorial.previousStep(); else await tutorial.restartStep(); playing = canPlay(tutorial.snapshot); renderGuide(tutorial.snapshot); }
else if (action === "restart") await tutorial.restart();
else if (action === "replay") {
if (tutorial.snapshot.completed) await tutorial.previousStep();
else await tutorial.restartStep();
playing = canPlay(tutorial.snapshot);
renderGuide(tutorial.snapshot);
} else if (action === "restart") await tutorial.restart();
else if (action === "next") {
if (nextChapter) nextChapter.open();
else goChapter(LESSONS[index + 1].id);
@ -167,17 +370,35 @@ export async function mountLesson(target, { chapter = "basics", locale = "en", o
programControls.addEventListener("click", onClick);
// Playback pacing only: each tick executes the next deterministic engine step.
const playback = setInterval(async () => {
if (!playing || disposed || playbackBusy || tutorial.snapshot.busy || !canPlay(tutorial.snapshot)) return;
if (
!playing ||
disposed ||
playbackBusy ||
tutorial.snapshot.busy ||
!canPlay(tutorial.snapshot)
)
return;
playbackBusy = true;
try { await play({ type: "resolve" }); }
catch { playing = false; renderGuide(tutorial.snapshot); }
finally { playbackBusy = false; }
try {
await play({ type: "resolve" });
} catch {
playing = false;
renderGuide(tutorial.snapshot);
} finally {
playbackBusy = false;
}
}, 450);
const ticker = setInterval(() => {
if (!tutorial.snapshot.busy) void tick().catch(() => {});
}, 1000);
return () => {
disposed = true; clearInterval(playback); clearInterval(ticker); unsubscribe(); tutorial.destroy(); ui.destroy(); sound.destroy();
disposed = true;
clearInterval(playback);
clearInterval(ticker);
unsubscribe();
tutorial.destroy();
ui.destroy();
sound.destroy();
guide.removeEventListener("click", onClick);
programControls.removeEventListener("click", onClick);
target.ownerDocument.removeEventListener("pointerdown", unlockSound, true);

View file

@ -1,3 +1,4 @@
import { loadLocale } from "../preview/i18n.js";
import { mountLesson } from "./tutorial.js";
import { registerViewer } from "@boardgamers/protocol/viewer";
import { mountConsole } from "../preview/app.js";
@ -6,102 +7,150 @@ import css from "../preview/style.css";
import { snapshot } from "../src/view.js";
const missionSummaries = BGS_MISSIONS;
registerViewer("SpaceAlert", (context) => {
const { target } = context;
const style = document.createElement("style");
style.textContent =
css +
`
registerViewer(
"SpaceAlert",
(context) => {
const { target } = context;
const style = document.createElement("style");
style.textContent =
css +
`
.bgs-hosted #setup,.bgs-hosted #lessons,.bgs-hosted #create-explorer,.bgs-hosted #seat,.bgs-hosted #ready-all,.bgs-hosted #next-event,.bgs-hosted #open-setup {display:none!important}
.bgs-hosted #career-manager:has(#explorers:empty) {display:none}
`;
target.innerHTML = html
.split("<body>")[1]
.split('<script type="module"')[0]
.split("</body>")[0];
target.prepend(style);
let seat, pending, lastState;
const ui = mountConsole(target, {
missions: missionSummaries,
command(command) {
if (pending)
return Promise.reject(Error("Waiting for the previous move"));
return new Promise((resolve, reject) => {
const timer = setTimeout(() => {
pending = null;
context.fetchState();
reject(
Error(
"No confirmation yet. Please check your connection and try again.",
),
);
}, 8000);
pending = { resolve, reject, timer, sequence: command.sequence };
if (!context.move(command)) {
clearTimeout(timer);
pending = null;
reject(Error("The game is not ready to accept moves"));
const mountMarkup = () => {
target.innerHTML = html
.split("<body>")[1]
.split('<script type="module"')[0]
.split("</body>")[0];
target.prepend(style);
};
let seat,
pending,
lastState,
ui,
initializing,
disposed = false;
let preferences = { locale: "en" };
async function ensureUI() {
if (ui || disposed) return ui;
if (initializing) return initializing;
initializing = (async () => {
const locale = await loadLocale(preferences.locale);
if (disposed) return;
mountMarkup();
ui = mountConsole(target, {
locale,
missions: missionSummaries,
command(command) {
if (pending)
return Promise.reject(Error("Waiting for the previous move"));
return new Promise((resolve, reject) => {
const timer = setTimeout(() => {
pending = null;
context.fetchState();
reject(
Error(
"No confirmation yet. Please check your connection and try again.",
),
);
}, 8000);
pending = { resolve, reject, timer, sequence: command.sequence };
if (!context.move(command)) {
clearTimeout(timer);
pending = null;
reject(Error("The game is not ready to accept moves"));
}
});
},
});
ui.setPlayer(seat);
await ui.setPreferences(preferences);
return ui;
})().catch((error) => {
initializing = null;
if (!disposed) {
target.textContent = `Space Alert: ${error.message}`;
target.setAttribute("role", "alert");
}
throw error;
});
},
});
ui.setPlayer(undefined);
function render(state) {
lastState = state;
// Finished games can be opened without reinstalling an archived engine.
const view = Array.isArray(state.timeline) ? snapshot(state, seat) : state;
if (Array.isArray(state.timeline)) {
view.bgs = {
missionNumber: state.bgs.missionNumber,
settings: state.bgs.settings,
};
view.careerIds = state.bgs.playerIds;
view.explorers = state.bgs.playerIds
.map((id) => state.bgs.explorers[id])
.filter(Boolean)
.map((e) => ({
...e,
activeRun: !!e.activeRun,
eligible: [],
editable: false,
}));
return initializing;
}
ui.render(view);
if (pending && view.nextSequence > pending.sequence) {
clearTimeout(pending.timer);
const done = pending;
pending = null;
done.resolve(view);
}
}
return {
onState: render,
onMoveResult(result) {
if (result.ok || !pending || result.move?.sequence !== pending.sequence)
return;
const done = pending;
pending = null;
clearTimeout(done.timer);
context.fetchState();
done.reject(Error(result.error || "Move rejected"));
},
onPlayer(player) {
seat = player.index;
ui.setPlayer(seat);
if (lastState) render(lastState);
},
onPreferences: (preferences) => ui.setPreferences(preferences),
onError(error) {
const el = target.querySelector("#error");
if (el) el.textContent = String(error);
},
destroy() {
ui.destroy();
if (pending) {
clearTimeout(pending.timer);
pending.reject(Error("Viewer closed"));
pending = null;
function render(state) {
// Finished games can be opened without reinstalling an archived engine.
const view = Array.isArray(state.timeline)
? snapshot(state, seat)
: state;
if (Array.isArray(state.timeline)) {
view.bgs = {
missionNumber: state.bgs.missionNumber,
settings: state.bgs.settings,
};
view.careerIds = state.bgs.playerIds;
view.explorers = state.bgs.playerIds
.map((id) => state.bgs.explorers[id])
.filter(Boolean)
.map((e) => ({
...e,
activeRun: !!e.activeRun,
eligible: [],
editable: false,
}));
}
},
};
}, { tutorial: mountLesson });
ui.render(view);
if (pending && view.nextSequence > pending.sequence) {
clearTimeout(pending.timer);
const done = pending;
pending = null;
done.resolve(view);
}
}
return {
async onState(state) {
lastState = state;
await ensureUI();
if (!disposed) render(lastState);
},
onMoveResult(result) {
if (result.ok || !pending || result.move?.sequence !== pending.sequence)
return;
const done = pending;
pending = null;
clearTimeout(done.timer);
context.fetchState();
done.reject(Error(result.error || "Move rejected"));
},
onPlayer(player) {
seat = player.index;
ui?.setPlayer(seat);
if (ui && lastState && !disposed) render(lastState);
},
onPreferences(next) {
preferences = { ...preferences, ...next };
void ensureUI()
.then(() => {
if (!disposed) return ui.setPreferences(preferences);
})
.catch((error) => {
if (!disposed)
console.error("Space Alert language loading failed", error);
});
},
onError(error) {
const el = target.querySelector("#error");
if (el) el.textContent = String(error);
},
destroy() {
disposed = true;
ui?.destroy();
if (pending) {
clearTimeout(pending.timer);
pending.reject(Error("Viewer closed"));
pending = null;
}
},
};
},
{ tutorial: mountLesson },
);

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "@boardgamers/space-alert",
"version": "0.1.5",
"version": "0.1.6",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@boardgamers/space-alert",
"version": "0.1.5",
"version": "0.1.6",
"license": "AGPL-3.0-only",
"devDependencies": {
"@boardgamers/protocol": "0.10.0",

View file

@ -1,6 +1,6 @@
{
"name": "@boardgamers/space-alert",
"version": "0.1.5",
"version": "0.1.6",
"private": true,
"type": "module",
"description": "Space Alert and The New Frontier: deterministic game engine and local playtest",
@ -30,6 +30,7 @@
"src",
"mission-data",
"dist/viewer.js",
"dist/locales",
"README.md",
"LICENSE"
]

File diff suppressed because it is too large Load diff

View file

@ -1,17 +1,23 @@
import { translate } from "./i18n.js";
import { pictogram } from "./icons.js";
// A focused view over the real lesson state, not a separate game simulation.
export function basicsView(view, locale, { started, picked, shipMarkup }) {
const t = (fr, en) => (locale === "fr" ? fr : en);
const t = (key, params) => translate(locale, key, params);
const slots = view.game.programs[0];
const placed = slots.slice(0, 2).filter((s) => s.cards.length).length;
const r = view.game.resolution;
const turn = r?.step === "damage" ? r.turn : Math.max(0, (r?.turn ?? 0) - 1);
const playing = view.stage === "resolution";
if (view.tutorial.nativeStep !== undefined) {
const control = (id, glyph, description, disabled = false) => `<button id="${id}" class="primary icon-button" ${id === "basics-run" ? 'aria-keyshortcuts="Enter"' : ""} title="${description}${id === "basics-run" ? " · ↵" : ""}" aria-label="${description}" ${disabled ? "disabled" : ""}>${pictogram(glyph)}${id === "lesson-deadline" ? "<small>5 s</small>" : ""}</button>`;
const control = (id, glyph, description, disabled = false) =>
`<button id="${id}" class="primary icon-button" ${id === "basics-run" ? 'aria-keyshortcuts="Enter"' : ""} title="${description}${id === "basics-run" ? " · ↵" : ""}" aria-label="${description}" ${disabled ? "disabled" : ""}>${pictogram(glyph)}${id === "lesson-deadline" ? "<small>5 s</small>" : ""}</button>`;
if (view.tutorial.nativeStep === 0) return "";
if (playing) return "";
return `<div class="planning-shortcuts" title="${t("Flèches : déplacement · ↑/↓ : changer de pont · Retour arrière : annuler · Entrée : exécuter", "Arrows: move · ↑/↓: change deck · Backspace: undo · Enter: run")}" aria-label="${t("Raccourcis : flèches pour se déplacer ; retour arrière pour annuler ; entrée pour exécuter", "Shortcuts: arrow keys to move; Backspace to undo; Enter to run")}"><kbd>←</kbd><kbd>→</kbd><kbd>↑</kbd><kbd>↓</kbd><kbd>⌫</kbd><kbd>↵</kbd></div><div class="practice-readiness" role="status" aria-label="${placed}/2 ${t("actions placées", "actions placed")}"><span>${pictogram("cards")} ${placed}/2</span><span class="ready-dots" aria-hidden="true">${[0,1].map(i => `<i class="${i < placed ? "filled" : ""}"></i>`).join("")}</span>${control("basics-run", "step", t("Exécuter le programme", "Run program"), placed !== 2)}</div><div class="practice-clock"><div><strong data-practice-time></strong><small>${t("Temps pour programmer", "Time to plan")}</small></div>${control("lesson-deadline", "forward", t("Aller à 5 s de la fin du chrono", "Jump to 5 seconds before the deadline"), placed !== 2)}${control("lesson-clock", view.tutorial.clockRunning ? "pause" : "clock", view.tutorial.clockRunning ? t("Pause", "Pause") : t("Lancer le chrono", "Start clock"))}</div>`;
if (playing)
return view.tutorial.timing
? `<div class="practice-clock stopped"><div><strong data-practice-time></strong><small>${t(view.tutorial.remainingMs > 0 ? "timing.stopped" : "timing.expired")}</small></div>${pictogram(view.tutorial.remainingMs > 0 ? "clock" : "lock")}</div>`
: "";
const deadline = view.tutorial.scenario === "deadline";
return `<div class="planning-shortcuts" title="${t(deadline ? "timing.deadline_shortcuts" : "basics.arrows_move_change_deck_backspace_undo_enter_run")}" aria-label="${t(deadline ? "timing.deadline_shortcuts" : "basics.shortcuts_arrow_keys_to_move_backspace_to_undo")}"><kbd>←</kbd><kbd>→</kbd><kbd>↑</kbd><kbd>↓</kbd><kbd>⌫</kbd>${deadline ? "" : "<kbd>↵</kbd>"}</div>${deadline ? "" : `<div class="practice-readiness" role="status" aria-label="${placed}/2 ${t("basics.actions_placed")}"><span>${pictogram("cards")} ${placed}/2</span><span class="ready-dots" aria-hidden="true">${[0, 1].map((i) => `<i class="${i < placed ? "filled" : ""}"></i>`).join("")}</span>${control("basics-run", "step", t("basics.run_program"), placed !== 2)}</div>`}<div class="practice-clock"><div><strong data-practice-time></strong><small>${t(deadline ? "timing.last_seconds" : "basics.time_to_plan")}</small></div>${control("lesson-clock", view.tutorial.clockRunning ? "pause" : "clock", view.tutorial.clockRunning ? t("basics.pause") : t("basics.start_clock"), deadline && placed !== 1)}</div>`;
}
const intro = !started && !placed && !playing;
const ready = placed === 2;
@ -21,77 +27,49 @@ export function basicsView(view, locale, { started, picked, shipMarkup }) {
};
const actionLabel = (a) =>
a === "blue"
? t("À droite", "Move right")
? t("basics.move_right")
: a === "red"
? t("À gauche", "Move left")
: t("Attendre", "Wait");
? t("basics.move_left")
: t("basics.wait");
const heading = intro
? t(
"Vous décidez d’abord. Vous agissez ensuite.",
"Plan first. Act afterward.",
)
? t("basics.plan_first_act_afterward")
: playing
? turn >= 3
? t("Vous venez de jouer trois tours.", "You just played three turns.")
: turn === 0 ? t("Lecture du programme", "Playing the program") : t(`Tour ${turn} exécuté`, `Turn ${turn} carried out`)
? t("basics.you_just_played_three_turns")
: turn === 0
? t("basics.playing_the_program")
: t("basics.turn_carried_out", { turn: turn })
: ready && !picked
? t("Essayez le chrono.", "Try the clock.")
? t("basics.try_the_clock")
: placed === 0
? t("Choisissez où aller.", "Choose where to go.")
: t(
"Choisissez votre deuxième action.",
"Choose your second action.",
);
? t("basics.choose_where_to_go")
: t("basics.choose_your_second_action");
const explanation = intro
? t(
"Dans Space Alert, tout le monde prépare ses actions en même temps. Puis le vaisseau exécute les programmes, tour après tour. Ici, commençons avec un seul équipier, sans menace.",
"In Space Alert, everyone plans their actions at the same time. Then the ship carries out those plans, turn by turn. Start here with one crew member and no threats.",
)
? t("basics.in_space_alert_everyone_plans_their_actions_at")
: playing
? [
t("La préparation est terminée. Les actions vont maintenant se jouer dans l’ordre.", "Planning is finished. Actions now play in order."),
t(
"La première carte est exécutée. Regardez votre nouvelle position ; la deuxième carte attend son tour.",
"The first card has played. Look at your position; the second card is still waiting.",
),
t(
"La deuxième carte est exécutée. Une flèche vers le bord du vaisseau vous laisse sur place. Chaque case est un tour, pas une seconde.",
"The second card has played. Moving beyond the edge of the ship leaves you in place. Each slot is a turn, not a second.",
),
t(
"La case 3 est vide : vous restez sur place. En mission, tous les équipiers exécutent leur case 1, puis leur case 2, etc.",
"Slot 3 is empty: you stay put. In a mission, every crew member carries out slot 1, then slot 2, and so on.",
),
t("basics.planning_is_finished_actions_now_play_in_order"),
t("basics.the_first_card_has_played_look_at_your"),
t("basics.the_second_card_has_played_moving_beyond_the"),
t("basics.slot_3_is_empty_you_stay_put_in"),
][Math.min(turn, 3)]
: ready && !picked
? t(
"Le chrono limite le temps pour préparer les cartes. Il ne déplace pas l’équipier. Vous pouvez le lancer et le mettre en pause ici ; en mission, il continue pour tout le monde.",
"The clock limits how long you have to arrange cards. It does not move your crew member. Here you can start and pause it; in a mission it keeps running for everyone.",
)
? t("basics.the_clock_limits_how_long_you_have_to")
: picked
? t(
"Choisissez le tour 1 ou 2. Vous pouvez aussi remplacer une carte déjà posée.",
"Choose turn 1 or 2. You can also replace a card already there.",
)
: t(
"Choisissez une flèche, puis un tour. Vous pouvez remplacer ou retirer vos cartes.",
"Choose an arrow, then a turn. You can replace or remove your cards.",
);
? t("basics.choose_turn_1_or_2_you_can_also")
: t("basics.choose_an_arrow_then_a_turn_you_can");
const btn = (id, text) =>
`<button id="${id}" class="primary">${text}</button>`;
return `<div class="basics-top"><span>${t("PREMIERS PAS · SANS MENACE", "FIRST STEPS · NO THREATS")}</span><button data-lesson="basics" class="quiet">${t("Recommencer", "Restart")}</button></div>
<nav class="basics-stages" aria-label="${t("Étapes de l’exercice", "Lesson steps")}"><button id="basics-plan" class="quiet ${!playing ? "active" : ""}" ${!playing ? 'aria-current="step"' : ''} ${playing && !view.tutorial.canReturnToPlanning ? 'disabled' : ''}><span class="step-number">1</span><span>${t("Préparer", "Plan")}</span></button><button id="basics-execute" class="quiet ${playing ? "active" : ""}" ${playing ? 'aria-current="step"' : ''} ${!playing && !ready ? 'disabled' : ''}><span class="step-number">2</span><span>${t("Exécuter les tours", "Run the turns")}</span></button></nav>
return `<div class="basics-top"><span>${t("basics.first_steps_no_threats")}</span><button data-lesson="basics" class="quiet">${t("app.restart")}</button></div>
<nav class="basics-stages" aria-label="${t("basics.lesson_steps")}"><button id="basics-plan" class="quiet ${!playing ? "active" : ""}" ${!playing ? 'aria-current="step"' : ""} ${playing && !view.tutorial.canReturnToPlanning ? "disabled" : ""}><span class="step-number">1</span><span>${t("basics.plan")}</span></button><button id="basics-execute" class="quiet ${playing ? "active" : ""}" ${playing ? 'aria-current="step"' : ""} ${!playing && !ready ? "disabled" : ""}><span class="step-number">2</span><span>${t("basics.run_the_turns")}</span></button></nav>
<h1>${heading}</h1><p class="basics-explanation" role="status">${explanation}</p>
<div class="training-ship ship cutaway" aria-label="${t("Le vaisseau · position réelle de l’androïde 1", "The ship · android 1’s actual position")}">${shipMarkup}</div>
<div class="training-ship ship cutaway" aria-label="${t("basics.the_ship_android_1_s_actual_position")}">${shipMarkup}</div>
${
intro
? btn(
"basics-start",
t("Essayer avec deux cartes", "Try with two cards"),
)
: `<div class="basics-program-heading">${pictogram("cards")}<span>${t("Programme", "Program")}</span>${pictogram("right")}</div><div class="basics-program program">${[1, 2, 3].map((n) => `<button title="${t("Tour", "Turn")} ${n} · ${actionLabel(direction(n))}" aria-label="${t("Tour", "Turn")} ${n} · ${actionLabel(direction(n))}" data-basics-turn="${n}" ${playing || (!picked && !slots[n - 1].cards.length) || n === 3 ? "disabled" : ""} class="slot ${playing && n === turn ? "current" : ""}"><span class="turn">T+${n}</span><strong class="action">${pictogram(direction(n) === "blue" ? "right" : direction(n) === "red" ? "left" : "wait")}</strong></button>`).join("")}</div>
${!playing ? `<div class="practice-readiness" role="status"><progress value="${placed}" max="2"></progress><span title="${t("Actions de l’exercice placées", "Practice actions placed")}" aria-label="${placed}/2 ${t("actions de l’exercice placées", "practice actions placed")}">${pictogram("cards")} ${placed}/2</span></div><div class="basics-card-area"><div class="basics-card-choices">${["red", "blue"].map((action) => `<button title="${actionLabel(action)}" aria-label="${actionLabel(action)}" data-basics-pick="${action}" aria-pressed="${picked === action}" class="basics-card ${picked === action ? "selected" : ""}"><strong>${pictogram(action === "blue" ? "right" : "left")}</strong></button>`).join("")}</div></div>` : ""}
${!playing && ready ? `<div class="practice-clock"><div><strong data-practice-time></strong><small>${t("pour préparer · exercice sans danger", "to plan · safe practice")}</small></div><button id="lesson-clock" class="icon-button" title="${view.tutorial.clockRunning ? t("Mettre en pause", "Pause clock") : t("Lancer le chrono", "Start clock")}" aria-label="${view.tutorial.clockRunning ? t("Mettre en pause", "Pause clock") : t("Lancer le chrono", "Start clock")}">${pictogram(view.tutorial.clockRunning ? "pause" : "clock")}</button></div><button id="basics-run" class="primary icon-button" title="${t("Exécuter le programme", "Run program")}" aria-label="${t("Exécuter le programme", "Run program")}">${pictogram("step")}</button>` : ""}
${playing ? (turn < 3 ? `<button data-command="resolve" class="primary icon-button" title="${t("Étape de résolution suivante", "Next resolution step")}" aria-label="${t("Étape de résolution suivante", "Next resolution step")}">${pictogram("step")}</button>` : `<div class="basics-complete"><p>${t("Préparer sous un chrono et exécuter les tours sont deux moments différents. Ensuite, vous apprendrez à utiliser une arme.", "Planning against a clock and carrying out turns are two different parts of the game. Next, learn to use a weapon.")}</p><button data-lesson="first-shot" class="primary">${t("Suite : votre premier tir", "Next: your first shot")}</button></div>`) : ""}`
? btn("basics-start", t("basics.try_with_two_cards"))
: `<div class="basics-program-heading">${pictogram("cards")}<span>${t("basics.program")}</span>${pictogram("right")}</div><div class="basics-program program">${[1, 2, 3].map((n) => `<button title="${t("app.turn")} ${n} · ${actionLabel(direction(n))}" aria-label="${t("app.turn")} ${n} · ${actionLabel(direction(n))}" data-basics-turn="${n}" ${playing || (!picked && !slots[n - 1].cards.length) || n === 3 ? "disabled" : ""} class="slot ${playing && n === turn ? "current" : ""}"><span class="turn">T+${n}</span><strong class="action">${pictogram(direction(n) === "blue" ? "right" : direction(n) === "red" ? "left" : "wait")}</strong></button>`).join("")}</div>
${!playing ? `<div class="practice-readiness" role="status"><progress value="${placed}" max="2"></progress><span title="${t("basics.practice_actions_placed")}" aria-label="${placed}/2 ${t("basics.practice_actions_placed_2d48e9")}">${pictogram("cards")} ${placed}/2</span></div><div class="basics-card-area"><div class="basics-card-choices">${["red", "blue"].map((action) => `<button title="${actionLabel(action)}" aria-label="${actionLabel(action)}" data-basics-pick="${action}" aria-pressed="${picked === action}" class="basics-card ${picked === action ? "selected" : ""}"><strong>${pictogram(action === "blue" ? "right" : "left")}</strong></button>`).join("")}</div></div>` : ""}
${!playing && ready ? `<div class="practice-clock"><div><strong data-practice-time></strong><small>${t("basics.to_plan_safe_practice")}</small></div><button id="lesson-clock" class="icon-button" title="${view.tutorial.clockRunning ? t("basics.pause_clock") : t("basics.start_clock")}" aria-label="${view.tutorial.clockRunning ? t("basics.pause_clock") : t("basics.start_clock")}">${pictogram(view.tutorial.clockRunning ? "pause" : "clock")}</button></div><button id="basics-run" class="primary icon-button" title="${t("basics.run_program")}" aria-label="${t("basics.run_program")}">${pictogram("step")}</button>` : ""}
${playing ? (turn < 3 ? `<button data-command="resolve" class="primary icon-button" title="${t("app.next_resolution_step")}" aria-label="${t("app.next_resolution_step")}">${pictogram("step")}</button>` : `<div class="basics-complete"><p>${t("basics.planning_against_a_clock_and_carrying_out_turns")}</p><button data-lesson="first-shot" class="primary">${t("basics.next_your_first_shot")}</button></div>`) : ""}`
}`;
}

103
preview/i18n.js Normal file
View file

@ -0,0 +1,103 @@
// Only filenames are bundled. Capture the entry URL while the classic BGS
// script is executing; neither the host page nor its <base> owns our assets.
const sourceFiles = { en: "locales/en.json", fr: "locales/fr.json" };
const files = typeof BGS_LOCALES === "undefined" ? sourceFiles : BGS_LOCALES;
const assetBase = new URL(".", import.meta.url);
export function normalizeLocale(value = "en", available = Object.keys(files)) {
const tag = String(value).replaceAll("_", "-").toLowerCase();
return (
available.find((locale) => locale.toLowerCase() === tag) ??
available.find((locale) => locale.toLowerCase() === tag.split("-")[0]) ??
"en"
);
}
async function readCatalog(url) {
// The same catalogs are used by Node's deterministic tutorial tests.
if (url.protocol === "file:")
return (await import(url.href, { with: { type: "json" } })).default;
const response = await fetch(url);
if (!response.ok) throw Error(`Language file: HTTP ${response.status}`);
return response.json();
}
export function createLocaleLoader(manifest, base, read = readCatalog) {
const catalogs = new Map(),
pending = new Map();
const normalize = (value) => normalizeLocale(value, Object.keys(manifest));
async function load(value) {
const locale = normalize(value);
if (catalogs.has(locale)) return locale;
if (!pending.has(locale)) {
pending.set(
locale,
Promise.resolve()
.then(() => read(new URL(manifest[locale], base)))
.then((catalog) => {
if (
!catalog ||
typeof catalog !== "object" ||
Array.isArray(catalog) ||
Object.values(catalog).some((text) => typeof text !== "string")
)
throw Error("Invalid language file");
catalogs.set(locale, catalog);
return locale;
})
.finally(() => pending.delete(locale)),
);
}
try {
return await pending.get(locale);
} catch (error) {
// A failed request is not cached: selecting that language again retries.
if (locale !== "en") return load("en");
throw error;
}
}
function translate(locale, key, params = {}) {
const text =
catalogs.get(normalize(locale))?.[key] ?? catalogs.get("en")?.[key];
if (text === undefined) throw Error(`Missing loaded translation: ${key}`);
return text.replace(/\{(\w+)\}/g, (match, name) =>
params[name] === undefined ? match : String(params[name]),
);
}
return {
load,
translate,
has: (locale, key) =>
Object.hasOwn(catalogs.get(normalize(locale)) ?? {}, key),
};
}
const loader = createLocaleLoader(files, assetBase);
export const loadLocale = loader.load;
export const translate = loader.translate;
// Live BGS preference updates may race network requests. Only the last request
// is allowed to change the visible language; destruction also invalidates it.
export function createLocaleSelection(apply, load = loadLocale) {
let revision = 0;
return {
async set(value) {
const attempt = ++revision;
const locale = await load(value);
if (attempt !== revision) return false;
apply(locale);
return true;
},
destroy() {
revision++;
},
};
}
export function lessonCopy(id, locale) {
const prefix = `lesson.${id}`;
const instructions = [];
for (let i = 0; loader.has(locale, `${prefix}.instruction.${i}`); i++)
instructions.push(translate(locale, `${prefix}.instruction.${i}`));
return { title: translate(locale, `${prefix}.title`), instructions };
}

View file

@ -1,5 +1,5 @@
<!doctype html>
<html lang="fr">
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
@ -12,12 +12,12 @@
>✦ <span>SPACE ALERT<small>SITTING DUCK</small></span></a
>
<div class="header-tools">
<select id="seat" aria-label="Joueur"></select
<select id="seat" aria-label=""></select
><button
id="sound"
class="quiet"
aria-pressed="false"
title="Annonces vocales"
title=""
>
♫
</button>
@ -61,7 +61,7 @@
<div class="section-heading">
<h2 id="program-title"></h2>
</div>
<select id="program-crew" aria-label="Équipier à programmer"></select>
<select id="program-crew" aria-label=""></select>
<div id="program" class="program"></div>
<p id="player-help"></p>
<div id="controls" class="controls"></div>
@ -83,7 +83,7 @@
>
<div class="dialog-header">
<h2 id="menu-title"></h2>
<button type="button" data-close-dialog aria-label="Fermer">×</button>
<button type="button" data-close-dialog aria-label="">×</button>
</div>
<div class="dialog-body">
<section id="journal" data-panel-content hidden>
@ -95,91 +95,88 @@
<section id="setup" data-panel-content hidden>
<form id="new-session">
<label id="players-label"
>Joueurs
<select id="players">
<option value="1">Solo · 4 androïdes</option>
<option value="2">2 + 2 androïdes</option>
<option value="3">3 + 1 androïde</option>
<option value="4" selected>4</option>
<option value="5">5</option>
> <select id="players">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
<option value="4" selected></option>
<option value="5"></option>
</select></label
><label
>Équipage<select id="crew-size">
<option value="0">Standard</option>
<option value="5">5 équipiers (androïde supplémentaire)</option>
<option value="3">3 joueurs sans androïde</option>
> <select id="crew-size">
<option value="0"></option>
<option value="5"></option>
<option value="3"></option>
</select></label
><label
>Mission
<select id="mission"></select></label
> <select id="mission"></select></label
><label id="special-label"
>Spécialisations
<select id="specialization">
<option value="">Aucune</option>
<option value="1">Niveau 1</option>
<option value="2">Niveau 2</option>
<option value="3">Niveau 3</option>
> <select id="specialization">
<option value=""></option>
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select></label
><label
>Menaces<select id="threat-expansion">
<option value="0">Jeu de base</option>
<option value="1">+ The New Frontier</option>
> <select id="threat-expansion">
<option value="0"></option>
<option value="1"></option>
</select></label
>
<label
>Menaces communes<select id="difficulty">
<option value="1">Niveau 1</option>
<option value="1,2">Niveaux 1 + 2</option>
<option value="2">Niveau 2</option>
<option value="1,2,3">Tous les niveaux</option>
<option value="2,3">Niveaux 2 + 3</option>
<option value="3">Niveau 3</option>
> <select id="difficulty">
<option value="1"></option>
<option value="1,2"></option>
<option value="2"></option>
<option value="1,2,3"></option>
<option value="2,3"></option>
<option value="3"></option>
</select></label
>
<label
>Menaces sérieuses<select id="serious-difficulty">
<option value="1">Niveau 1</option>
<option value="1,2">Niveaux 1 + 2</option>
<option value="2">Niveau 2</option>
<option value="1,2,3">Tous les niveaux</option>
<option value="2,3">Niveaux 2 + 3</option>
<option value="3">Niveau 3</option>
> <select id="serious-difficulty">
<option value="1"></option>
<option value="1,2"></option>
<option value="2"></option>
<option value="1,2,3"></option>
<option value="2,3"></option>
<option value="3"></option>
</select></label
>
<label
>Format<select id="campaign-limit">
<option value="0">Mission unique</option>
<option value="3">Campagne · 3 missions</option>
<option value="5">Campagne · 5 missions</option>
> <select id="campaign-limit">
<option value="0"></option>
<option value="3"></option>
<option value="5"></option>
</select></label
>
<label
>Expérience<select id="careers-enabled">
<option value="0">Partie libre</option>
<option value="1">Carrières enregistrées</option>
> <select id="careers-enabled">
<option value="0"></option>
<option value="1"></option>
</select></label
>
<div id="career-seats" class="token-controls"></div>
<div id="specialists" class="token-controls"></div>
<button type="submit" id="new-button">Préparer la mission</button>
<button type="submit" id="new-button"></button>
</form>
<button id="ready-all" class="quiet">Tout l’équipage est prêt</button
><button id="next-event" class="quiet">Prochaine annonce</button>
<button id="ready-all" class="quiet"></button
><button id="next-event" class="quiet"></button>
</section>
<section id="career-manager" data-panel-content hidden>
<form id="create-explorer">
<label
>Nom<input
> <input
id="explorer-name"
required
maxlength="80"
autocomplete="off" /></label
><label
>Clonage<select id="explorer-cloning">
<option value="1">Autorisé</option>
<option value="0">Hardcore · mort définitive</option>
> <select id="explorer-cloning">
<option value="1"></option>
<option value="0"></option>
</select></label
><button id="create-explorer-button">Créer un explorateur</button>
><button id="create-explorer-button"></button>
</form>
<div id="explorers"></div>
</section>
@ -196,7 +193,7 @@
>
<div class="dialog-header">
<h2 id="choice-title"></h2>
<button type="button" data-close-dialog aria-label="Fermer">×</button>
<button type="button" data-close-dialog aria-label="">×</button>
</div>
<div id="choice-list" class="dialog-body choice-list"></div>
</dialog>

View file

@ -1,2 +1,6 @@
import { mountConsole } from "./app.js";
import { loadLocale } from "./i18n.js";
document.body.lang = await loadLocale(
new URL(location.href).searchParams.get("locale") ?? "en",
);
mountConsole(document.body);

595
preview/locales/en.json Normal file
View file

@ -0,0 +1,595 @@
{
"lesson.basics.title": "Start here: planning turns",
"lesson.first-shot.title": "Your first shot",
"lesson.first-shot.instruction.0": "Destroy the target with the highlighted laser.",
"lesson.energy.title": "Energy and coordination",
"lesson.energy.instruction.0": "Power the central laser for four shots.",
"lesson.energy.instruction.1": "Android 1: weapons on turns 1–4. Android 3: lift, then energy to refill the reactor.",
"lesson.repairs.title": "Repairing a malfunction",
"lesson.repairs.instruction.0": "Repair the highlighted malfunction.",
"lesson.repairs.instruction.1": "→ on turn 1, then energy on turns 2–4.",
"lesson.battlebots.title": "Battlebots and interceptors",
"lesson.battlebots.instruction.0": "Collect the battlebots, then reach the interceptors.",
"lesson.battlebots.instruction.1": "→ · systems · ← · ← · systems. In flight, play battlebots to fire; leave a slot empty to return.",
"lesson.double-actions.title": "Two actions, in order",
"lesson.double-actions.instruction.0": "Move and fire with one card.",
"lesson.double-actions.instruction.1": "Compare → + weapons with weapons + →: the order determines which laser fires.",
"lesson.phasing.title": "Expansion threats",
"lesson.phasing.instruction.0": "Hit the fighter while it is visible.",
"lesson.phasing.instruction.1": "Weapons on turns 1–3. Watch the missed shot while it is phased out.",
"lesson.specializations.title": "Specializations",
"lesson.specializations.instruction.0": "Launch a rocket remotely with the Rocketeer.",
"lesson.specializations.instruction.1": "Program the basic ability on turn 1. The rocket hits next turn.",
"app.weapons": "Weapons",
"app.energy": "Energy",
"app.systems": "Systems",
"app.player": "Player",
"app.rocketeer": "Rocketeer",
"app.data_analyst": "Data Analyst",
"app.energy_technician": "Energy Technician",
"app.pulse_gunner": "Pulse Gunner",
"app.medic": "Medic",
"app.teleporter": "Teleporter",
"app.hypernavigator": "Hypernavigator",
"app.special_ops": "Special Ops",
"app.squad_leader": "Squad Leader",
"app.mechanic": "Mechanic",
"app.weapons_fire_or_repair": "Weapons · Fire or repair",
"app.energy_transfer_or_repair": "Energy · Transfer or repair",
"app.systems_operate_or_repair": "Systems · Operate or repair",
"app.battlebot_attack": "Battlebot · Attack",
"app.move_left": "Move left",
"app.move_right": "Move right",
"app.change_deck": "Change deck",
"app.advanced": "advanced",
"app.basic": "basic",
"app.heroic_move": "Heroic move · ",
"app.heroic": "Heroic · ",
"app.mute_voice_announcements": "Mute voice announcements",
"app.enable_voice_announcements": "Enable voice announcements",
"app.serious_threat": "Serious threat",
"app.threat": "Threat",
"app.internal": "internal",
"app.phase_begins": "Phase {phase} begins",
"app.phase_ends_in_seconds": "Phase {phase} ends in {seconds} seconds",
"app.incoming_data_draw_a_card": "Incoming data · draw a card",
"app.data_transfer_opens": "Data transfer opens",
"app.data_transfer_complete": "Data transfer complete",
"app.communications_down_silence": "Communications down · silence",
"app.communications_restored": "Communications restored",
"app.viewpoint": "Viewpoint",
"app.crew_to_program": "Crew to program",
"app.players": "Players",
"app.crew": "Crew",
"app.mission": "Mission",
"app.threats": "Threats",
"app.common_threats": "Common threats",
"app.serious_threats": "Serious threats",
"app.format": "Format",
"app.experience": "Experience",
"app.name": "Name",
"app.cloning": "Cloning",
"app.solo_4_androids": "Solo · 4 androids",
"app.2_2_androids": "2 + 2 androids",
"app.3_1_android": "3 + 1 android",
"app.4": "4",
"app.5": "5",
"app.standard": "Standard",
"app.5_crew_extra_android": "5 crew (extra android)",
"app.3_players_without_android": "3 players without android",
"app.none": "None",
"app.level_1": "Level 1",
"app.level_2": "Level 2",
"app.level_3": "Level 3",
"app.base_game": "Base game",
"app.the_new_frontier": "+ The New Frontier",
"app.single_mission": "Single mission",
"app.campaign_3_missions": "Campaign · 3 missions",
"app.campaign_5_missions": "Campaign · 5 missions",
"app.free_play": "Free play",
"app.saved_careers": "Saved careers",
"app.allowed": "Allowed",
"app.hardcore_permanent_death": "Hardcore · permanent death",
"app.levels_1_2": "Levels 1 + 2",
"app.all_levels": "All levels",
"app.levels_2_3": "Levels 2 + 3",
"app.prepare_mission": "Prepare mission",
"app.ready_all_crew": "Ready all crew",
"app.next_announcement": "Next announcement",
"app.create_explorer": "Create explorer",
"app.android_1": "Android 1",
"app.crew_report_in": "Crew, report in",
"app.stand_by_for_launch": "Stand by for launch",
"app.back_to_base": "Back to base",
"app.ship_lost": "Ship lost",
"app.mission_resolution": "Mission resolution",
"app.launch_cancelled": "Launch cancelled",
"app.phase": "Phase",
"app.ready": "ready",
"app.waiting": "waiting",
"app.the_ship": "The ship",
"app.detected_threats": "Detected threats",
"app.flight_program": "Flight program",
"app.pause_clock": "Pause clock",
"app.start_practice_clock": "Start practice clock",
"app.phase_2": "Phase 2",
"app.finish_programming": "Finish programming",
"app.restart": "Restart",
"app.communications_online": "Communications online",
"app.communications_down_stay_silent": "Communications down: stay silent",
"app.silence": "Silence",
"app.phase_ed3301": "PHASE",
"app.android": "Android",
"app.destination": "Destination",
"app.fuel": "Fuel",
"app.rockets": "Rockets",
"app.computer": "Computer",
"app.maintained": "maintained",
"app.not_maintained": "not maintained",
"app.battlebots_available_squads": "Battlebots · Available squads",
"app.squads": "squads",
"app.crew_49685c": "Crew",
"app.range": "range",
"app.knocked_out": "knocked out",
"app.turn": "Turn",
"app.details": "Details",
"app.arrival_on_turn": "Arrival on turn",
"app.arrival": "Arrival",
"app.spaces_per_turn": "spaces per turn",
"app.awaiting_the_first_detections": "Awaiting the first detections.",
"app.programming_complete_resolving_actions": "Programming complete · resolving actions",
"app.launch_cancelled_not_everyone_confirmed_within_two_minutes": "Launch cancelled: not everyone confirmed within two minutes. Create a new session to try again.",
"app.everyone_confirms_their_presence_before_launch": "Everyone confirms their presence before launch.",
"app.movement": "Movement",
"app.action": "Action",
"app.empty": "Empty",
"app.target_arrives_before_this_shot": "Target arrives before this shot",
"app.choose_a_turn_for_this_card": "Choose a turn for this card.",
"app.click_a_card_to_fill_the_next_turn": "Click a card to fill the next turn. Click a filled turn to clear it; Backspace undoes the last placement.",
"app.ready_lasts_two_minutes_we_wait_until_everyone": "Ready lasts two minutes. We wait until everyone is ready together.",
"app.programs_are_locked_advance_resolution_or_review_its": "Programs are locked. Advance resolution or review its steps.",
"app.not_ready_yet": "Not ready yet",
"app.connecting": "Connecting…",
"app.i_m_ready": "I’m ready",
"app.next_phase": "Next phase →",
"app.lock_my_program": "Lock my program",
"app.draw": "Draw",
"app.android_card": "Android card",
"app.next_resolution_step": "Next resolution step",
"app.resolve_mission": "Resolve mission",
"app.new_session": "New session",
"app.combine_two_cards": "Combine two cards",
"app.all_cards": "All cards",
"app.movement_d9fd7b": "Movement",
"app.teleport": "Teleport",
"app.to": "To",
"app.set_tokens": "Set tokens",
"app.move_tokens_during_data_transfer_their_final_positions": "Move tokens during data transfer. Their final positions are used during resolution.",
"app.send_to": "Send to",
"app.score": "Score",
"app.threats_87b951": "threats",
"app.visual": "visual",
"app.penalties": "penalties",
"app.appearances": "Appearances",
"app.crew_actions": "Crew actions",
"app.damage": "Damage",
"app.threat_actions": "Threat actions",
"app.review_a_step": "Review a step",
"app.back_to_live": "Back to live",
"app.laser": "Laser",
"app.pulse": "Pulse",
"app.shield": "Shield",
"app.reactor": "Reactor",
"app.battlebots": "Battlebots",
"app.interceptors": "Interceptors",
"app.visual_confirmation": "Visual confirmation",
"app.rocket": "Rocket",
"app.hit_points": "Hit points",
"app.left_center_and_right_correspond_to_red_white": "Left, center and right correspond to red, white and blue in the original announcements. Each threat’s miniature map shows its trajectory or affected rooms.",
"app.plan_choose_a_card_then_a_turn_click": "<p><b>Plan.</b> Choose a card then a turn; click a filled turn to retrieve its card. A operates a weapon, B transfers energy, C uses the station system. Arrows move your crew member. Planning does not move the real ship pieces; programs execute during resolution.</p><p><b>Coordinate.</b> Each weapon fires once per turn. Heavy lasers and pulse draw from the zone reactor; light lasers have their own battery. A second crew member using the same lift is delayed.</p><p><b>Computer.</b> Someone must perform C on the bridge within the first two turns of each phase (1–2, 4–5, 8–9), or the next actions are delayed.</p><p><b>Threats.</b> Combine fire before subtracting enemy shields. Rockets hit on the following turn. Threats move after crew actions and execute X, Y and Z as they cross them.</p><p><b>Remote cooperation.</b> Use external voice chat. Stay silent during communications blackouts; this page cannot mute your call.</p>",
"app.reinforcement": "Reinforcement",
"app.speed": "Speed",
"app.forecast_without_crew_intervention_includes_the_threat_s": "Forecast without crew intervention; includes the threat’s own speed changes.",
"app.approach_track": "Approach track",
"app.no_effect": "No effect",
"app.space": "Space",
"app.spaces": "spaces",
"app.choose_explorer": "Choose explorer",
"app.no_specialization": "No specialization",
"app.campaign": "Campaign",
"app.continuing_requires_everyone_s_agreement_returning_ends_the": "Continuing requires everyone’s agreement. Returning ends the campaign before repairs.",
"app.continue": "Continue",
"app.return_to_base": "Return to base",
"app.repair_for_crew": "Repair for crew",
"app.skip_repair": "Skip repair",
"app.next_mission": "Next mission",
"app.next_mission_the_one_selected_in_setup": "Next mission: the one selected in setup.",
"app.if_one_battlebot_squad_remains": "If one battlebot squad remains:",
"app.next_mission_bda8db": "Next mission",
"app.campaign_score": "Campaign score",
"app.level_s_to_assign": "level(s) to assign",
"app.official_achievement_requirements": "Official achievement requirements",
"app.requirements_checked_crew_agrees_where_required": "Requirements checked; crew agrees where required.",
"app.achievement": "Achievement",
"app.record_achievement": "Record achievement",
"app.level": "Level",
"app.on_mission": "on mission",
"app.cloning_enabled": "Cloning enabled",
"app.hardcore": "Hardcore",
"app.clone_s": "clone(s)",
"app.consent_to_cloning": "Consent to cloning",
"app.new_explorer": "New explorer",
"app.choose": "Choose",
"app.reconnecting": "RECONNECTING",
"app.card_unavailable": "Card unavailable",
"app.check_the_achievement_requirements_before_recording_it": "Check the achievement requirements before recording it.",
"app.this_permanently_locks_the_current_phase_continue": "This permanently locks the current phase. Continue?",
"app.announcements_enabled": "Announcements enabled",
"app.paused": " · paused",
"app.paused_afa0b8": "Paused",
"app.waiting_bade46": "Waiting",
"app.until_jump": "until jump",
"app.ready_for": "ready for",
"text.left": "Left",
"text.center": "Center",
"text.right": "Right",
"text.launch_a_rocket_from_any_station_a_remote": "Launch a rocket from any station. A remote repair cannot finish a malfunction.",
"text.lower_right_launch_two_rockets_as_a_strength": "Lower right: launch two rockets as a strength-5 shot. Elsewhere: perform C.",
"text.maintain_the_computer_remotely_and_gain_1_point": "Maintain the computer remotely and gain 1 point.",
"text.visual_confirmation_counts_as_three_crew_members_elsewhere": "Visual confirmation counts as three crew members. Elsewhere: perform C.",
"text.refuel_the_central_reactor_with_one_capsule_from": "Refuel the central reactor with one capsule from any station.",
"text.upper_deck_temporary_shields_of_2_in_your": "Upper deck: temporary shields of 2 in your zone and 1 elsewhere, for this turn.",
"text.fire_the_local_laser_and_pulse_cannon_if": "Fire the local laser and pulse cannon if both can operate. At the pulse station: normal fire.",
"text.pulse_strength_2_in_normal_range_strength_1": "Pulse: strength 2 in normal range, strength 1 one range farther. Elsewhere: perform A.",
"text.before_the_captain_enhance_the_first_a_b": "Before the captain: enhance the first A, B or battlebot action of crew in your station this turn. May accompany one movement.",
"text.before_the_captain_nobody_with_you_can_be": "Before the captain: nobody with you can be knocked out this turn; −1 point. Protection follows you. May accompany one movement.",
"text.teleport_the_departure_token_crew_member_to_the": "Teleport the departure-token crew member to the arrival-token crew member. Assign tokens during data transfer.",
"text.from_a_side_zone_teleport_to_the_opposite": "From a side zone: teleport to the opposite zone on the other deck.",
"text.lower_deck_all_threats_move_one_fewer_space": "Lower deck: all threats move one fewer space this turn.",
"text.lower_center_on_turn_10_or_11_finish": "Lower center on turn 10 or 11: finish this turn, then skip to the final turn without crew actions.",
"text.prepare_your_next_a_b_or_battlebot_action": "Prepare your next A, B or battlebot action: it becomes heroic.",
"text.combine_with_another_card_protect_its_execution_from": "Combine with another card: protect its execution from direct delays, obstacles and effects against you during the action.",
"text.active_battlebots_repair_one_damage_in_your_zone": "Active battlebots repair one damage in your zone, prioritizing weapons. Disabled battlebots are reactivated.",
"text.with_active_battlebots_except_in_lower_right_reach": "With active battlebots, except in lower right: reach the interceptors and launch. Already in space: heroic attack.",
"text.prepare_the_local_weapon_1_strength_on_its": "Prepare the local weapon: +1 strength on its next laser shot, or +1 range for pulse.",
"text.repair_a_local_a_b_or_c_malfunction": "Repair a local A, B or C malfunction by 2, prioritizing the lowest threat number.",
"text.untargetable_until_x_weapons_ignore_it": "Untargetable until X: weapons ignore it.",
"text.cryoshield_absorbs_the_first_volley_regardless_of_strength": "Cryoshield absorbs the first volley regardless of strength.",
"text.ignore_its_shields_when_pulse_targets_it_this": "Ignore its shields when pulse targets it this turn.",
"text.rockets_ignore_this_threat": "Rockets ignore this threat.",
"text.rockets_can_target_it_but_deal_no_damage": "Rockets can target it but deal no damage.",
"text.heavy_lasers_ignore_this_threat": "Heavy lasers ignore this threat.",
"text.all_rockets_target_it_even_outside_range_1": "All rockets target it, even outside range; +1 shield after a rocket.",
"text.lone_interceptor_target_strength_9_but_the_pilot": "Lone interceptor target: strength 9, but the pilot is knocked out and battlebots disabled.",
"text.after_receiving_damage_attack_1_on_each_zone": "After receiving damage, attack 1 on each zone at the end of damage calculation.",
"text.destroyed_deals_1_damage_to_every_other_external": "Destroyed: deals 1 damage to every other external threat, ignoring shields.",
"text.returns_fire_disables_attacking_battlebots_unless_their_attack": "Returns fire: disables attacking battlebots unless their attack is heroic.",
"text.after_x_disables_attacking_battlebots_unless_their_attack": "After X, disables attacking battlebots unless their attack is heroic.",
"text.hit_points_equal_the_rockets_remaining_when_it": "Hit points equal the rockets remaining when it appears.",
"text.final_repair_knocks_out_crew_in_lower_left": "Final repair knocks out crew in lower left and lower right.",
"text.destroyed_knocks_out_its_attacker_and_disables_battlebots": "Destroyed: knocks out its attacker and disables battlebots, even after a heroic attack.",
"text.each_battlebot_attack_clears_a_station_clearing_the": "Each battlebot attack clears a station. Clearing the third also clears the last.",
"text.entering_delays_the_next_action_original_2_hit": "Entering delays the next action. Original: 2 hit points; each progeny: 1.",
"text.a_rocket_sends_it_off_course_it_will": "A rocket sends it off course: it will not perform its Z attack.",
"text.each_turn_it_is_targeted_loses_1_shield": "Each turn it is targeted, loses 1 shield after damage.",
"text.alternates_visible_phased_out_while_phased_out_cannot": "Alternates visible / phased out. While phased out, cannot be hit and uses bracketed effects.",
"text.add_laser_strength_and_halve_it_rounding_up": "Add laser strength and halve it, rounding up; add other weapons before shields.",
"text.lasers_in_all_three_zones_can_target_it": "Lasers in all three zones can target it. Each weapon only hits it once per turn.",
"text.stops_at_z_if_still_present_at_the": "Stops at Z. If still present at the jump, performs its Z attack.",
"text.gains_1_speed_after_each_threat_actions_step": "Gains 1 speed after each Threat Actions step.",
"text.speed_2_this_turn_if_weapon_fire_deals": "Speed 2 this turn if weapon fire deals damage; otherwise speed 4.",
"text.energy_absorbed_by_ship_shields_during_its_attacks": "Energy absorbed by ship shields during its attacks heals it by that amount.",
"text.the_final_repair_consumes_1_local_reactor_energy": "The final repair consumes 1 local reactor energy; it cannot finish with an empty reactor.",
"text.starts_in_upper_left_on_an_odd_threat": "Starts in upper left on an odd threat number, upper right on an even number.",
"text.blocks_pulse_every_central_heavy_laser_shot_triggers": "Blocks pulse. Every central heavy-laser shot triggers an attack 1 on every zone.",
"text.from_appearance_ninja_poisons_movements_starting_or_ending": "From appearance, Ninja poisons movements starting or ending in upper right or lower center. After destruction, only already-poisoned crew remain threatened until Z.",
"text.existing_infections_persist_until_z_even_after_its": "Existing infections persist until Z, even after its destruction.",
"text.whenever_damaged_all_crew_aboard_change_decks": "Whenever damaged, all crew aboard change decks.",
"text.at_z_a_surprise_common_internal_threat_resolves": "At Z, a surprise common internal threat resolves all its actions.",
"text.after_taking_damage_teleports_to_upper_left": "After taking damage, teleports to upper left.",
"text.if_not_destroyed_before_the_jump_knocks_out": "If not destroyed before the jump, knocks out all crew. Sabotaged systems are repaired separately.",
"text.attaches_to_the_first_crew_member_who_moves": "Attaches to the first crew member who moves, then follows them. Only another crew member can attack it. Destroying it knocks out its host; if the host is knocked out earlier, the threat survives.",
"text.targetable_only_at_range_or_less": "Targetable only at range {maxTargetRange} or less.",
"text.at_most_weapon_damage_per_turn": "At most {damageCap} weapon damage per turn.",
"text.destroyed_attack_strength_per_x_y_already_crossed": "Destroyed: attack strength {asteroid} per X/Y already crossed.",
"text.requires_different_repairers_in_the_same_turn": "Requires {simultaneousRepairs} different repairers in the same turn.",
"text.repair_if_all_its_stations_are_repaired_in": "+{multiRepairBonus} repair if all its stations are repaired in the same turn.",
"text.interceptors_in_its_range_or_closer_reduce_its": "Interceptors in its range or closer reduce its attacks by {carrier}.",
"text.absorbs_the_first_damage_each_turn": "Absorbs the first {inaccessibility} damage each turn.",
"text.exactly_one_repairer_this_turn_repair": "Exactly one repairer this turn: +{loneRepair} repair.",
"text.with_active_battlebots_repair": "With active battlebots: +{botsRepairBonus} repair.",
"text.left_109c98": "left",
"text.center_3e2797": "center",
"text.right_835203": "right",
"text.shield": "shield",
"text.reactor": "reactor",
"text.speed": "speed",
"text.fragments": "fragments",
"text.half_the_damage_rounded_down": "half the damage, rounded down",
"text.remaining_hit_points": "remaining hit points",
"text.2_remaining_hit_points": "2 × remaining hit points",
"text.3_remaining_hit_points": "3 × remaining hit points",
"text.crew_present": "crew present",
"text.all_zones": "all zones",
"text.other_zones": "other zones",
"text.side_zones": "side zones",
"text.each_occupied_zone": "each occupied zone",
"text.each_occupied_station": "each occupied station",
"text.in_its_stations": "in its stations",
"text.in_its_zone": "in its zone",
"text.leading_active_battlebots": "leading active battlebots",
"text.in_its_station_without_active_battlebots": "in its station without active battlebots",
"text.outside_the_bridge": "outside the bridge",
"text.change_deck": "change deck",
"text.double_damage_after_shields": "double damage after shields",
"text.plasma_knockout_if_no_damage_absorbed": "plasma: knockout if no damage absorbed",
"text.ignore_shields": "ignore shields",
"text.becomes_targetable": "becomes targetable",
"text.grows_returns_fire": "grows: returns fire",
"text.1_attack_to_other_external_threats_until_destroyed": "+1 attack to other external threats until destroyed",
"text.1_shield_to_all_external_threats_until_destroyed": "+1 shield to all external threats until destroyed",
"text.double_damage_to_left_zone": "double damage to left zone",
"text.double_damage_to_all_zones": "double damage to all zones",
"text.entering_a_contaminated_station_causes_knockout": "entering a contaminated station causes knockout",
"text.weapon_already_fired": "weapon already fired",
"text.empty_reactor": "empty reactor",
"text.no_fuel": "no fuel",
"text.system_irreparable_or_remote_final_repair_prohibited": "system irreparable or remote final repair prohibited",
"text.no_rocket_available_or_already_launched_this_turn": "no rocket available or already launched this turn",
"text.both_linked_weapons_cannot_fire": "both linked weapons cannot fire",
"text.ultrafast_return": "ultrafast return",
"text.upper_weapon": "upper weapon",
"text.lower_weapon": "lower weapon",
"text.structure": "structure",
"text.inaccessibility": "inaccessibility",
"text.direct_damage": "direct damage",
"text.shields_apply": "shields apply",
"text.reactor_energy_1": "reactor energy + 1",
"text.alone_in_their_station": "alone in their station",
"text.sharing_their_station_with_another_crew_member": "sharing their station with another crew member",
"text.subsequent_attacks_drain_shields_and_add_that_energy": "subsequent attacks drain shields and add that energy to damage",
"text.subsequent_attacks_ignore_shields": "subsequent attacks ignore shields",
"text.poisons_crew_starting_or_ending_a_movement_in": "poisons crew starting or ending a movement in upper right or lower center",
"text.doors_to_left_zone_sealed": "doors to left zone sealed",
"text.doors_to_right_zone_sealed": "doors to right zone sealed",
"text.sealed_door": "sealed door",
"text.cyber_gremlin_still_present_at_jump": "Cyber Gremlin still present at jump",
"text.attack": "Attack",
"text.heal": "Heal",
"text.drain": "Drain",
"text.all_energy": "all energy",
"text.move": "Move",
"text.drain_1_reactor_energy_or_deal_1_damage": "Drain 1 reactor energy, or deal 1 damage if it is empty.",
"text.knock_out_crew": "Knock out crew",
"text.delay_crew": "Delay crew",
"text.each_slime_spreads_one_station_toward_the_opposite": "Each Slime spreads one station toward the opposite side.",
"text.destroy_one_stored_rocket": "Destroy one stored rocket.",
"text.disable_stored_battlebots_in_lower_left": "Disable stored battlebots in lower left.",
"text.destroy_one_fuel_capsule": "Destroy one fuel capsule.",
"text.take_damage": "Take {amount} damage.",
"text.move_to_the_adjacent_station_with_most_crew": "Move to the adjacent station with most crew; stay on a tie.",
"text.advance_other_internal_threats_one_space_executing_crossed": "Advance other internal threats one space, executing crossed effects.",
"text.advance_other_external_threats_one_space_executing_crossed": "Advance other external threats one space, executing crossed effects.",
"text.destroy_the_ship": "Destroy the ship.",
"text.fill_its_shield_from_its_reactor": "Fill its shield from its reactor.",
"text.empty_and_deal_that_much_damage": "Empty {value1} and deal that much damage{value2}.",
"text.jump_to_the_trajectory_at_the_same_distance": "Jump to the {value1} trajectory at the same distance, if space exists.",
"text.external": "external",
"text.same_zone": "same zone",
"text.spawn_the_assigned_reinforcement": "Spawn the assigned {value1} reinforcement{value2}.",
"text.if_fewer_than_2_damage_reinforcement_speed_1": "If fewer than 2 damage: reinforcement speed +1.",
"text.internal": "internal",
"text.external_cf2f09": "external",
"text.heal_damage_from_all_threats": "Heal {amount} damage from all {value1} threats.",
"text.knock_out_crew_leading_active_battlebots_delay_the": "Knock out crew leading active battlebots; delay the rest.",
"text.advance_zone_threats_by_executing_crossed_effects": "Advance {value1} zone threats by {amount}, executing crossed effects.",
"text.deal_damage_to_the_opposite_side_zone": "Deal {amount} damage to the opposite side zone.",
"text.fuel_capsule": "fuel capsule",
"text.central_reactor_energy": "central reactor energy",
"text.consume_1_to_attack_each_zone_for_1": "Consume 1 {value1} to attack each zone for 1.",
"text.move_one_station_toward_the_most_damaged_zone": "Move one station toward the most damaged zone; ties: toward the center.",
"text.crew_present_deal_2_zone_damage_otherwise_heal": "Crew present: deal 2 zone damage. Otherwise heal 1.",
"text.a_side_zone": "a side zone",
"text.center_e08431": "center",
"text.obscure_targeting_visual_confirmation_or_interceptors_are_required": "Obscure {value1} targeting. Visual confirmation or interceptors are required for laser fire there.",
"text.place_a_mine_in_its_station": "Place a mine in its station.",
"text.each_mine_deals_2_damage_to_its_zone": "Each mine deals 2 damage to its zone.",
"text.infect_all_crew_in_its_station": "Infect all crew in its station.",
"text.each_conscious_infected_crew_member_aboard_deals_2": "Each conscious infected crew member aboard deals 2 damage to their zone.",
"text.knock_out_poisoned_crew_if_ninja_is_still": "Knock out poisoned crew. If Ninja is still alive, each remaining rocket causes an attack 2 on the left, then is destroyed.",
"text.repeat_this_turn_s_actions_next_turn_delaying": "Repeat this turn’s actions next turn, delaying the programs.",
"text.crew_in_side_zones_swap_left_right_without": "Crew in side zones swap left / right without changing deck.",
"text.reveal_the_surprise_threat_resolve_its_appearance_x": "Reveal the surprise threat; resolve its appearance, X, Y and Z.",
"text.empty_the_local_reactor_and_gain_that_much": "Empty the local reactor and gain that much speed.",
"text.sabotage_a_b_and_c_in_its_station": "Sabotage A, B and C in its station; each needs one repair.",
"text.drain_1_energy_from_the_host_station_s": "Drain 1 energy from the host station’s B system.",
"text.knock_out_other_crew_sharing_the_host_s": "Knock out other crew sharing the host’s station.",
"text.5_direct_damage_to_the_host_s_zone": "5 direct damage to the host’s zone; host in space: attack 5 in the center.",
"text.phased_out": " [phased out: {phasedAmount}]",
"text.phased_out_ba3fa3": " [phased out: {value1}]",
"text.only_when_visible": " (only when visible)",
"text.if_crew_is_present": " (if crew is present)",
"text.if_damaged": " (if damaged)",
"text.if_undamaged": " (if undamaged)",
"text.if_fewer_than_damage": " (if fewer than {belowDamage} damage)",
"text.unless_off_course": " (unless off course)",
"text.reinforcement_called": "Reinforcement called",
"text.change_trajectory": "Change trajectory → {value1}",
"text.parasite_attached": "Parasite attached",
"text.threat_appears": "Threat appears",
"text.threat_destroyed": "Threat destroyed",
"text.threat_survived": "Threat survived",
"text.action": "Action {mark}",
"text.damage_after_shields": "{damage} damage after {shield} shields",
"text.cryoshield_broken": "Cryoshield broken",
"text.": "{value1} → {value2}",
"text.teleport": "Teleport → {value1}",
"text.fire_strength_range": "Fire {value1}, strength {strength}, range {range}",
"text.transfer_energy": "Transfer {amount} energy · {value1} · {value2}",
"text.computer_maintained_phase": "Computer maintained · phase {phase}",
"text.computer_missed_phase": "Computer missed · phase {phase}",
"text.rocket_s_launched": "{count} rocket(s) launched",
"text.interceptor_launch": "Interceptor launch",
"text.battlebots_activated": "Battlebots activated",
"text.battlebots_reactivated": "Battlebots reactivated",
"text.battlebot_attack_damage": "Battlebot attack: {value1} damage",
"text.repair_damage": "Repair {amount} damage",
"text.simultaneous_repair_attempted": "Simultaneous repair attempted",
"text.repair": "Repair {value1} · {value2}",
"text.final_action_lost": "; final action lost",
"text.program_delayed_from_t": "Program delayed from T+{from}{value1}",
"text.knocked_out": "Knocked out · {value1}",
"text.no_effect": "No effect · {value1}",
"text.damage": "Damage {value1} · {value2}",
"text.ship_destroyed": "Ship destroyed",
"text.attack_absorbed_remaining": "Attack {value1}: {absorbed} absorbed, {damage} remaining",
"basics.arrows_move_change_deck_backspace_undo_enter_run": "Arrows: move · ↑/↓: change deck · Backspace: undo · Enter: run",
"basics.shortcuts_arrow_keys_to_move_backspace_to_undo": "Shortcuts: arrow keys to move; Backspace to undo; Enter to run",
"basics.actions_placed": "actions placed",
"basics.run_program": "Run program",
"basics.time_to_plan": "Time to plan",
"basics.jump_to_5_seconds_before_the_deadline": "Jump to 5 seconds before the deadline",
"basics.pause": "Pause",
"basics.start_clock": "Start clock",
"basics.move_right": "Move right",
"basics.move_left": "Move left",
"basics.wait": "Wait",
"basics.plan_first_act_afterward": "Plan first. Act afterward.",
"basics.you_just_played_three_turns": "You just played three turns.",
"basics.playing_the_program": "Playing the program",
"basics.turn_carried_out": "Turn {turn} carried out",
"basics.try_the_clock": "Try the clock.",
"basics.choose_where_to_go": "Choose where to go.",
"basics.choose_your_second_action": "Choose your second action.",
"basics.in_space_alert_everyone_plans_their_actions_at": "In Space Alert, everyone plans their actions at the same time. Then the ship carries out those plans, turn by turn. Start here with one crew member and no threats.",
"basics.planning_is_finished_actions_now_play_in_order": "Planning is finished. Actions now play in order.",
"basics.the_first_card_has_played_look_at_your": "The first card has played. Look at your position; the second card is still waiting.",
"basics.the_second_card_has_played_moving_beyond_the": "The second card has played. Moving beyond the edge of the ship leaves you in place. Each slot is a turn, not a second.",
"basics.slot_3_is_empty_you_stay_put_in": "Slot 3 is empty: you stay put. In a mission, every crew member carries out slot 1, then slot 2, and so on.",
"basics.the_clock_limits_how_long_you_have_to": "The clock limits how long you have to arrange cards. It does not move your crew member. Here you can start and pause it; in a mission it keeps running for everyone.",
"basics.choose_turn_1_or_2_you_can_also": "Choose turn 1 or 2. You can also replace a card already there.",
"basics.choose_an_arrow_then_a_turn_you_can": "Choose an arrow, then a turn. You can replace or remove your cards.",
"basics.first_steps_no_threats": "FIRST STEPS · NO THREATS",
"basics.lesson_steps": "Lesson steps",
"basics.plan": "Plan",
"basics.run_the_turns": "Run the turns",
"basics.the_ship_android_1_s_actual_position": "The ship · android 1’s actual position",
"basics.try_with_two_cards": "Try with two cards",
"basics.program": "Program",
"basics.practice_actions_placed": "Practice actions placed",
"basics.practice_actions_placed_2d48e9": "practice actions placed",
"basics.to_plan_safe_practice": "to plan · safe practice",
"basics.pause_clock": "Pause clock",
"basics.planning_against_a_clock_and_carrying_out_turns": "Planning against a clock and carrying out turns are two different parts of the game. Next, learn to use a weapon.",
"basics.next_your_first_shot": "Next: your first shot",
"navigation.log": "Log",
"navigation.training": "Training",
"navigation.missions": "Missions",
"navigation.guide": "Guide",
"navigation.close": "Close",
"tactical.charge_the_shield": "Charge the shield",
"tactical.refill_the_reactor": "Refill the reactor",
"tactical.pulse_cannon": "Pulse cannon",
"tactical.light_laser": "Light laser",
"tactical.heavy_laser": "Heavy laser",
"tactical.the_light_laser_has_its_own_battery_it": "The light laser has its own battery: it spends no reactor energy.",
"tactical.firing_uses_1_energy_from_this_zone_s": "Firing uses 1 energy from this zone’s reactor. With no energy when the shot resolves, the weapon does not fire.",
"tactical.one_fuel_capsule_fills_the_central_reactor_to": "One fuel capsule fills the central reactor to capacity.",
"tactical.b_transfers_energy_from_this_zone_s_reactor": "B transfers energy from this zone’s reactor into its shield, up to capacity. That energy absorbs incoming attacks.",
"tactical.b_transfers_energy_from_the_central_reactor_into": "B transfers energy from the central reactor into this reactor, up to capacity.",
"tactical.perform_c_here_on_turns_1_2_4": "Perform C here on turns 1–2, 4–5 and 8–9 to maintain the computer each phase and avoid delaying programs.",
"tactical.c_takes_this_room_s_battlebots_or_reactivates": "C takes this room’s battlebots, or reactivates the team you already carry.",
"tactical.with_active_battlebots_c_launches_you_in_an": "With active battlebots, C launches you in an interceptor. Only one crew member can be in space at a time.",
"tactical.c_performs_visual_confirmation_which_can_earn_points": "C performs visual confirmation, which can earn points at the end of the mission.",
"tactical.c_launches_a_rocket_it_attacks_on_the": "C launches a rocket: it attacks on the following turn. Only one rocket can launch each turn.",
"tactical.upper_deck": "Upper deck",
"tactical.lower_deck": "Lower deck",
"tactical.program_on_a_turn_when_your_crew_member": "Program {value1} on a turn when your crew member will be in this room. A malfunction of this system makes the action repair it instead.",
"tactical.show_my_cards": "Show my {value1} cards",
"tactical.power": "Power",
"tactical.fire": "Fire",
"tactical.firepower": "Firepower",
"tactical.own_battery": "Own battery",
"tactical.cost_1_energy": "Cost: 1 energy",
"tactical.own_battery_defc21": "Own battery",
"tactical.charge": "Charge",
"tactical.program_an_card_to_change_deck_in_this": "Program an ↑↓ card to change deck in this zone.",
"tactical.program_a_left_or_right_arrow_to_enter": "Program a left or right arrow to enter the next room on the same deck.",
"tactical.show_my_movement_cards": "Show my movement cards",
"tactical.zone_damage": "Zone damage",
"tactical.knocked_out": "Knocked out",
"tactical.doors_same_deck": "Doors · Same deck",
"tactical.passage": "Passage",
"tactical.gravolift": "Gravolift",
"tactical.damaged": "Damaged",
"tactical.destroyed": "Destroyed",
"tactical.escaped": "Escaped",
"tactical.discarded": "Discarded",
"tactical.affected_rooms": "Affected rooms",
"tactical.trajectory": "Trajectory",
"tutorial.action_unavailable": "Action unavailable",
"tutorial.discover": "Discover",
"tutorial.execute": "Execute",
"tutorial.play_program": "Play program",
"tutorial.steps": "Steps",
"tutorial.local_game": "Local game",
"tutorial.mute_sounds": "Mute sounds",
"tutorial.enable_sounds": "Enable sounds",
"tutorial.destination_missed_go_back_and_plan_another_route": "Destination missed. Go back and plan another route.",
"tutorial.restart_exercise": "Restart exercise",
"tutorial.previous_step": "Previous step",
"tutorial.replay_step": "Replay step",
"tutorial.start": "Start",
"tutorial.next_exercise": "Next exercise",
"tutorial_controller.the_clock_limits_planning_time_your_turns_execute": "One slot = one turn. This first exercise plays just three turns, after planning.",
"tutorial_controller.plan_the_program": "Plan the program",
"tutorial_controller.place_a_shot_in_each_highlighted_slot_then": "Place a shot in each highlighted slot, then ↵.",
"tutorial_controller.reach_the_marked_room_in_two_actions_leave": "Reach the marked room in two actions. Leave the third slot empty: wait.",
"tutorial_controller.program_locked_crew_act_together_then_threats": "Program locked. Crew act together, then threats.",
"tutorial_controller.exercise_complete": "Exercise complete",
"tutorial_controller.destination_reached_your_program_took_you_there": "Destination reached! Your program took you there.",
"tutorial_controller.target_destroyed": "Target destroyed.",
"tutorial_controller.replay_to_compare_another_program_or_move_on": "Replay to compare another program, or move on.",
"timing.start_clock": "Start the clock, then plan a route to the marked room.",
"timing.plan_early": "Reach the room in two actions. Press ↵ when your program is ready.",
"timing.executing": "The clock has stopped. All three turns execute in order.",
"timing.try_deadline": "What if time runs out?",
"timing.early_done": "You finished before the deadline. Now try leaving empty slots.",
"timing.let_time_run_out": "Let time run out",
"timing.deadline_plan": "Place the arrow, then start the last 5 seconds.",
"timing.empty_waits": "Time is up: the arrow executes, then the two empty slots wait.",
"timing.complete": "Finish early or run out of time: the whole program executes. Empty slots wait.",
"timing.stopped": "Clock stopped",
"timing.expired": "Time is up",
"timing.last_seconds": "Last 5 seconds",
"timing.next_scenario": "Try the deadline",
"timing.exercise": "Exercise: {turns} turns",
"timing.full_mission": "Full mission",
"timing.phase_group": "Phase {phase}: plan turns {first}–{last}",
"timing.mission_execution": "All turns execute after planning",
"timing.phase_one": "Plan the first three shots, then advance the clock to phase 2. The ship waits.",
"timing.phase_two": "Turns 1–3 are locked. Add the fourth shot, then run the whole mission.",
"lesson.planning-phases.title": "The clock and planning phases",
"lesson.planning-phases.instruction.0": "This training mission has 7 turns: plan 1–3, then 4–7. They all execute at the end.",
"phases.first": "Phase 1 · Turns 1–3",
"phases.second": "Phase 2 · Turns 4–7",
"phases.execute": "Execute the whole mission",
"phases.start": "Start the clock and place → in turn 1. Listen for the next announcement.",
"phases.listen": "The clock advances; the ship waits. Threats are announced during planning.",
"phases.revealed": "Threat revealed: it will arrive on execution turn 6. Place → in turn 1, then jump to the last 5 seconds of this phase.",
"phases.locked": "Turns 1–3 are locked; the ship still waits. Place a deck change in turn 4, then ↵.",
"phases.all_turns": "All 7 turns now execute. The threat enters on turn 6.",
"phases.skip": "Jump to the last 5 seconds of phase 1",
"phases.full_program": "Complete program",
"overview.plan": "Plan",
"overview.plan_detail": "≈ 10 min · Plan together as threats are announced.",
"overview.lock": "Lock",
"overview.lock_detail": "Each phase locks a group of turns.",
"overview.play": "Play the whole mission",
"overview.play_detail": "Every turn, in order. No more planning.",
"overview.turns": "Full mission · 12 turns",
"route.planned": "Planned position after T+{turn}: {room}",
"route.assumption": "Intended route without disruptions: delays, threats or a busy lift may change it.",
"timing.deadline_shortcuts": "Arrows: move · Backspace: undo",
"phases.deadline": "Phase {phase} · {time}"
}

595
preview/locales/fr.json Normal file
View file

@ -0,0 +1,595 @@
{
"lesson.basics.title": "Commencer ici : programmer les tours",
"lesson.first-shot.title": "Votre premier tir",
"lesson.first-shot.instruction.0": "Détruisez la cible avec le laser surligné.",
"lesson.energy.title": "Énergie et coordination",
"lesson.energy.instruction.0": "Alimentez le laser central pour tirer quatre fois.",
"lesson.energy.instruction.1": "Androïde 1 : armes aux tours 1–4. Androïde 3 : ascenseur, puis énergie pour ravitailler le réacteur.",
"lesson.repairs.title": "Réparer une panne",
"lesson.repairs.instruction.0": "Réparez la panne surlignée.",
"lesson.repairs.instruction.1": "→ au tour 1, puis énergie aux tours 2–4.",
"lesson.battlebots.title": "Robots et intercepteurs",
"lesson.battlebots.instruction.0": "Prenez les robots, puis rejoignez les intercepteurs.",
"lesson.battlebots.instruction.1": "→ · systèmes · ← · ← · systèmes. En vol, jouez robots pour tirer ; laissez vide pour rentrer.",
"lesson.double-actions.title": "Deux actions, dans l’ordre",
"lesson.double-actions.instruction.0": "Déplacez-vous et tirez avec une seule carte.",
"lesson.double-actions.instruction.1": "Comparez → + armes et armes + → : l’ordre choisit le laser utilisé.",
"lesson.phasing.title": "Menaces de l’extension",
"lesson.phasing.instruction.0": "Touchez le chasseur lorsqu’il est visible.",
"lesson.phasing.instruction.1": "Armes aux tours 1–3. Observez le tir ignoré pendant son déphasage.",
"lesson.specializations.title": "Spécialisations",
"lesson.specializations.instruction.0": "Lancez une roquette à distance avec l’Artilleur.",
"lesson.specializations.instruction.1": "Programmez sa capacité basique au tour 1. La roquette frappe au tour suivant.",
"app.weapons": "Armes",
"app.energy": "Énergie",
"app.systems": "Systèmes",
"app.player": "Joueur",
"app.rocketeer": "Artilleur",
"app.data_analyst": "Analyste",
"app.energy_technician": "Énergéticien",
"app.pulse_gunner": "Canonnier",
"app.medic": "Médecin",
"app.teleporter": "Téléporteur",
"app.hypernavigator": "Hypernavigateur",
"app.special_ops": "Agent spécial",
"app.squad_leader": "Chef d’escouade",
"app.mechanic": "Mécanicien",
"app.weapons_fire_or_repair": "Armes · Tirer ou réparer",
"app.energy_transfer_or_repair": "Énergie · Transférer ou réparer",
"app.systems_operate_or_repair": "Systèmes · Utiliser ou réparer",
"app.battlebot_attack": "Robot de combat · Attaquer",
"app.move_left": "Aller à gauche",
"app.move_right": "Aller à droite",
"app.change_deck": "Changer de pont",
"app.advanced": "avancé",
"app.basic": "basique",
"app.heroic_move": "Déplacement héroïque · ",
"app.heroic": "Héroïque · ",
"app.mute_voice_announcements": "Désactiver les annonces vocales",
"app.enable_voice_announcements": "Activer les annonces vocales",
"app.serious_threat": "Menace sérieuse",
"app.threat": "Menace",
"app.internal": "interne",
"app.phase_begins": "Début de phase {phase}",
"app.phase_ends_in_seconds": "Phase {phase} : encore {seconds} secondes",
"app.incoming_data_draw_a_card": "Données reçues · piochez une carte",
"app.data_transfer_opens": "Transfert de données ouvert",
"app.data_transfer_complete": "Transfert terminé",
"app.communications_down_silence": "Communications interrompues · silence",
"app.communications_restored": "Communications rétablies",
"app.viewpoint": "Point de vue",
"app.crew_to_program": "Équipier à programmer",
"app.players": "Joueurs",
"app.crew": "Équipage",
"app.mission": "Mission",
"app.threats": "Menaces",
"app.common_threats": "Menaces communes",
"app.serious_threats": "Menaces sérieuses",
"app.format": "Format",
"app.experience": "Expérience",
"app.name": "Nom",
"app.cloning": "Clonage",
"app.solo_4_androids": "Solo · 4 androïdes",
"app.2_2_androids": "2 + 2 androïdes",
"app.3_1_android": "3 + 1 androïde",
"app.4": "4",
"app.5": "5",
"app.standard": "Standard",
"app.5_crew_extra_android": "5 équipiers (androïde supplémentaire)",
"app.3_players_without_android": "3 joueurs sans androïde",
"app.none": "Aucune",
"app.level_1": "Niveau 1",
"app.level_2": "Niveau 2",
"app.level_3": "Niveau 3",
"app.base_game": "Jeu de base",
"app.the_new_frontier": "+ The New Frontier",
"app.single_mission": "Mission unique",
"app.campaign_3_missions": "Campagne · 3 missions",
"app.campaign_5_missions": "Campagne · 5 missions",
"app.free_play": "Partie libre",
"app.saved_careers": "Carrières enregistrées",
"app.allowed": "Autorisé",
"app.hardcore_permanent_death": "Hardcore · mort définitive",
"app.levels_1_2": "Niveaux 1 + 2",
"app.all_levels": "Tous les niveaux",
"app.levels_2_3": "Niveaux 2 + 3",
"app.prepare_mission": "Préparer la mission",
"app.ready_all_crew": "Tout l’équipage est prêt",
"app.next_announcement": "Prochaine annonce",
"app.create_explorer": "Créer un explorateur",
"app.android_1": "Androïde 1",
"app.crew_report_in": "Équipage, au rapport",
"app.stand_by_for_launch": "Départ imminent",
"app.back_to_base": "Retour à la base",
"app.ship_lost": "Vaisseau perdu",
"app.mission_resolution": "Résolution de la mission",
"app.launch_cancelled": "Départ annulé",
"app.phase": "Phase",
"app.ready": "présent",
"app.waiting": "attente",
"app.the_ship": "Le vaisseau",
"app.detected_threats": "Menaces détectées",
"app.flight_program": "Programme de vol",
"app.pause_clock": "Mettre le chrono en pause",
"app.start_practice_clock": "Lancer le chrono d’entraînement",
"app.phase_2": "Phase 2",
"app.finish_programming": "Terminer la programmation",
"app.restart": "Recommencer",
"app.communications_online": "Communications disponibles",
"app.communications_down_stay_silent": "Communications interrompues : gardez le silence",
"app.silence": "Silence",
"app.phase_ed3301": "PHASE",
"app.android": "Androïde",
"app.destination": "Destination",
"app.fuel": "Combustible",
"app.rockets": "Roquettes",
"app.computer": "Ordinateur",
"app.maintained": "entretenu",
"app.not_maintained": "à entretenir",
"app.battlebots_available_squads": "Robots de combat · Escouades disponibles",
"app.squads": "escouades",
"app.crew_49685c": "Équipier",
"app.range": "portée",
"app.knocked_out": "hors combat",
"app.turn": "Tour",
"app.details": "Détails",
"app.arrival_on_turn": "Arrivée au tour",
"app.arrival": "Arrivée",
"app.spaces_per_turn": "cases par tour",
"app.awaiting_the_first_detections": "En attente des premières détections.",
"app.programming_complete_resolving_actions": "Programmation terminée · résolution des actions",
"app.launch_cancelled_not_everyone_confirmed_within_two_minutes": "Départ annulé : toutes les présences n’ont pas été confirmées sous deux minutes. Créez une nouvelle session pour réessayer.",
"app.everyone_confirms_their_presence_before_launch": "Tout le monde confirme sa présence avant le départ.",
"app.movement": "Déplacement",
"app.action": "Action",
"app.empty": "Vide",
"app.target_arrives_before_this_shot": "La cible arrive avant ce tir",
"app.choose_a_turn_for_this_card": "Choisissez un tour pour cette carte.",
"app.click_a_card_to_fill_the_next_turn": "Cliquez une carte pour remplir le prochain tour. Cliquez un tour rempli pour l’effacer ; Retour arrière annule le dernier ajout.",
"app.ready_lasts_two_minutes_we_wait_until_everyone": "Prêt pendant deux minutes. Nous attendons que tout le monde soit prêt.",
"app.programs_are_locked_advance_resolution_or_review_its": "Les programmes sont verrouillés. Avancez la résolution ou revoyez les étapes.",
"app.not_ready_yet": "Pas encore prêt",
"app.connecting": "Connexion…",
"app.i_m_ready": "Je suis prêt",
"app.next_phase": "Phase suivante →",
"app.lock_my_program": "Verrouiller mon programme",
"app.draw": "Piocher",
"app.android_card": "Carte androïde",
"app.next_resolution_step": "Étape de résolution suivante",
"app.resolve_mission": "Résoudre la mission",
"app.new_session": "Nouvelle session",
"app.combine_two_cards": "Combiner deux cartes",
"app.all_cards": "Toutes les cartes",
"app.movement_d9fd7b": "Déplacements",
"app.teleport": "Téléporter",
"app.to": "Auprès de",
"app.set_tokens": "Placer les jetons",
"app.move_tokens_during_data_transfer_their_final_positions": "Changeables pendant un transfert de données. Leur position finale sera utilisée pendant la résolution.",
"app.send_to": "Envoyer à",
"app.score": "Score",
"app.threats_87b951": "menaces",
"app.visual": "observation",
"app.penalties": "pénalités",
"app.appearances": "Apparitions",
"app.crew_actions": "Actions de l’équipage",
"app.damage": "Dégâts",
"app.threat_actions": "Actions des menaces",
"app.review_a_step": "Revoir une étape",
"app.back_to_live": "Revenir au direct",
"app.laser": "Laser",
"app.pulse": "Impulsion",
"app.shield": "Bouclier",
"app.reactor": "Réacteur",
"app.battlebots": "Robots de combat",
"app.interceptors": "Intercepteurs",
"app.visual_confirmation": "Observation",
"app.rocket": "Roquette",
"app.hit_points": "Points de vie",
"app.left_center_and_right_correspond_to_red_white": "Les zones gauche, centre et droite correspondent aux zones rouge, blanche et bleue des annonces originales. Le petit plan sur chaque menace indique sa trajectoire ou les salles touchées.",
"app.plan_choose_a_card_then_a_turn_click": "<p><b>Planifier.</b> Choisissez une carte puis un tour ; cliquez sur un tour rempli pour reprendre la carte. A utilise l’arme, B l’énergie, C le système indiqué dans la station. Les flèches déplacent votre équipier. Les déplacements planifiés ne déplacent pas encore les pions : tout sera exécuté pendant la résolution.</p><p><b>Coordonner.</b> Chaque arme ne tire qu’une fois par tour. Le réacteur de la zone alimente le laser lourd et l’impulsion ; les petits lasers ont leur propre batterie. Deux équipiers prenant le même ascenseur retardent le second.</p><p><b>Ordinateur.</b> Quelqu’un doit faire C sur la passerelle pendant les deux premiers tours de chaque phase (1–2, 4–5, 8–9), sinon les actions suivantes sont retardées.</p><p><b>Menaces.</b> Les tirs se combinent avant de retirer le bouclier adverse. Une roquette touche au tour suivant. Les ennemis avancent après les actions et exécutent X, Y, Z en les franchissant.</p><p><b>Coopérer à distance.</b> Utilisez une conversation vocale externe. Pendant une panne de communication, gardez le silence : cette page ne peut pas couper votre appel.</p>",
"app.reinforcement": "Renfort",
"app.speed": "Vitesse",
"app.forecast_without_crew_intervention_includes_the_threat_s": "Prévision sans intervention de l’équipage ; changements de vitesse propres à la menace inclus.",
"app.approach_track": "Piste d’approche",
"app.no_effect": "Aucun effet",
"app.space": "Case",
"app.spaces": "cases",
"app.choose_explorer": "Choisir un explorateur",
"app.no_specialization": "Aucune spécialisation",
"app.campaign": "Campagne",
"app.continuing_requires_everyone_s_agreement_returning_ends_the": "Continuer nécessite l’accord de tous. Rentrer termine la campagne avant les réparations.",
"app.continue": "Continuer",
"app.return_to_base": "Rentrer à la base",
"app.repair_for_crew": "Réparation de l’équipier",
"app.skip_repair": "Ne rien réparer",
"app.next_mission": "Prochaine mission",
"app.next_mission_the_one_selected_in_setup": "Prochaine mission : celle sélectionnée dans la configuration.",
"app.if_one_battlebot_squad_remains": "Si une seule escouade reste :",
"app.next_mission_bda8db": "Mission suivante",
"app.campaign_score": "Score de campagne",
"app.level_s_to_assign": "niveau(x) à attribuer",
"app.official_achievement_requirements": "Conditions officielles des succès",
"app.requirements_checked_crew_agrees_where_required": "Conditions vérifiées ; accord de l’équipage si nécessaire.",
"app.achievement": "Succès",
"app.record_achievement": "Valider le succès",
"app.level": "Niveau",
"app.on_mission": "en mission",
"app.cloning_enabled": "Clonage autorisé",
"app.hardcore": "Hardcore",
"app.clone_s": "clone(s)",
"app.consent_to_cloning": "Autoriser le clonage",
"app.new_explorer": "Nouvel explorateur",
"app.choose": "Choisir",
"app.reconnecting": "RECONNEXION",
"app.card_unavailable": "Carte indisponible",
"app.check_the_achievement_requirements_before_recording_it": "Vérifiez les conditions du succès avant de le valider.",
"app.this_permanently_locks_the_current_phase_continue": "Les tours de cette phase seront définitivement verrouillés. Continuer ?",
"app.announcements_enabled": "Annonces activées",
"app.paused": " · en pause",
"app.paused_afa0b8": "En pause",
"app.waiting_bade46": "En attente",
"app.until_jump": "avant le saut",
"app.ready_for": "prêt encore",
"text.left": "Gauche",
"text.center": "Centre",
"text.right": "Droite",
"text.launch_a_rocket_from_any_station_a_remote": "Lance une roquette depuis toute station. À distance, une réparation ne peut pas achever une panne.",
"text.lower_right_launch_two_rockets_as_a_strength": "En bas à droite : lance deux roquettes en un tir de force 5. Ailleurs : effectue C.",
"text.maintain_the_computer_remotely_and_gain_1_point": "Entretient l’ordinateur à distance et rapporte 1 point.",
"text.visual_confirmation_counts_as_three_crew_members_elsewhere": "Observation : compte comme trois équipiers. Ailleurs : effectue C.",
"text.refuel_the_central_reactor_with_one_capsule_from": "Recharge le réacteur central avec une capsule, depuis toute station.",
"text.upper_deck_temporary_shields_of_2_in_your": "Sur le pont supérieur : bouclier temporaire de 2 dans votre zone, 1 dans les autres, pour ce tour.",
"text.fire_the_local_laser_and_pulse_cannon_if": "Tire avec le laser local et l’impulsion, si les deux peuvent fonctionner. Au canon à impulsion : tir normal.",
"text.pulse_strength_2_in_normal_range_strength_1": "Impulsion : force 2 dans sa portée normale, force 1 une portée plus loin. Ailleurs : effectue A.",
"text.before_the_captain_enhance_the_first_a_b": "Avant le capitaine : rend héroïque le premier A, B ou combat de chacun dans votre station ce tour. Peut accompagner un déplacement simple.",
"text.before_the_captain_nobody_with_you_can_be": "Avant le capitaine : personne avec vous ne peut être assommé ce tour ; −1 point. La protection vous suit. Peut accompagner un déplacement simple.",
"text.teleport_the_departure_token_crew_member_to_the": "Téléporte l’équipier au jeton départ auprès de celui au jeton arrivée. Choisissez les jetons pendant un transfert de données.",
"text.from_a_side_zone_teleport_to_the_opposite": "Depuis une zone latérale : téléporte vers la zone opposée, sur l’autre pont.",
"text.lower_deck_all_threats_move_one_fewer_space": "Sur le pont inférieur : toutes les menaces avancent d’une case de moins ce tour.",
"text.lower_center_on_turn_10_or_11_finish": "En bas au centre, au tour 10 ou 11 : termine ce tour puis passe au dernier tour sans actions d’équipage.",
"text.prepare_your_next_a_b_or_battlebot_action": "Prépare votre prochain A, B ou combat : il sera héroïque.",
"text.combine_with_another_card_protect_its_execution_from": "À combiner avec une autre carte : protège son exécution contre les retards directs, obstacles et effets subis pendant l’action.",
"text.active_battlebots_repair_one_damage_in_your_zone": "Robots actifs : répare un dégât dans votre zone, priorité aux armes. Robots désactivés : les réactive.",
"text.with_active_battlebots_except_in_lower_right_reach": "Avec des robots actifs, sauf en bas à droite : rejoint les intercepteurs et décolle. Déjà en vol : attaque héroïque.",
"text.prepare_the_local_weapon_1_strength_on_its": "Prépare l’arme locale : +1 force au prochain tir de laser, ou +1 portée pour l’impulsion.",
"text.repair_a_local_a_b_or_c_malfunction": "Répare une panne A, B ou C de votre station de 2 points, priorité au plus petit numéro de menace.",
"text.untargetable_until_x_weapons_ignore_it": "Invisible jusqu’à X : les armes l’ignorent.",
"text.cryoshield_absorbs_the_first_volley_regardless_of_strength": "Le cryobouclier absorbe la première salve, quelle que soit sa force.",
"text.ignore_its_shields_when_pulse_targets_it_this": "Ignore ses boucliers si l’impulsion le touche ce tour.",
"text.rockets_ignore_this_threat": "Les roquettes ignorent cette menace.",
"text.rockets_can_target_it_but_deal_no_damage": "Attire les roquettes mais ne subit pas leurs dégâts.",
"text.heavy_lasers_ignore_this_threat": "Les lasers lourds ignorent cette menace.",
"text.all_rockets_target_it_even_outside_range_1": "Attire toutes les roquettes, même hors portée ; +1 bouclier après une roquette.",
"text.lone_interceptor_target_strength_9_but_the_pilot": "Seule cible des intercepteurs : force 9, mais pilote assommé et robots désactivés.",
"text.after_receiving_damage_attack_1_on_each_zone": "Après avoir reçu un dégât, attaque 1 sur chaque zone à la fin du calcul des dégâts.",
"text.destroyed_deals_1_damage_to_every_other_external": "Détruite : inflige 1 dégât à toutes les autres menaces externes, sans bouclier.",
"text.returns_fire_disables_attacking_battlebots_unless_their_attack": "Riposte : désactive les robots qui l’attaquent, sauf attaque héroïque.",
"text.after_x_disables_attacking_battlebots_unless_their_attack": "Après X, désactive les robots qui l’attaquent, sauf attaque héroïque.",
"text.hit_points_equal_the_rockets_remaining_when_it": "Autant de points de vie que de roquettes restantes à son apparition.",
"text.final_repair_knocks_out_crew_in_lower_left": "Réparation terminée : assomme les équipiers en bas dans les zones latérales.",
"text.destroyed_knocks_out_its_attacker_and_disables_battlebots": "Détruite : assomme son attaquant et désactive ses robots, même avec une attaque héroïque.",
"text.each_battlebot_attack_clears_a_station_clearing_the": "Chaque combat nettoie une station. La troisième station nettoyée nettoie aussi la dernière.",
"text.entering_delays_the_next_action_original_2_hit": "Entrer retarde l’action suivante. Original : 2 vies ; chaque rejeton : 1 vie.",
"text.a_rocket_sends_it_off_course_it_will": "Une roquette la dévie : elle ne fera pas son attaque Z.",
"text.each_turn_it_is_targeted_loses_1_shield": "Chaque tour où elle est ciblée, perd 1 bouclier après les tirs.",
"text.alternates_visible_phased_out_while_phased_out_cannot": "Alterne visible / déphasée. Déphasée : ne peut être touchée et utilise les effets entre crochets.",
"text.add_laser_strength_and_halve_it_rounding_up": "Additionne les lasers, divise leur force par deux (arrondi supérieur), puis ajoute les autres armes avant les boucliers.",
"text.lasers_in_all_three_zones_can_target_it": "Les lasers des trois zones peuvent la cibler. Une arme ne la touche qu’une fois par tour.",
"text.stops_at_z_if_still_present_at_the": "Ne dépasse pas Z. Si elle existe encore au saut, exécute son attaque Z.",
"text.gains_1_speed_after_each_threat_actions_step": "Gagne 1 vitesse après chaque étape d’action des menaces.",
"text.speed_2_this_turn_if_weapon_fire_deals": "Vitesse 2 pour ce tour si les tirs lui infligent des dégâts ; sinon vitesse 4.",
"text.energy_absorbed_by_ship_shields_during_its_attacks": "L’énergie absorbée par les boucliers du vaisseau pendant ses attaques lui rend autant de vies.",
"text.the_final_repair_consumes_1_local_reactor_energy": "La dernière réparation consomme 1 énergie du réacteur local ; impossible si ce réacteur est vide.",
"text.starts_in_upper_left_on_an_odd_threat": "Station initiale : haut à gauche sur un numéro impair, haut à droite sur un numéro pair.",
"text.blocks_pulse_every_central_heavy_laser_shot_triggers": "Bloque l’impulsion. Chaque tir du laser lourd central provoque une attaque 1 sur chaque zone.",
"text.from_appearance_ninja_poisons_movements_starting_or_ending": "Dès son apparition, le Ninja empoisonne les mouvements commençant ou finissant en haut à droite ou bas au centre. Après sa destruction, seuls les déjà empoisonnés restent menacés jusqu’à Z.",
"text.existing_infections_persist_until_z_even_after_its": "Les infections déjà transmises restent actives jusqu’à Z, même après sa destruction.",
"text.whenever_damaged_all_crew_aboard_change_decks": "Chaque action qui l’endommage échange le pont des équipiers à bord.",
"text.at_z_a_surprise_common_internal_threat_resolves": "À Z, une menace interne commune surprise résout toutes ses actions.",
"text.after_taking_damage_teleports_to_upper_left": "Après un dégât, se téléporte en haut à gauche.",
"text.if_not_destroyed_before_the_jump_knocks_out": "Si non détruit avant le saut, assomme tout l’équipage. Les systèmes sabotés se réparent séparément.",
"text.attaches_to_the_first_crew_member_who_moves": "S’attache au premier équipier qui se déplace, puis le suit. Seul un autre équipier peut le combattre. L’hôte est assommé à sa destruction ; s’il est assommé avant, la menace survit.",
"text.targetable_only_at_range_or_less": "Ciblable uniquement à portée {maxTargetRange} ou moins.",
"text.at_most_weapon_damage_per_turn": "Au plus {damageCap} dégât(s) de tirs par tour.",
"text.destroyed_attack_strength_per_x_y_already_crossed": "Détruit : attaque de force {asteroid} par X/Y déjà franchi.",
"text.requires_different_repairers_in_the_same_turn": "Nécessite {simultaneousRepairs} réparateurs différents au même tour.",
"text.repair_if_all_its_stations_are_repaired_in": "+{multiRepairBonus} réparation si toutes ses stations sont réparées au même tour.",
"text.interceptors_in_its_range_or_closer_reduce_its": "Intercepteurs à sa portée ou plus près : ses attaques perdent {carrier} force.",
"text.absorbs_the_first_damage_each_turn": "Absorbe les {inaccessibility} premiers dégâts de chaque tour.",
"text.exactly_one_repairer_this_turn_repair": "Un seul réparateur ce tour : +{loneRepair} réparation.",
"text.with_active_battlebots_repair": "Avec des robots actifs : +{botsRepairBonus} réparation.",
"text.left_109c98": "gauche",
"text.center_3e2797": "centre",
"text.right_835203": "droite",
"text.shield": "bouclier",
"text.reactor": "réacteur",
"text.speed": "vitesse",
"text.fragments": "fragments",
"text.half_the_damage_rounded_down": "la moitié des dégâts, arrondie vers le bas",
"text.remaining_hit_points": "vies restantes",
"text.2_remaining_hit_points": "2 × vies restantes",
"text.3_remaining_hit_points": "3 × vies restantes",
"text.crew_present": "équipiers présents",
"text.all_zones": "toutes zones",
"text.other_zones": "autres zones",
"text.side_zones": "zones latérales",
"text.each_occupied_zone": "chaque zone occupée",
"text.each_occupied_station": "chaque station occupée",
"text.in_its_stations": "dans ses stations",
"text.in_its_zone": "dans sa zone",
"text.leading_active_battlebots": "menant des robots actifs",
"text.in_its_station_without_active_battlebots": "dans sa station sans robots actifs",
"text.outside_the_bridge": "hors de la passerelle",
"text.change_deck": "change de pont",
"text.double_damage_after_shields": "dégâts doublés après bouclier",
"text.plasma_knockout_if_no_damage_absorbed": "plasma : assomme si aucun dégât absorbé",
"text.ignore_shields": "ignore les boucliers",
"text.becomes_targetable": "devient ciblable",
"text.grows_returns_fire": "croît : riposte activée",
"text.1_attack_to_other_external_threats_until_destroyed": "+1 attaque aux autres menaces externes jusqu’à sa destruction",
"text.1_shield_to_all_external_threats_until_destroyed": "+1 bouclier à toutes les menaces externes jusqu’à sa destruction",
"text.double_damage_to_left_zone": "double les dégâts à la zone de gauche",
"text.double_damage_to_all_zones": "double les dégâts à toutes les zones",
"text.entering_a_contaminated_station_causes_knockout": "entrer dans une station contaminée assomme",
"text.weapon_already_fired": "arme déjà utilisée",
"text.empty_reactor": "réacteur vide",
"text.no_fuel": "plus de combustible",
"text.system_irreparable_or_remote_final_repair_prohibited": "système irréparable ou dernière réparation à distance impossible",
"text.no_rocket_available_or_already_launched_this_turn": "roquette indisponible ou déjà lancée ce tour",
"text.both_linked_weapons_cannot_fire": "les deux armes ne peuvent pas tirer ensemble",
"text.ultrafast_return": "retour ultrarapide",
"text.upper_weapon": "arme supérieure",
"text.lower_weapon": "arme inférieure",
"text.structure": "structure",
"text.inaccessibility": "inaccessibilité",
"text.direct_damage": "dégâts directs",
"text.shields_apply": "boucliers applicables",
"text.reactor_energy_1": "énergie du réacteur + 1",
"text.alone_in_their_station": "seuls dans leur station",
"text.sharing_their_station_with_another_crew_member": "au moins deux dans leur station",
"text.subsequent_attacks_drain_shields_and_add_that_energy": "les prochains tirs absorbent l’énergie des boucliers et l’ajoutent aux dégâts",
"text.subsequent_attacks_ignore_shields": "les prochains tirs ignorent les boucliers",
"text.poisons_crew_starting_or_ending_a_movement_in": "empoisonne ceux qui commencent ou terminent un déplacement en haut à droite ou bas au centre",
"text.doors_to_left_zone_sealed": "portes vers la zone de gauche scellées",
"text.doors_to_right_zone_sealed": "portes vers la zone de droite scellées",
"text.sealed_door": "porte scellée",
"text.cyber_gremlin_still_present_at_jump": "Cyber Gremlin encore présent au saut",
"text.attack": "Attaque",
"text.heal": "Répare",
"text.drain": "Retire",
"text.all_energy": "toute l’énergie",
"text.move": "Se déplace",
"text.drain_1_reactor_energy_or_deal_1_damage": "Retire 1 énergie du réacteur, ou inflige 1 dégât s’il est vide.",
"text.knock_out_crew": "Assomme les équipiers",
"text.delay_crew": "Retarde les équipiers",
"text.each_slime_spreads_one_station_toward_the_opposite": "Chaque Slime se propage d’une station vers le côté opposé.",
"text.destroy_one_stored_rocket": "Détruit une roquette en réserve.",
"text.disable_stored_battlebots_in_lower_left": "Désactive les robots en réserve en bas à gauche.",
"text.destroy_one_fuel_capsule": "Détruit une capsule de combustible.",
"text.take_damage": "Reçoit {amount} dégât(s).",
"text.move_to_the_adjacent_station_with_most_crew": "Va dans la station adjacente avec le plus d’équipiers ; ne bouge pas en cas d’égalité.",
"text.advance_other_internal_threats_one_space_executing_crossed": "Avance les autres menaces internes d’une case, avec les effets franchis.",
"text.advance_other_external_threats_one_space_executing_crossed": "Avance les autres menaces externes d’une case, en exécutant les effets franchis.",
"text.destroy_the_ship": "Détruit le vaisseau.",
"text.fill_its_shield_from_its_reactor": "Remplit son bouclier depuis son réacteur.",
"text.empty_and_deal_that_much_damage": "Vide {value1} et inflige autant de dégâts{value2}.",
"text.jump_to_the_trajectory_at_the_same_distance": "Saute vers la trajectoire à {value1}, à distance égale (sans place : reste).",
"text.external": "externe",
"text.same_zone": "même zone",
"text.spawn_the_assigned_reinforcement": "Fait apparaître son renfort {value1}{value2}.",
"text.if_fewer_than_2_damage_reinforcement_speed_1": " Moins de 2 dégâts : vitesse du renfort +1.",
"text.internal": "internes",
"text.external_cf2f09": "externes",
"text.heal_damage_from_all_threats": "Répare {amount} dégât de toutes les menaces {value1}.",
"text.knock_out_crew_leading_active_battlebots_delay_the": "Assomme les équipiers menant des robots actifs ; retarde les autres.",
"text.advance_zone_threats_by_executing_crossed_effects": "Avance les menaces de la zone {value1} de {amount} cases, avec les effets franchis.",
"text.deal_damage_to_the_opposite_side_zone": "Inflige {amount} dégât à l’autre zone latérale.",
"text.fuel_capsule": "capsule",
"text.central_reactor_energy": "énergie centrale",
"text.consume_1_to_attack_each_zone_for_1": "Consomme 1 {value1} pour attaquer chaque zone de force 1.",
"text.move_one_station_toward_the_most_damaged_zone": "Avance d’une station vers la zone la plus endommagée ; égalité : vers le centre.",
"text.crew_present_deal_2_zone_damage_otherwise_heal": "Avec un équipier : 2 dégâts à la zone. Sinon : récupère 1 vie.",
"text.a_side_zone": "d’une zone latérale",
"text.center_e08431": "du centre",
"text.obscure_targeting_visual_confirmation_or_interceptors_are_required": "Obstrue la visée {value1}. Observation ou intercepteurs requis pour y tirer au laser.",
"text.place_a_mine_in_its_station": "Pose une mine dans sa station.",
"text.each_mine_deals_2_damage_to_its_zone": "Chaque mine inflige 2 dégâts à sa zone.",
"text.infect_all_crew_in_its_station": "Infecte tous les équipiers de sa station.",
"text.each_conscious_infected_crew_member_aboard_deals_2": "Chaque infecté conscient à bord inflige 2 dégâts à sa zone.",
"text.knock_out_poisoned_crew_if_ninja_is_still": "Assomme les empoisonnés. Si le Ninja vit encore : chaque roquette restante provoque une attaque 2 à gauche, puis est détruite.",
"text.repeat_this_turn_s_actions_next_turn_delaying": "Répète les actions du tour courant au prochain tour, en décalant les programmes.",
"text.crew_in_side_zones_swap_left_right_without": "Les équipiers en zones latérales échangent gauche / droite, sans changer de pont.",
"text.reveal_the_surprise_threat_resolve_its_appearance_x": "Révèle la menace surprise ; résout son apparition puis X, Y et Z.",
"text.empty_the_local_reactor_and_gain_that_much": "Vide le réacteur local et gagne autant de vitesse.",
"text.sabotage_a_b_and_c_in_its_station": "Sabote les systèmes A, B et C de sa station ; chacun nécessite une réparation.",
"text.drain_1_energy_from_the_host_station_s": "Retire 1 énergie du système B de la station de l’hôte.",
"text.knock_out_other_crew_sharing_the_host_s": "Assomme les autres équipiers avec l’hôte.",
"text.5_direct_damage_to_the_host_s_zone": "5 dégâts directs dans la zone de l’hôte ; hôte en vol : attaque 5 au centre.",
"text.phased_out": " [déphasée : {phasedAmount}]",
"text.phased_out_ba3fa3": " [déphasée : {value1}]",
"text.only_when_visible": " (uniquement visible)",
"text.if_crew_is_present": " (si un équipier est présent)",
"text.if_damaged": " (si endommagée)",
"text.if_undamaged": " (si intacte)",
"text.if_fewer_than_damage": " (si moins de {belowDamage} dégâts)",
"text.unless_off_course": " (sauf si déviée)",
"text.reinforcement_called": "Renfort appelé",
"text.change_trajectory": "Change de trajectoire → {value1}",
"text.parasite_attached": "Parasite attaché",
"text.threat_appears": "Menace détectée",
"text.threat_destroyed": "Menace détruite",
"text.threat_survived": "Menace échappée",
"text.action": "Action {mark}",
"text.damage_after_shields": "{damage} dégât(s), après {shield} bouclier(s)",
"text.cryoshield_broken": "Cryobouclier détruit",
"text.": "{value1} → {value2}",
"text.teleport": "Téléportation → {value1}",
"text.fire_strength_range": "Tir {value1}, force {strength}, portée {range}",
"text.transfer_energy": "Transfert de {amount} énergie · {value1} · {value2}",
"text.computer_maintained_phase": "Ordinateur entretenu · phase {phase}",
"text.computer_missed_phase": "Ordinateur oublié · phase {phase}",
"text.rocket_s_launched": "{count} roquette(s) lancée(s)",
"text.interceptor_launch": "Décollage des intercepteurs",
"text.battlebots_activated": "Robots activés",
"text.battlebots_reactivated": "Robots réactivés",
"text.battlebot_attack_damage": "Attaque des robots : {value1} dégât(s)",
"text.repair_damage": "Répare {amount} dégât(s)",
"text.simultaneous_repair_attempted": "Réparation simultanée tentée",
"text.repair": "Répare {value1} · {value2}",
"text.final_action_lost": " ; dernière action perdue",
"text.program_delayed_from_t": "Programme décalé à partir de T+{from}{value1}",
"text.knocked_out": "Assommé · {value1}",
"text.no_effect": "Sans effet · {value1}",
"text.damage": "Dégât {value1} · {value2}",
"text.ship_destroyed": "Vaisseau détruit",
"text.attack_absorbed_remaining": "Attaque {value1} : {absorbed} absorbé(s), {damage} restant(s)",
"basics.arrows_move_change_deck_backspace_undo_enter_run": "Flèches : déplacement · ↑/↓ : changer de pont · Retour arrière : annuler · Entrée : exécuter",
"basics.shortcuts_arrow_keys_to_move_backspace_to_undo": "Raccourcis : flèches pour se déplacer ; retour arrière pour annuler ; entrée pour exécuter",
"basics.actions_placed": "actions placées",
"basics.run_program": "Exécuter le programme",
"basics.time_to_plan": "Temps pour programmer",
"basics.jump_to_5_seconds_before_the_deadline": "Aller à 5 s de la fin du chrono",
"basics.pause": "Pause",
"basics.start_clock": "Lancer le chrono",
"basics.move_right": "À droite",
"basics.move_left": "À gauche",
"basics.wait": "Attendre",
"basics.plan_first_act_afterward": "Vous décidez d’abord. Vous agissez ensuite.",
"basics.you_just_played_three_turns": "Vous venez de jouer trois tours.",
"basics.playing_the_program": "Lecture du programme",
"basics.turn_carried_out": "Tour {turn} exécuté",
"basics.try_the_clock": "Essayez le chrono.",
"basics.choose_where_to_go": "Choisissez où aller.",
"basics.choose_your_second_action": "Choisissez votre deuxième action.",
"basics.in_space_alert_everyone_plans_their_actions_at": "Dans Space Alert, tout le monde prépare ses actions en même temps. Puis le vaisseau exécute les programmes, tour après tour. Ici, commençons avec un seul équipier, sans menace.",
"basics.planning_is_finished_actions_now_play_in_order": "La préparation est terminée. Les actions vont maintenant se jouer dans l’ordre.",
"basics.the_first_card_has_played_look_at_your": "La première carte est exécutée. Regardez votre nouvelle position ; la deuxième carte attend son tour.",
"basics.the_second_card_has_played_moving_beyond_the": "La deuxième carte est exécutée. Une flèche vers le bord du vaisseau vous laisse sur place. Chaque case est un tour, pas une seconde.",
"basics.slot_3_is_empty_you_stay_put_in": "La case 3 est vide : vous restez sur place. En mission, tous les équipiers exécutent leur case 1, puis leur case 2, etc.",
"basics.the_clock_limits_how_long_you_have_to": "Le chrono limite le temps pour préparer les cartes. Il ne déplace pas l’équipier. Vous pouvez le lancer et le mettre en pause ici ; en mission, il continue pour tout le monde.",
"basics.choose_turn_1_or_2_you_can_also": "Choisissez le tour 1 ou 2. Vous pouvez aussi remplacer une carte déjà posée.",
"basics.choose_an_arrow_then_a_turn_you_can": "Choisissez une flèche, puis un tour. Vous pouvez remplacer ou retirer vos cartes.",
"basics.first_steps_no_threats": "PREMIERS PAS · SANS MENACE",
"basics.lesson_steps": "Étapes de l’exercice",
"basics.plan": "Préparer",
"basics.run_the_turns": "Exécuter les tours",
"basics.the_ship_android_1_s_actual_position": "Le vaisseau · position réelle de l’androïde 1",
"basics.try_with_two_cards": "Essayer avec deux cartes",
"basics.program": "Programme",
"basics.practice_actions_placed": "Actions de l’exercice placées",
"basics.practice_actions_placed_2d48e9": "actions de l’exercice placées",
"basics.to_plan_safe_practice": "pour préparer · exercice sans danger",
"basics.pause_clock": "Mettre en pause",
"basics.planning_against_a_clock_and_carrying_out_turns": "Préparer sous un chrono et exécuter les tours sont deux moments différents. Ensuite, vous apprendrez à utiliser une arme.",
"basics.next_your_first_shot": "Suite : votre premier tir",
"navigation.log": "Journal",
"navigation.training": "Entraînement",
"navigation.missions": "Missions",
"navigation.guide": "Guide",
"navigation.close": "Fermer",
"tactical.charge_the_shield": "Charger le bouclier",
"tactical.refill_the_reactor": "Recharger le réacteur",
"tactical.pulse_cannon": "Canon à impulsion",
"tactical.light_laser": "Laser léger",
"tactical.heavy_laser": "Laser lourd",
"tactical.the_light_laser_has_its_own_battery_it": "Le laser léger utilise sa propre batterie : aucune énergie du réacteur n’est dépensée.",
"tactical.firing_uses_1_energy_from_this_zone_s": "Un tir consomme 1 énergie du réacteur de cette zone. Sans énergie au moment du tir, l’arme ne tire pas.",
"tactical.one_fuel_capsule_fills_the_central_reactor_to": "Une capsule de combustible remplit le réacteur central jusqu’à sa capacité.",
"tactical.b_transfers_energy_from_this_zone_s_reactor": "B transfère l’énergie du réacteur de cette zone vers son bouclier, jusqu’à sa capacité. Cette énergie absorbera les prochaines attaques.",
"tactical.b_transfers_energy_from_the_central_reactor_into": "B transfère l’énergie du réacteur central vers ce réacteur, jusqu’à sa capacité.",
"tactical.perform_c_here_on_turns_1_2_4": "Faites C ici aux tours 1–2, 4–5 et 8–9 pour entretenir l’ordinateur à chaque phase et éviter de retarder les programmes.",
"tactical.c_takes_this_room_s_battlebots_or_reactivates": "C prend les robots de combat de cette salle, ou réactive ceux que vous portez déjà.",
"tactical.with_active_battlebots_c_launches_you_in_an": "Avec des robots de combat actifs, C vous fait décoller en intercepteur. Un seul équipier peut être dans l’espace à la fois.",
"tactical.c_performs_visual_confirmation_which_can_earn_points": "C effectue une observation visuelle, qui peut rapporter des points à la fin de la mission.",
"tactical.c_launches_a_rocket_it_attacks_on_the": "C lance une roquette : elle attaque au tour suivant. Une seule roquette peut être lancée par tour.",
"tactical.upper_deck": "Pont supérieur",
"tactical.lower_deck": "Pont inférieur",
"tactical.program_on_a_turn_when_your_crew_member": "Programmez {value1} à un tour où votre équipier sera dans cette salle. Une panne de ce système fait utiliser l’action pour la réparer.",
"tactical.show_my_cards": "Voir mes cartes {value1}",
"tactical.power": "Puissance",
"tactical.fire": "Tirer",
"tactical.firepower": "Puissance de tir",
"tactical.own_battery": "Batterie autonome",
"tactical.cost_1_energy": "Coût : 1 énergie",
"tactical.own_battery_defc21": "Autonome",
"tactical.charge": "Charger",
"tactical.program_an_card_to_change_deck_in_this": "Programmez une carte ↑↓ pour changer de pont dans cette zone.",
"tactical.program_a_left_or_right_arrow_to_enter": "Programmez une flèche gauche ou droite pour passer dans la salle voisine du même pont.",
"tactical.show_my_movement_cards": "Voir mes déplacements",
"tactical.zone_damage": "Dégâts de la zone",
"tactical.knocked_out": "Hors combat",
"tactical.doors_same_deck": "Portes · Même pont",
"tactical.passage": "Passage",
"tactical.gravolift": "Ascenseur",
"tactical.damaged": "Endommagé",
"tactical.destroyed": "Détruite",
"tactical.escaped": "Échappée",
"tactical.discarded": "Écartée",
"tactical.affected_rooms": "Salles touchées",
"tactical.trajectory": "Trajectoire",
"tutorial.action_unavailable": "Action indisponible",
"tutorial.discover": "Découvrir",
"tutorial.execute": "Exécuter",
"tutorial.play_program": "Lire le programme",
"tutorial.steps": "Étapes",
"tutorial.local_game": "Partie locale",
"tutorial.mute_sounds": "Couper les sons",
"tutorial.enable_sounds": "Activer les sons",
"tutorial.destination_missed_go_back_and_plan_another_route": "Destination manquée. Revenez préparer un autre trajet.",
"tutorial.restart_exercise": "Recommencer l’exercice",
"tutorial.previous_step": "Étape précédente",
"tutorial.replay_step": "Rejouer cette étape",
"tutorial.start": "Commencer",
"tutorial.next_exercise": "Exercice suivant",
"tutorial_controller.the_clock_limits_planning_time_your_turns_execute": "Une case = un tour. Ce premier exercice ne joue que trois tours, après la préparation.",
"tutorial_controller.plan_the_program": "Préparer le programme",
"tutorial_controller.place_a_shot_in_each_highlighted_slot_then": "Placez un tir dans chaque case surlignée, puis ↵.",
"tutorial_controller.reach_the_marked_room_in_two_actions_leave": "Rejoignez la salle marquée en deux actions. La troisième case reste vide : attendre.",
"tutorial_controller.program_locked_crew_act_together_then_threats": "Programme verrouillé. Les équipiers agissent ensemble, puis les menaces.",
"tutorial_controller.exercise_complete": "Exercice terminé",
"tutorial_controller.destination_reached_your_program_took_you_there": "Destination atteinte ! Votre programme vous y a conduit.",
"tutorial_controller.target_destroyed": "Cible détruite.",
"tutorial_controller.replay_to_compare_another_program_or_move_on": "Rejouez pour comparer un autre programme, ou passez à la suite.",
"timing.start_clock": "Lancez le chrono, puis programmez le trajet vers la salle marquée.",
"timing.plan_early": "Rejoignez la salle en deux actions. Appuyez sur ↵ quand votre programme est prêt.",
"timing.executing": "Le chrono est arrêté. Les trois tours s’exécutent à la suite.",
"timing.try_deadline": "Et si le temps s’écoule ?",
"timing.early_done": "Vous avez terminé avant la fin du chrono. Essayons maintenant avec des cases vides.",
"timing.let_time_run_out": "Laisser le temps s’écouler",
"timing.deadline_plan": "Placez la flèche, puis lancez les 5 dernières secondes.",
"timing.empty_waits": "Temps écoulé : la flèche s’exécute, puis les deux cases vides font attendre.",
"timing.complete": "Prêt avant la fin ou temps écoulé : tout le programme s’exécute. Les cases vides font attendre.",
"timing.stopped": "Chrono arrêté",
"timing.expired": "Temps écoulé",
"timing.last_seconds": "5 dernières secondes",
"timing.next_scenario": "Essayer la fin du chrono",
"timing.exercise": "Exercice : {turns} tours",
"timing.full_mission": "Mission complète",
"timing.phase_group": "Phase {phase} : programmer les tours {first} à {last}",
"timing.mission_execution": "Tous les tours s’exécutent après la préparation",
"timing.phase_one": "Programmez les trois premiers tirs, puis avancez le chrono à la phase 2. Le vaisseau attend.",
"timing.phase_two": "Les tours 1–3 sont verrouillés. Ajoutez le quatrième tir, puis lancez toute la mission.",
"lesson.planning-phases.title": "Le chrono et les phases",
"lesson.planning-phases.instruction.0": "Cette mission d’entraînement a 7 tours : préparez 1–3, puis 4–7. Ils s’exécutent tous à la fin.",
"phases.first": "Phase 1 · Tours 1–3",
"phases.second": "Phase 2 · Tours 4–7",
"phases.execute": "Exécuter toute la mission",
"phases.start": "Lancez le chrono et placez → au tour 1. Écoutez la prochaine annonce.",
"phases.listen": "Le chrono avance ; le vaisseau attend. Les menaces sont annoncées pendant la préparation.",
"phases.revealed": "Menace révélée : elle arrivera au tour 6 de l’exécution. Placez → au tour 1, puis avancez aux 5 dernières secondes de cette phase.",
"phases.locked": "Les tours 1–3 sont verrouillés ; le vaisseau attend toujours. Placez le changement de pont au tour 4, puis ↵.",
"phases.all_turns": "Les 7 tours s’exécutent maintenant. La menace entre au tour 6.",
"phases.skip": "Avancer aux 5 dernières secondes de la phase 1",
"phases.full_program": "Programme complet",
"overview.plan": "Préparer",
"overview.plan_detail": "≈ 10 min · Planifiez ensemble au fil des alertes.",
"overview.lock": "Verrouiller",
"overview.lock_detail": "Chaque phase verrouille un groupe de tours.",
"overview.play": "Exécuter toute la mission",
"overview.play_detail": "Tous les tours, dans l’ordre. Plus de programmation.",
"overview.turns": "Mission complète · 12 tours",
"route.planned": "Position prévue après T+{turn} : {room}",
"route.assumption": "Trajet prévu, sans perturbations : retards, menaces ou ascenseur occupé peuvent le modifier.",
"timing.deadline_shortcuts": "Flèches : se déplacer · Retour arrière : annuler",
"phases.deadline": "Phase {phase} · {time}"
}

View file

@ -1,3 +1,4 @@
import { translate } from "./i18n.js";
import { pictogram, specializationIcons, equipmentPicture } from "./icons.js";
const navIcons = {
@ -8,15 +9,15 @@ const navIcons = {
guide: "guide",
};
const labels = {
journal: ["Journal", "Log"],
lessons: ["Entraînement", "Training"],
setup: ["Missions", "Missions"],
"career-manager": ["Équipage", "Crew"],
guide: ["Guide", "Guide"],
journal: "navigation.log",
lessons: "navigation.training",
setup: "navigation.missions",
"career-manager": "app.crew",
guide: "navigation.guide",
};
export function mountNavigation(root, { locale, hosted }) {
const $ = (s) => root.querySelector(s);
const t = (fr, en) => (locale() === "fr" ? fr : en);
const t = (key, params) => translate(locale(), key, params);
const menu = $("#console-menu");
const picker = $("#choice-menu");
const error = $("#error");
@ -32,7 +33,7 @@ export function mountNavigation(root, { locale, hosted }) {
activePanel = id;
for (const panel of root.querySelectorAll("[data-panel-content]"))
panel.hidden = panel.id !== id;
$("#menu-title").textContent = title ?? t(...labels[id]);
$("#menu-title").textContent = title ?? t(labels[id]);
for (const button of root.querySelectorAll("[data-panel]"))
button.setAttribute("aria-expanded", String(button.dataset.panel === id));
menu.querySelector(".dialog-header").after(error);
@ -179,13 +180,13 @@ export function mountNavigation(root, { locale, hosted }) {
.filter(([id]) => !hosted || !["setup", "lessons"].includes(id))
.map(
([id, words]) =>
`<button type="button" data-panel="${id}" aria-haspopup="dialog" aria-expanded="${menu.open && activePanel === id}">${pictogram(navIcons[id])}<span>${t(...words)}</span></button>`,
`<button type="button" data-panel="${id}" aria-haspopup="dialog" aria-expanded="${menu.open && activePanel === id}">${pictogram(navIcons[id])}<span>${t(words)}</span></button>`,
)
.join("");
for (const close of root.querySelectorAll("[data-close-dialog]"))
close.setAttribute("aria-label", t("Fermer", "Close"));
close.setAttribute("aria-label", t("navigation.close"));
if (activePanel && activePanel !== "inspection")
$("#menu-title").textContent = t(...labels[activePanel]);
$("#menu-title").textContent = t(labels[activePanel]);
}
syncChoices();
if (hosted)

36
preview/program-route.js Normal file
View file

@ -0,0 +1,36 @@
const zones = ["red", "white", "blue"];
const isRoom = (room) => /^(red|white|blue)-(upper|lower)$/.test(room ?? "");
// Intended movement from visible cards only. This is not a second resolver:
// threats, delays, lift contention and other crew's actions may change the result.
export function plannedRoute(program, start = "white-upper") {
let room = isRoom(start) ? start : null;
return program.map((slot) => {
for (const card of slot?.cards ?? []) {
const actions = card.sides?.[card.side];
if (!actions) {
room = null;
break;
}
for (let action of actions) {
if (!room) break;
if (action.startsWith("hero:")) action = action.slice(5);
const [zone, deck] = room.split("-");
if (action === "red" || action === "blue")
room = `${zones[Math.max(0, Math.min(2, zones.indexOf(zone) + (action === "red" ? -1 : 1)))]}-${deck}`;
else if (action === "lift")
room = `${zone}-${deck === "upper" ? "lower" : "upper"}`;
else if (action.startsWith("teleport:"))
room = isRoom(action.slice(9)) ? action.slice(9) : null;
// Interceptor launch and specialist movement depend on more than this
// crew member's cards. Stop instead of inventing a ship position.
else if (
(action === "C" && room === "red-upper") ||
action.startsWith("special:teleporter:")
)
room = null;
}
}
return room;
});
}

View file

@ -475,12 +475,18 @@ export function createPreviewServer({ clock = Date.now, storagePath } = {}) {
"/icons.js": "icons.js",
"/art.js": "art.js",
"/tactical.js": "tactical.js",
"/threat-track.js": "threat-track.js",
"/program-route.js": "program-route.js",
"/i18n.js": "i18n.js",
"/locales/en.json": "locales/en.json",
"/locales/fr.json": "locales/fr.json",
"/style.css": "style.css",
}[url.pathname];
if (req.method === "GET" && file) {
res.writeHead(200, {
"Content-Type": file.endsWith(".html")
? "text/html"
: file.endsWith(".json") ? "application/json"
: file.endsWith(".css")
? "text/css"
: "text/javascript",

View file

@ -13,14 +13,46 @@ export function createSoundDesign() {
}
function cue(kind, pan = 0) {
if (!enabled || !context || context.state !== "running") return;
const notes = {
select: [[660, 0, .045]], place: [[440, 0, .065], [660, .06, .09]],
remove: [[520, 0, .06], [310, .055, .09]],
start: [[330, 0, .09], [440, .1, .09], [660, .2, .14]],
turn: [[300, 0, .07], [450, .08, .12]], wait: [[260, 0, .13]],
complete: [[440, 0, .1], [550, .12, .1], [660, .24, .22]],
back: [[440, 0, .07], [330, .08, .09]], error: [[180, 0, .12]],
}[kind] ?? [];
const notes =
{
select: [[660, 0, 0.045]],
place: [
[440, 0, 0.065],
[660, 0.06, 0.09],
],
remove: [
[520, 0, 0.06],
[310, 0.055, 0.09],
],
start: [
[330, 0, 0.09],
[440, 0.1, 0.09],
[660, 0.2, 0.14],
],
turn: [
[300, 0, 0.07],
[450, 0.08, 0.12],
],
wait: [[260, 0, 0.13]],
alert: [
[660, 0, 0.12],
[660, 0.2, 0.12],
],
lock: [
[440, 0, 0.08],
[220, 0.1, 0.16],
],
complete: [
[440, 0, 0.1],
[550, 0.12, 0.1],
[660, 0.24, 0.22],
],
back: [
[440, 0, 0.07],
[330, 0.08, 0.09],
],
error: [[180, 0, 0.12]],
}[kind] ?? [];
for (const [frequency, delay, duration] of notes) {
const oscillator = context.createOscillator();
const gain = context.createGain();
@ -30,13 +62,23 @@ export function createSoundDesign() {
oscillator.frequency.value = frequency;
stereo.pan.value = pan;
gain.gain.setValueAtTime(0, at);
gain.gain.linearRampToValueAtTime(.045, at + .008);
gain.gain.exponentialRampToValueAtTime(.001, at + duration);
gain.gain.linearRampToValueAtTime(0.045, at + 0.008);
gain.gain.exponentialRampToValueAtTime(0.001, at + duration);
oscillator.connect(gain).connect(stereo).connect(context.destination);
oscillator.start(at);
oscillator.stop(at + duration + .02);
oscillator.onended = () => { oscillator.disconnect(); gain.disconnect(); stereo.disconnect(); };
oscillator.stop(at + duration + 0.02);
oscillator.onended = () => {
oscillator.disconnect();
gain.disconnect();
stereo.disconnect();
};
}
}
return { enable, cue, destroy() { if (context) void context.close(); } };
return {
enable,
cue,
destroy() {
if (context) void context.close();
},
};
}

View file

@ -2557,3 +2557,42 @@ input:not([type="checkbox"]):not([type="range"]) {
.track-turns > span { padding: 2px 0; border-radius: 2px; border-bottom: 2px solid; }
.track-turns .forecast-tone-0 { color: #acf0e5; border-color: #72c9bb; background: #264d5580; }
.track-turns .forecast-tone-1 { color: #c0d5fa; border-color: #87a9e1; background: #30405c80; }
/* Mission overview uses the same pictograms and numbered program slots. */
.mission-overview { max-width: 950px; margin: 16px 0; }
.mission-flow { display: flex; align-items: center; gap: 12px; }
.mission-concept { flex: 1; min-width: 0; display: grid; grid-template-columns: 30px 1fr; gap: 6px 10px; padding: 12px; background: #122632; border-radius: 8px; }
.mission-concept > svg { grid-row: span 2; width: 26px; height: 26px; color: var(--cyan); }
.mission-concept small { color: var(--muted); line-height: 1.45; }
.flow-arrow svg { width: 20px; height: 20px; color: var(--muted); }
.mission-timeline, .mission-groups { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.mission-timeline { margin-top: 14px; font-size: 12px; color: var(--muted); }
.mission-timeline > svg { width: 22px; height: 22px; }
.mission-group { display: flex; gap: 4px; padding-bottom: 5px; border-bottom: 2px solid var(--cyan); }
.mission-group.later { opacity: .5; }
.mission-group span { display: grid; place-items: center; width: 23px; height: 28px; border: 1px solid #527181; border-radius: 4px; }
.lesson-scope { display: block; color: var(--muted); margin: -8px 0 10px; }
.practice-clock.stopped > svg { width: 22px; height: 22px; color: var(--cyan); }
.phase-lesson-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.phase-lesson-controls .practice-clock { margin: 0; min-width: 225px; }
.native-tutorial[data-chapter="planning-phases"] #threats { display: block !important; }
.native-tutorial[data-chapter="planning-phases"] .tactical .section-heading:has(#threat-title) { display: flex !important; }
.native-tutorial[data-chapter="planning-phases"] #program { display: grid; grid-template-columns: repeat(4, minmax(0, 70px)); gap: 14px 10px; }
.native-tutorial[data-chapter="planning-phases"] #program .slot { flex: 0 0 70px; }
.native-tutorial[data-chapter="planning-phases"] #program .slot:nth-child(4) { grid-column: 1; }
.native-tutorial[data-chapter="planning-phases"] .basics-stages { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 650px) {
.mission-flow { flex-direction: column; align-items: stretch; gap: 6px; }
.flow-arrow { align-self: center; transform: rotate(90deg); }
.mission-group span { width: 18px; }
}
.planned-location { display: flex; justify-content: center; padding-top: 3px; opacity: .75; }
.planned-location .ship-locator { width: 34px; height: 19px; }
.slot:has(.planned-location) { flex-direction: column; gap: 5px !important; padding-bottom: 10px; }
.slot.previewed-turn { outline: 2px dashed var(--cyan); outline-offset: 3px; }
.station.planned-room { outline: 2px dashed var(--cyan); outline-offset: -5px; }
.planned-pawn { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 3px; color: var(--cyan); pointer-events: none; opacity: .55; }
.planned-pawn > svg { width: 32px; height: 32px; }
.planned-pawn b, .planned-pawn small { font-size: 10px; }
.planned-pawn small { padding: 2px 3px; border: 1px dashed currentColor; border-radius: 3px; }

View file

@ -10,9 +10,9 @@ export function createTacticalView({
}) {
const actionName = (key) =>
({
A: t("Armes", "Weapons"),
B: t("Énergie", "Energy"),
C: t("Systèmes", "Systems"),
A: t("app.weapons"),
B: t("app.energy"),
C: t("app.systems"),
})[key];
const actionWords = (text) => text.replace(/\b[ABC]\b/g, actionName);
const meter = (value, capacity) =>
@ -33,12 +33,11 @@ export function createTacticalView({
const s = ship.zones[zone];
const pulse = station === "white-lower";
const light = deck === "lower" && !pulse;
const energyName =
system === "shield" ? t("Bouclier", "Shield") : t("Réacteur", "Reactor");
const energyName = system === "shield" ? t("app.shield") : t("app.reactor");
const charge =
system === "shield"
? t("Charger le bouclier", "Charge the shield")
: t("Recharger le réacteur", "Refill the reactor");
? t("tactical.charge_the_shield")
: t("tactical.refill_the_reactor");
const centralRefuel = station === "white-lower";
const sourceValue = centralRefuel
? ship.fuel
@ -46,70 +45,39 @@ export function createTacticalView({
? s.reactor
: ship.zones.white.reactor;
const sourceName = centralRefuel
? t("Combustible", "Fuel")
: `${t("Réacteur", "Reactor")} ${zoneName(system === "shield" ? zone : "white")}`;
? t("app.fuel")
: `${t("app.reactor")} ${zoneName(system === "shield" ? zone : "white")}`;
const sourceIcon = centralRefuel ? "fuel" : "reactor";
const weapon = pulse
? t("Canon à impulsion", "Pulse cannon")
? t("tactical.pulse_cannon")
: light
? t("Laser léger", "Light laser")
: t("Laser lourd", "Heavy laser");
? t("tactical.light_laser")
: t("tactical.heavy_laser");
const weaponArt = pulse ? "pulse" : light ? "light-laser" : "laser";
const fireText = light
? t(
"Le laser léger utilise sa propre batterie : aucune énergie du réacteur n’est dépensée.",
"The light laser has its own battery: it spends no reactor energy.",
)
: t(
"Un tir consomme 1 énergie du réacteur de cette zone. Sans énergie au moment du tir, l’arme ne tire pas.",
"Firing uses 1 energy from this zone’s reactor. With no energy when the shot resolves, the weapon does not fire.",
);
? t("tactical.the_light_laser_has_its_own_battery_it")
: t("tactical.firing_uses_1_energy_from_this_zone_s");
const chargeText = centralRefuel
? t(
"Une capsule de combustible remplit le réacteur central jusqu’à sa capacité.",
"One fuel capsule fills the central reactor to capacity.",
)
? t("tactical.one_fuel_capsule_fills_the_central_reactor_to")
: system === "shield"
? t(
"B transfère l’énergie du réacteur de cette zone vers son bouclier, jusqu’à sa capacité. Cette énergie absorbera les prochaines attaques.",
"B transfers energy from this zone’s reactor into its shield, up to capacity. That energy absorbs incoming attacks.",
)
: t(
"B transfère l’énergie du réacteur central vers ce réacteur, jusqu’à sa capacité.",
"B transfers energy from the central reactor into this reactor, up to capacity.",
);
? t("tactical.b_transfers_energy_from_this_zone_s_reactor")
: t("tactical.b_transfers_energy_from_the_central_reactor_into");
const cText = {
"white-upper": t(
"Faites C ici aux tours 1–2, 4–5 et 8–9 pour entretenir l’ordinateur à chaque phase et éviter de retarder les programmes.",
"Perform C here on turns 1–2, 4–5 and 8–9 to maintain the computer each phase and avoid delaying programs.",
),
"blue-upper": t(
"C prend les robots de combat de cette salle, ou réactive ceux que vous portez déjà.",
"C takes this room’s battlebots, or reactivates the team you already carry.",
),
"red-lower": t(
"C prend les robots de combat de cette salle, ou réactive ceux que vous portez déjà.",
"C takes this room’s battlebots, or reactivates the team you already carry.",
),
"red-upper": t(
"Avec des robots de combat actifs, C vous fait décoller en intercepteur. Un seul équipier peut être dans l’espace à la fois.",
"With active battlebots, C launches you in an interceptor. Only one crew member can be in space at a time.",
),
"white-upper": t("tactical.perform_c_here_on_turns_1_2_4"),
"blue-upper": t("tactical.c_takes_this_room_s_battlebots_or_reactivates"),
"red-lower": t("tactical.c_takes_this_room_s_battlebots_or_reactivates"),
"red-upper": t("tactical.with_active_battlebots_c_launches_you_in_an"),
"white-lower": t(
"C effectue une observation visuelle, qui peut rapporter des points à la fin de la mission.",
"C performs visual confirmation, which can earn points at the end of the mission.",
),
"blue-lower": t(
"C lance une roquette : elle attaque au tour suivant. Une seule roquette peut être lancée par tour.",
"C launches a rocket: it attacks on the following turn. Only one rocket can launch each turn.",
"tactical.c_performs_visual_confirmation_which_can_earn_points",
),
"blue-lower": t("tactical.c_launches_a_rocket_it_attacks_on_the"),
}[station];
const flow = `<div class="energy-flow"><span>${illustration(sourceIcon)}<b>${sourceValue}</b><small>${esc(sourceName)}</small></span>${pictogram("right")}<span>${illustration(system)}<b>${s[system]}/${capacity}</b><small>${esc(energyName)}</small></span></div>`;
const details = (key, art, text, extra = "") =>
`<template>${key === "B" ? "" : `<div class="system-detail-art">${illustration(art)}</div>`}<p class="room-location">${esc(zoneName(zone))} · ${deck === "upper" ? t("Pont supérieur", "Upper deck") : t("Pont inférieur", "Lower deck")}</p>${extra}<p>${esc(actionWords(text))}</p><p class="planning-note">${t(`Programmez ${actionName(key)} à un tour où votre équipier sera dans cette salle. Une panne de ce système fait utiliser l’action pour la réparer.`, `Program ${actionName(key)} on a turn when your crew member will be in this room. A malfunction of this system makes the action repair it instead.`)}</p>${canPlan ? `<button class="primary icon-label" data-pick-action="${key}"><span class="action-key">${pictogram(key)}</span>${t(`Voir mes cartes ${actionName(key)}`, `Show my ${actionName(key)} cards`)}</button>` : ""}</template>`;
`<template>${key === "B" ? "" : `<div class="system-detail-art">${illustration(art)}</div>`}<p class="room-location">${esc(zoneName(zone))} · ${deck === "upper" ? t("tactical.upper_deck") : t("tactical.lower_deck")}</p>${extra}<p>${esc(actionWords(text))}</p><p class="planning-note">${t("tactical.program_on_a_turn_when_your_crew_member", { value1: actionName(key) })}</p>${canPlan ? `<button class="primary icon-label" data-pick-action="${key}"><span class="action-key">${pictogram(key)}</span>${t("tactical.show_my_cards", { value1: actionName(key) })}</button>` : ""}</template>`;
return `<div class="systems illustrated-systems">
<div class="system-card weapon-system"><button title="${esc(weapon)}" data-inspect="system-${station}-A" data-inspect-title="${esc(weapon)}" aria-haspopup="dialog" aria-label="${esc(`${weapon} · ${t("Puissance", "Power")} ${power}`)}"><span class="action-key">${pictogram("A")}</span>${illustration(weaponArt)}<span class="system-caption"><strong>${t("Tirer", "Fire")}</strong><span class="power-value">${symbol("laser", t("Puissance de tir", "Firepower"), power)}</span></span></button>${details("A", weaponArt, fireText, `<div class="weapon-facts">${symbol("laser", `${t("Puissance de tir", "Firepower")} ${power}`, power)}${symbol(light ? "check" : "reactor", light ? t("Batterie autonome", "Own battery") : t("Coût : 1 énergie", "Cost: 1 energy"), light ? t("Autonome", "Own battery") : "−1")}</div>`)}</div>
<div class="system-card energy-system ${s[system] === 0 ? "depleted" : ""}"><button data-inspect="system-${station}-B" data-inspect-title="${esc(charge)}" aria-haspopup="dialog" aria-label="${esc(`${charge} · ${s[system]}/${capacity}`)}"><span class="action-key">${pictogram("B")}</span>${illustration(system)}<span class="system-caption"><strong>${t("Charger", "Charge")}</strong><b class="energy-value">${s[system]}/${capacity}</b>${meter(s[system], capacity)}</span></button>${details("B", system, chargeText, flow)}</div>
<div class="system-card weapon-system"><button title="${esc(weapon)}" data-inspect="system-${station}-A" data-inspect-title="${esc(weapon)}" aria-haspopup="dialog" aria-label="${esc(`${weapon} · ${t("tactical.power")} ${power}`)}"><span class="action-key">${pictogram("A")}</span>${illustration(weaponArt)}<span class="system-caption"><strong>${t("tactical.fire")}</strong><span class="power-value">${symbol("laser", t("tactical.firepower"), power)}</span></span></button>${details("A", weaponArt, fireText, `<div class="weapon-facts">${symbol("laser", `${t("tactical.firepower")} ${power}`, power)}${symbol(light ? "check" : "reactor", light ? t("tactical.own_battery") : t("tactical.cost_1_energy"), light ? t("tactical.own_battery_defc21") : "−1")}</div>`)}</div>
<div class="system-card energy-system ${s[system] === 0 ? "depleted" : ""}"><button data-inspect="system-${station}-B" data-inspect-title="${esc(charge)}" aria-haspopup="dialog" aria-label="${esc(`${charge} · ${s[system]}/${capacity}`)}"><span class="action-key">${pictogram("B")}</span>${illustration(system)}<span class="system-caption"><strong>${t("tactical.charge")}</strong><b class="energy-value">${s[system]}/${capacity}</b>${meter(s[system], capacity)}</span></button>${details("B", system, chargeText, flow)}</div>
<div class="system-card special-system"><button title="${esc(c)}" data-inspect="system-${station}-C" data-inspect-title="${esc(c)}" aria-haspopup="dialog" aria-label="${esc(c)}"><span class="action-key">${pictogram("C")}</span>${illustration(cIcon)}<span class="system-caption"><strong>${esc(c)}</strong></span></button>${details("C", cIcon, cText)}</div>
</div>`;
}
@ -123,7 +91,7 @@ export function createTacticalView({
}) {
const zones = ["red", "white", "blue"];
const movementHelp = (lift) =>
`<template><div class="passage-explanation">${pictogram(lift ? "lift" : "move")}</div><p>${lift ? t("Programmez une carte ↑↓ pour changer de pont dans cette zone.", "Program an ↑↓ card to change deck in this zone.") : t("Programmez une flèche gauche ou droite pour passer dans la salle voisine du même pont.", "Program a left or right arrow to enter the next room on the same deck.")}</p>${canPlan ? `<button class="primary icon-label" data-pick-action="move">${pictogram("move")}${t("Voir mes déplacements", "Show my movement cards")}</button>` : ""}</template>`;
`<template><div class="passage-explanation">${pictogram(lift ? "lift" : "move")}</div><p>${lift ? t("tactical.program_an_card_to_change_deck_in_this") : t("tactical.program_a_left_or_right_arrow_to_enter")}</p>${canPlan ? `<button class="primary icon-label" data-pick-action="move">${pictogram("move")}${t("tactical.show_my_movement_cards")}</button>` : ""}</template>`;
const deck = (level) =>
`<div class="ship-deck deck-${level}">${zones
.map((zone) => {
@ -139,15 +107,12 @@ export function createTacticalView({
? 5
: 3) - Number(s.damage.includes(system));
const [cIcon, c] = {
"red-upper": ["interceptor", t("Intercepteurs", "Interceptors")],
"white-upper": ["computer", t("Ordinateur", "Computer")],
"blue-upper": ["bots", t("Robots de combat", "Battlebots")],
"red-lower": ["bots", t("Robots de combat", "Battlebots")],
"white-lower": [
"observation",
t("Observation", "Visual confirmation"),
],
"blue-lower": ["rocket", t("Roquette", "Rocket")],
"red-upper": ["interceptor", t("app.interceptors")],
"white-upper": ["computer", t("app.computer")],
"blue-upper": ["bots", t("app.battlebots")],
"red-lower": ["bots", t("app.battlebots")],
"white-lower": ["observation", t("app.visual_confirmation")],
"blue-lower": ["rocket", t("app.rocket")],
}[station];
const pulse = station === "white-lower";
const power =
@ -158,14 +123,14 @@ export function createTacticalView({
);
const deckName =
level === "upper"
? t("Pont supérieur", "Upper deck")
: t("Pont inférieur", "Lower deck");
return `<section class="station ${occupants.some((p) => p.id === selectedCrew) ? "selected-station" : ""}" data-station="${station}" style="--zone:var(--${zone})" aria-label="${esc(zoneName(zone))} · ${deckName}"><div class="station-title">${level === "upper" && s.damage.length ? `<span class="damage">${symbol("warning", `${t("Dégâts de la zone", "Zone damage")} : ${s.damage.length}/6`, `${s.damage.length}/6`)}</span>` : ""}</div>${stationControls({ station, zone, deck: level, ship, power, capacity, system, cIcon, c, canPlan })}<div class="occupants">${occupants.map((p) => `<span style="${playerColor(p.id) ? `--player-color:${playerColor(p.id)};--player-stroke:#c4d4e0` : ""}" class="crew-pawn ${p.id === selectedCrew ? "selected" : ""} ${p.knockedOut ? "out" : ""}" role="img" title="${esc(crewLabel(p.id))}${p.knockedOut ? " · " + t("Hors combat", "Knocked out") : ""}${p.bots !== null ? " · " + t("Robots de combat", "Battlebots") : ""}" aria-label="${esc(crewLabel(p.id))}${p.knockedOut ? " · " + t("Hors combat", "Knocked out") : ""}${p.bots !== null ? " · " + t("Robots de combat", "Battlebots") : ""}">${isAndroid(p.id) ? equipmentPicture("android") : pictogram("crew")}<b>${p.id + 1}</b>${p.bots !== null ? `<i>${pictogram("bots")}</i>` : ""}</span>`).join("")}</div></section>`;
? t("tactical.upper_deck")
: t("tactical.lower_deck");
return `<section class="station ${occupants.some((p) => p.id === selectedCrew) ? "selected-station" : ""}" data-station="${station}" style="--zone:var(--${zone})" aria-label="${esc(zoneName(zone))} · ${deckName}"><div class="station-title">${level === "upper" && s.damage.length ? `<span class="damage">${symbol("warning", `${t("tactical.zone_damage")} : ${s.damage.length}/6`, `${s.damage.length}/6`)}</span>` : ""}</div>${stationControls({ station, zone, deck: level, ship, power, capacity, system, cIcon, c, canPlan })}<div class="occupants">${occupants.map((p) => `<span style="${playerColor(p.id) ? `--player-color:${playerColor(p.id)};--player-stroke:#c4d4e0` : ""}" class="crew-pawn ${p.id === selectedCrew ? "selected" : ""} ${p.knockedOut ? "out" : ""}" role="img" title="${esc(crewLabel(p.id))}${p.knockedOut ? " · " + t("tactical.knocked_out") : ""}${p.bots !== null ? " · " + t("app.battlebots") : ""}" aria-label="${esc(crewLabel(p.id))}${p.knockedOut ? " · " + t("tactical.knocked_out") : ""}${p.bots !== null ? " · " + t("app.battlebots") : ""}">${isAndroid(p.id) ? equipmentPicture("android") : pictogram("crew")}<b>${p.id + 1}</b>${p.bots !== null ? `<i>${pictogram("bots")}</i>` : ""}</span>`).join("")}</div></section>`;
})
.join(
"",
)}${[1, 2].map((i) => `<div class="ship-passage passage-${i}"><button data-inspect="door-${level}-${i}" data-inspect-title="${t("Portes · Même pont", "Doors · Same deck")}" aria-label="${t("Passage", "Passage")} ${esc(zoneName(zones[i - 1]))} ↔ ${esc(zoneName(zones[i]))} · ${level === "upper" ? t("Pont supérieur", "Upper deck") : t("Pont inférieur", "Lower deck")}" aria-haspopup="dialog">${pictogram("move")}</button>${movementHelp(false)}</div>`).join("")}</div>`;
return `<div class="ship-hull"><div class="ship-bow" aria-hidden="true"><svg viewBox="0 0 600 46" preserveAspectRatio="none"><path class="hull-shell" d="M2 46V32L40 20 200 10 240 3h120l40 7 160 10 38 12v14"/><path class="bridge-window" d="m237 16 11-6h104l11 6-13 12H250Z"/><path d="M275 11v16m50-16v16M32 39h135m266 0h135"/></svg></div>${deck("upper")}<div class="between-decks"><svg class="energy-conduits" viewBox="0 0 600 44" preserveAspectRatio="none" aria-hidden="true"><path class="conduit-back" d="M300 44V28H120V44m180-16h180v16M100 44V0M300 28V0M500 44V0"/><path d="M300 44V28H120V44m180-16h180v16M100 44V0M300 28V0M500 44V0"/><path d="m96 6 4-4 4 4m192 0 4-4 4 4m192 0 4-4 4 4M116 38l4 4 4-4m352 0 4 4 4-4M193 24l-5 4 5 4m214-8 5 4-5 4"/></svg>${zones.map((z) => `<div class="lift-bay"><button class="lift-control ${ship.zones[z].damage.includes("lift") ? "damaged-lift" : ""}" data-inspect="lift-${z}" data-inspect-title="${t("Ascenseur", "Gravolift")} · ${esc(zoneName(z))}" aria-label="${t("Ascenseur", "Gravolift")} · ${esc(zoneName(z))}${ship.zones[z].damage.includes("lift") ? " · " + t("Endommagé", "Damaged") : ""}" aria-haspopup="dialog">${pictogram("lift")}</button>${movementHelp(true)}</div>`).join("")}</div>${deck("lower")}</div><div class="ship-stern" aria-hidden="true">${zones.map(() => `<span><i></i><i></i><i></i></span>`).join("")}</div><div class="ship-key"><span>${pictogram("A")}${t("Tirer", "Fire")}</span><span>${pictogram("B")}${t("Énergie", "Energy")}</span><span>${pictogram("C")}${t("Systèmes", "Systems")}</span></div>`;
)}${[1, 2].map((i) => `<div class="ship-passage passage-${i}"><button data-inspect="door-${level}-${i}" data-inspect-title="${t("tactical.doors_same_deck")}" aria-label="${t("tactical.passage")} ${esc(zoneName(zones[i - 1]))} ↔ ${esc(zoneName(zones[i]))} · ${level === "upper" ? t("tactical.upper_deck") : t("tactical.lower_deck")}" aria-haspopup="dialog">${pictogram("move")}</button>${movementHelp(false)}</div>`).join("")}</div>`;
return `<div class="ship-hull"><div class="ship-bow" aria-hidden="true"><svg viewBox="0 0 600 46" preserveAspectRatio="none"><path class="hull-shell" d="M2 46V32L40 20 200 10 240 3h120l40 7 160 10 38 12v14"/><path class="bridge-window" d="m237 16 11-6h104l11 6-13 12H250Z"/><path d="M275 11v16m50-16v16M32 39h135m266 0h135"/></svg></div>${deck("upper")}<div class="between-decks"><svg class="energy-conduits" viewBox="0 0 600 44" preserveAspectRatio="none" aria-hidden="true"><path class="conduit-back" d="M300 44V28H120V44m180-16h180v16M100 44V0M300 28V0M500 44V0"/><path d="M300 44V28H120V44m180-16h180v16M100 44V0M300 28V0M500 44V0"/><path d="m96 6 4-4 4 4m192 0 4-4 4 4m192 0 4-4 4 4M116 38l4 4 4-4m352 0 4 4 4-4M193 24l-5 4 5 4m214-8 5 4-5 4"/></svg>${zones.map((z) => `<div class="lift-bay"><button class="lift-control ${ship.zones[z].damage.includes("lift") ? "damaged-lift" : ""}" data-inspect="lift-${z}" data-inspect-title="${t("tactical.gravolift")} · ${esc(zoneName(z))}" aria-label="${t("tactical.gravolift")} · ${esc(zoneName(z))}${ship.zones[z].damage.includes("lift") ? " · " + t("tactical.damaged") : ""}" aria-haspopup="dialog">${pictogram("lift")}</button>${movementHelp(true)}</div>`).join("")}</div>${deck("lower")}</div><div class="ship-stern" aria-hidden="true">${zones.map(() => `<span><i></i><i></i><i></i></span>`).join("")}</div><div class="ship-key"><span>${pictogram("A")}${t("tactical.fire")}</span><span>${pictogram("B")}${t("app.energy")}</span><span>${pictogram("C")}${t("app.systems")}</span></div>`;
}
function threatPortrait(th) {
@ -174,11 +139,11 @@ export function createTacticalView({
const gone = ["destroyed", "survived", "discarded"].includes(th.status);
const status =
th.status === "destroyed"
? t("Détruite", "Destroyed")
? t("tactical.destroyed")
: th.status === "survived"
? t("Échappée", "Escaped")
? t("tactical.escaped")
: th.status === "discarded"
? t("Écartée", "Discarded")
? t("tactical.discarded")
: null;
const visual = threatIllustration(th);
const internal = th.position === "internal";
@ -186,15 +151,15 @@ export function createTacticalView({
? (th.stations ?? [])
: [`${th.zone}-upper`, `${th.zone}-lower`];
const targetName = internal
? `${t("Salles touchées", "Affected rooms")} : ${stations
? `${t("tactical.affected_rooms")} : ${stations
.map((s) => {
const [z, d] = s.split("-");
return `${zoneName(z)} ${d === "upper" ? "↑" : "↓"}`;
})
.join(", ")}`
: `${t("Trajectoire", "Trajectory")} : ${zoneName(th.zone)}`;
: `${t("tactical.trajectory")} : ${zoneName(th.zone)}`;
const target = `<span class="threat-target" style="--zone:var(--${["red", "white", "blue"].includes(th.zone) ? th.zone : "cyan"})" role="img" aria-label="${esc(targetName)}" title="${esc(targetName)}">${shipLocator(stations, internal ? null : th.zone)}</span>`;
return `<span class="threat-portrait ${pending ? "pending-threat" : ""} ${gone ? "resolved-threat" : ""}">${target}${visual}<span class="threat-hud"><span class="hull-gauge"><span>${symbol("hull", `${t("Points de vie", "Hit points")} : ${hp}/${th.hp}`, `<b>${hp}<small>/${th.hp}</small></b>`)}</span><span class="hull-bar"><i style="width:${Math.max(0, Math.min(100, (hp / Math.max(1, th.hp)) * 100))}%"></i></span></span><span class="shield-badge">${symbol("shield", `${t("Bouclier", "Shield")} : ${th.shield}`, `<b>${th.shield}</b>`)}</span></span>${status ? `<span class="threat-outcome">${esc(status)}</span>` : ""}</span>`;
return `<span class="threat-portrait ${pending ? "pending-threat" : ""} ${gone ? "resolved-threat" : ""}">${target}${visual}<span class="threat-hud"><span class="hull-gauge"><span>${symbol("hull", `${t("app.hit_points")} : ${hp}/${th.hp}`, `<b>${hp}<small>/${th.hp}</small></b>`)}</span><span class="hull-bar"><i style="width:${Math.max(0, Math.min(100, (hp / Math.max(1, th.hp)) * 100))}%"></i></span></span><span class="shield-badge">${symbol("shield", `${t("app.shield")} : ${th.shield}`, `<b>${th.shield}</b>`)}</span></span>${status ? `<span class="threat-outcome">${esc(status)}</span>` : ""}</span>`;
}
return { shipCutaway, threatPortrait };
}

File diff suppressed because it is too large Load diff

View file

@ -2,6 +2,8 @@ import { mountLesson } from "../bgs/tutorial.js";
const query = new URL(location.href).searchParams;
mountLesson(document.body, {
chapter: query.get("chapter") ?? "basics",
locale: query.get("locale") ?? "fr",
locale: query.get("locale") ?? "en",
standalone: true,
}).catch(error => { document.body.textContent = error.message; });
}).catch((error) => {
document.body.textContent = error.message;
});

View file

@ -1,9 +1,39 @@
import { build } from "esbuild";
import { mkdir, writeFile } from "node:fs/promises";
import { mkdir, writeFile, readFile, readdir, rm } from "node:fs/promises";
import { createHash } from "node:crypto";
import { gzipSync } from "node:zlib";
import { readFileSync } from "node:fs";
import { missionSummaries } from "../src/missions.js";
await mkdir("dist", { recursive: true });
await rm("dist/locales", { recursive: true, force: true });
await mkdir("dist/locales", { recursive: true });
const locales = {};
const source = JSON.parse(await readFile("preview/locales/en.json", "utf8"));
const placeholders = (text) =>
[...text.matchAll(/\{\w+\}/g)]
.map((match) => match[0])
.sort()
.join();
for (const file of (await readdir("preview/locales")).filter((file) =>
file.endsWith(".json"),
)) {
const catalog = JSON.parse(await readFile(`preview/locales/${file}`, "utf8"));
if (Object.keys(catalog).sort().join() !== Object.keys(source).sort().join())
throw Error(`${file}: translation keys differ from English`);
for (const [key, value] of Object.entries(catalog)) {
if (
typeof value !== "string" ||
!value.trim() ||
placeholders(value) !== placeholders(source[key])
)
throw Error(`${file}: invalid translation or placeholders in ${key}`);
}
const content = JSON.stringify(catalog);
const hash = createHash("sha256").update(content).digest("hex").slice(0, 12);
const locale = file.slice(0, -5);
locales[locale] = `locales/${locale}.${hash}.json`;
await writeFile(`dist/${locales[locale]}`, content);
}
const result = await build({
entryPoints: ["bgs/viewer.js"],
bundle: true,
@ -13,6 +43,8 @@ const result = await build({
outfile: "dist/viewer.js",
loader: { ".html": "text", ".css": "text" },
define: {
"import.meta.url": "document.currentScript.src",
BGS_LOCALES: JSON.stringify(locales),
BGS_MISSIONS: JSON.stringify(
missionSummaries.map(({ id, title }) => ({ id, title })),
),

View file

@ -1,3 +1,4 @@
import { translate, loadLocale } from "../preview/i18n.js";
import { createTutorial } from "@boardgamers/protocol/tutorial";
import { LESSONS, createLesson } from "./tutorials.js";
import { advanceClock, submit } from "./session.js";
@ -8,61 +9,260 @@ export function completedTurns(state) {
}
// BGS owns checkpoints and saved action history. All moves still use our engine.
export function createLessonTutorial(id, { locale = "en", storage, onProgress } = {}) {
const lesson = LESSONS.find(l => l.id === id);
export async function createLessonTutorial(
id,
{ locale = "en", storage, onProgress } = {},
) {
locale = await loadLocale(locale);
const lesson = LESSONS.find((l) => l.id === id);
if (!lesson) throw Error("Unknown lesson");
const t = (fr, en) => locale === "fr" ? fr : en;
const t = (key, params) => translate(locale, key, params);
const settleClock = (state) => {
if (lesson.basics && state.stage === "resolution") {
state.game.resolution.lastTurn = 3;
state.game.resolution.finalTurn = 4;
}
if (state.stage === "resolution" && state.tutorial.clockRunning) {
state.tutorial.remainingMs = Math.max(
0,
state.missionStartAt +
state.mission.phaseEndsMs.at(-1) -
state.observedAt,
);
state.tutorial.clockRunning = false;
}
return state;
};
return createTutorial({
game: "space-alert", id, version: lesson.basics ? 3 : 2, storage, onProgress,
initialState: () => createLesson(id, 1000),
game: "space-alert",
id,
version: lesson.basics ? 4 : 2,
storage,
onProgress,
initialState: () => createLesson(id, 1000, { timing: lesson.basics }),
move(state, move) {
if (move.type === "practice-phase-deadline") {
if (
!lesson.phaseLesson ||
state.stage !== "programming" ||
state.phase !== 1
)
throw Error("First planning phase has ended");
state.tutorial.clockRunning = true;
return advanceClock(
state,
Math.max(
state.observedAt,
state.missionStartAt + state.mission.phaseEndsMs[0] - 5000,
),
);
}
if (move.type === "practice-timeout") {
if (
!lesson.basics ||
state.tutorial.scenario !== "early" ||
completedTurns(state) < 3
)
throw Error("Finish the first exercise first");
let next = createLesson(id, 1000, { timing: true });
next = advanceClock(next, next.missionStartAt + 595000);
next.tutorial.scenario = "deadline";
next.tutorial.targetStation = undefined;
// One physical card makes the unfilled turns unambiguous.
const card = next.game.hands[0].find((id) =>
next.game.cards[id].sides.some(
(side) => side.length === 1 && side[0] === "blue",
),
);
next.game.hands[0] = [card];
next.revision = state.revision + 1;
return next;
}
if (move.type === "practice-deadline") {
if (state.stage !== "programming") throw Error("Planning has ended");
state.tutorial.clockRunning = true;
return advanceClock(state, Math.max(state.observedAt,
state.missionStartAt + state.mission.phaseEndsMs.at(-1) - 5000));
return settleClock(
advanceClock(
state,
Math.max(
state.observedAt,
state.missionStartAt + state.mission.phaseEndsMs.at(-1) - 5000,
),
),
);
}
if (move.type === "practice-run") {
if (state.stage !== "programming") throw Error("Planning has ended");
// Record the objective-based ending in new histories. Older saved
// full-mission runs remain replayable without losing completed progress.
state.tutorial.stopAtTarget = id === "first-shot";
if (lesson.basics || lesson.phaseLesson) {
const result = submit(
state,
0,
{
type: "finish-planning",
sequence: state.players[0].lastSequence + 1,
},
state.observedAt,
);
if (!result.accepted) throw Error(result.error);
return settleClock(result.state);
}
while (state.stage === "programming")
state = advanceClock(state, state.missionStartAt + state.mission.phaseEndsMs[state.phase - 1]);
return state;
state = advanceClock(
state,
state.missionStartAt + state.mission.phaseEndsMs[state.phase - 1],
);
return settleClock(state);
}
if (move.type === "practice-phase") {
if (state.stage !== "programming") throw Error("Planning has ended");
return advanceClock(state, state.missionStartAt + state.mission.phaseEndsMs[state.phase - 1]);
return settleClock(
advanceClock(
state,
state.missionStartAt + state.mission.phaseEndsMs[state.phase - 1],
),
);
}
if (move.type === "practice-clock") {
if (state.stage !== "programming") throw Error("Planning has ended");
state.tutorial.clockRunning = !!move.running;
if (move.running) state.tutorial.clockStarted = true;
state.revision++;
return state;
}
if (move.type === "practice-tick") {
if (!state.tutorial.clockRunning || state.stage !== "programming") return state;
if (!Number.isSafeInteger(move.ms) || move.ms < 0) throw Error("Invalid practice time");
return advanceClock(state, state.observedAt + move.ms);
if (!state.tutorial.clockRunning || state.stage !== "programming")
return state;
if (!Number.isSafeInteger(move.ms) || move.ms < 0)
throw Error("Invalid practice time");
return settleClock(advanceClock(state, state.observedAt + move.ms));
}
const result = submit(state, 0, { ...move, sequence: state.players[0].lastSequence + 1 }, state.observedAt);
const result = submit(
state,
0,
{ ...move, sequence: state.players[0].lastSequence + 1 },
state.observedAt,
);
if (!result.accepted) throw Error(result.error);
return result.state;
},
steps: [
{ id: "discover", title: lesson.title[locale === "fr" ? 0 : 1],
text: lesson.basics ? t("Le chrono limite la préparation. Les tours s’exécutent ensuite, dans l’ordre.", "The clock limits planning time. Your turns execute afterward, in order.") : lesson.instructions[0]?.[locale === "fr" ? 0 : 1] ?? "" },
{ id: "plan", title: t("Préparer le programme", "Plan the program"),
text: id === "first-shot" ? t("Placez un tir dans chaque case surlignée, puis ↵.", "Place a shot in each highlighted slot, then ↵.") : lesson.basics ? t("Rejoignez la salle marquée en deux actions. La troisième case reste vide : attendre.", "Reach the marked room in two actions. Leave the third slot empty: wait.") : lesson.instructions[1]?.[locale === "fr" ? 0 : 1] ?? lesson.instructions[0]?.[locale === "fr" ? 0 : 1] ?? "",
complete: state => state.stage === "resolution" },
{ id: "execute", title: t("Exécuter les tours", "Run the turns"),
text: t("Programme verrouillé. Les équipiers agissent ensemble, puis les menaces.", "Program locked. Crew act together, then threats."),
complete: state => lesson.basics ? completedTurns(state) >= 3 && state.game.resolution.ship.crew[0].station === state.tutorial.targetStation
: id === "first-shot" && state.tutorial.stopAtTarget
? state.game.resolution.threats.some(threat => threat.id === lesson.threat && threat.status === "destroyed")
: !!state.game.resolution?.outcome },
],
completion: { title: t("Exercice terminé", "Exercise complete"), text: lesson.basics ? t("Destination atteinte ! Votre programme vous y a conduit.", "Destination reached! Your program took you there.") : id === "first-shot" ? t("Cible détruite.", "Target destroyed.") : t("Rejouez pour comparer un autre programme, ou passez à la suite.", "Replay to compare another program, or move on.") },
steps: lesson.phaseLesson
? [
{
id: "discover",
title: t(lesson.title),
text: t("lesson.planning-phases.instruction.0"),
},
{
id: "first-phase",
title: t("phases.first"),
text: (state) =>
t(
!state.tutorial.clockStarted
? "phases.start"
: !state.game.threats.length
? "phases.listen"
: "phases.revealed",
),
complete: (state) => state.phase === 2,
},
{
id: "second-phase",
title: t("phases.second"),
text: t("phases.locked"),
complete: (state) => state.stage === "resolution",
},
{
id: "whole-mission",
title: t("phases.execute"),
text: t("phases.all_turns"),
complete: (state) => !!state.game.resolution?.outcome,
},
]
: [
{
id: "discover",
title: t(lesson.title),
text: lesson.basics
? t(
"tutorial_controller.the_clock_limits_planning_time_your_turns_execute",
)
: lesson.instructions[0]
? t(lesson.instructions[0])
: "",
},
{
id: "plan",
title: t("tutorial_controller.plan_the_program"),
text: (state) =>
id === "first-shot"
? t(
"tutorial_controller.place_a_shot_in_each_highlighted_slot_then",
)
: lesson.basics
? t(
state.tutorial.clockStarted
? "timing.plan_early"
: "timing.start_clock",
)
: t(lesson.instructions[1] ?? lesson.instructions[0]),
complete: (state) => state.stage === "resolution",
},
{
id: "execute",
title: t("basics.run_the_turns"),
text: lesson.basics
? t("timing.executing")
: t(
"tutorial_controller.program_locked_crew_act_together_then_threats",
),
complete: (state) =>
lesson.basics
? completedTurns(state) >= 3 &&
state.game.resolution.ship.crew[0].station ===
state.tutorial.targetStation
: id === "first-shot" && state.tutorial.stopAtTarget
? state.game.resolution.threats.some(
(threat) =>
threat.id === lesson.threat &&
threat.status === "destroyed",
)
: !!state.game.resolution?.outcome,
},
...(lesson.basics
? [
{
id: "deadline-intro",
title: t("timing.try_deadline"),
text: t("timing.early_done"),
complete: (state) => state.tutorial.scenario === "deadline",
},
{
id: "deadline-plan",
title: t("timing.let_time_run_out"),
text: t("timing.deadline_plan"),
complete: (state) => state.stage === "resolution",
},
{
id: "deadline-execute",
title: t("basics.run_the_turns"),
text: t("timing.empty_waits"),
complete: (state) => completedTurns(state) >= 3,
},
]
: []),
],
completion: {
title: t("tutorial_controller.exercise_complete"),
text: lesson.basics
? t("timing.complete")
: id === "first-shot"
? t("tutorial_controller.target_destroyed")
: t(
"tutorial_controller.replay_to_compare_another_program_or_move_on",
),
},
});
}

View file

@ -9,104 +9,54 @@ const lesson = (id, title, instructions, options = {}) => ({
...options,
});
export const LESSONS = [
lesson("basics", "lesson.basics.title", [], { basics: true }),
lesson(
"basics",
["Commencer ici : programmer les tours", "Start here: planning turns"],
[],
{ basics: true },
"planning-phases",
"lesson.planning-phases.title",
["lesson.planning-phases.instruction.0"],
{ phaseLesson: true, threat: "E1-10", turn: 6 },
),
lesson(
"first-shot",
["Votre premier tir", "Your first shot"],
[["Détruisez la cible avec le laser surligné.",
"Destroy the target with the highlighted laser."]],
"lesson.first-shot.title",
["lesson.first-shot.instruction.0"],
{ threat: "E1-07", turn: 2 },
),
lesson(
"energy",
["Énergie et coordination", "Energy and coordination"],
[
[
"Alimentez le laser central pour tirer quatre fois.",
"Power the central laser for four shots."
],
[
"Androïde 1 : armes aux tours 1–4. Androïde 3 : ascenseur, puis énergie pour ravitailler le réacteur.",
"Android 1: weapons on turns 1–4. Android 3: lift, then energy to refill the reactor."
]
],
),
lesson("energy", "lesson.energy.title", [
"lesson.energy.instruction.0",
"lesson.energy.instruction.1",
]),
lesson(
"repairs",
["Réparer une panne", "Repairing a malfunction"],
[
[
"Réparez la panne surlignée.",
"Repair the highlighted malfunction."
],
[
"→ au tour 1, puis énergie aux tours 2–4.",
"→ on turn 1, then energy on turns 2–4."
]
],
"lesson.repairs.title",
["lesson.repairs.instruction.0", "lesson.repairs.instruction.1"],
{ threat: "I1-05", turn: 2 },
),
lesson(
"battlebots",
["Robots et intercepteurs", "Battlebots and interceptors"],
[
[
"Prenez les robots, puis rejoignez les intercepteurs.",
"Collect the battlebots, then reach the interceptors."
],
[
"→ · systèmes · ← · ← · systèmes. En vol, jouez robots pour tirer ; laissez vide pour rentrer.",
"→ · systems · ← · ← · systems. In flight, play battlebots to fire; leave a slot empty to return."
]
],
),
lesson("battlebots", "lesson.battlebots.title", [
"lesson.battlebots.instruction.0",
"lesson.battlebots.instruction.1",
]),
lesson(
"double-actions",
["Deux actions, dans l’ordre", "Two actions, in order"],
"lesson.double-actions.title",
[
[
"Déplacez-vous et tirez avec une seule carte.",
"Move and fire with one card."
],
[
"Comparez → + armes et armes + → : l’ordre choisit le laser utilisé.",
"Compare → + weapons with weapons + →: the order determines which laser fires."
]
"lesson.double-actions.instruction.0",
"lesson.double-actions.instruction.1",
],
{ doubleActions: true },
),
lesson(
"phasing",
["Menaces de l’extension", "Expansion threats"],
[
[
"Touchez le chasseur lorsqu’il est visible.",
"Hit the fighter while it is visible."
],
[
"Armes aux tours 1–3. Observez le tir ignoré pendant son déphasage.",
"Weapons on turns 1–3. Watch the missed shot while it is phased out."
]
],
"lesson.phasing.title",
["lesson.phasing.instruction.0", "lesson.phasing.instruction.1"],
{ threat: "E2-102", turn: 1 },
),
lesson(
"specializations",
["Spécialisations", "Specializations"],
"lesson.specializations.title",
[
[
"Lancez une roquette à distance avec l’Artilleur.",
"Launch a rocket remotely with the Rocketeer."
],
[
"Programmez sa capacité basique au tour 1. La roquette frappe au tour suivant.",
"Program the basic ability on turn 1. The rocket hits next turn."
]
"lesson.specializations.instruction.0",
"lesson.specializations.instruction.1",
],
{
specializations: [
@ -118,18 +68,18 @@ export const LESSONS = [
},
),
];
export function createLesson(id, now) {
export function createLesson(id, now, { timing = false } = {}) {
const l = LESSONS.find((l) => l.id === id);
if (!l) throw Error("Unknown lesson");
const mission = {
id: `lesson-${id}`,
title: l.title[1],
title: l.title,
doubleActions: !!l.doubleActions,
phaseEndsMs: [300000, 600000],
events: l.threat
? [
{
atMs: 0,
atMs: l.phaseLesson ? 2000 : 0,
type: "threat",
confirmed: true,
turn: l.turn,
@ -154,6 +104,16 @@ export function createLesson(id, now) {
},
now,
);
if (timing && l.basics) {
// A deliberately shortened tutorial fixture: one planning phase, three
// executed turns. Normal mission validation still requires two or three phases.
s.mission.phaseEndsMs = [600000];
s.timeline = [
{ atMs: 0, type: "phase-start", phase: 1 },
{ atMs: 595000, type: "phase-warning", phase: 1, seconds: 5 },
{ atMs: 600000, type: "mission-complete", phase: 2 },
];
}
s = submit(s, 0, { type: "ready", sequence: 1 }, now).state;
s = advanceClock(s, now + 3000);
s.tutorial = {
@ -161,8 +121,15 @@ export function createLesson(id, now) {
title: l.title,
instructions: l.instructions,
basics: !!l.basics,
phaseLesson: !!l.phaseLesson,
targetStation: l.basics ? "blue-lower" : undefined,
clockRunning: false,
...(timing && l.basics
? { timing: true, scenario: "early", clockStarted: false }
: {}),
...(l.phaseLesson
? { timing: true, clockStarted: false, targetStation: "blue-lower" }
: {}),
};
s.game.tracks = Object.fromEntries(
["red", "white", "blue", "internal"].map((z) => [
@ -184,11 +151,13 @@ export function createLesson(id, now) {
s.game.programs[1][turn - 1] = { cards: [{ id, side }] };
s.game.slotVersions[1][turn - 1]++;
}
if (l.basics) {
if (l.basics || l.phaseLesson) {
// A small physical hand makes spending and reusing actions visible.
const remaining = { red: 2, blue: 2, lift: 2 };
s.game.hands[0] = s.game.hands[0].filter(id => {
const action = s.game.cards[id].sides.find(side => side.length === 1 && remaining[side[0]] > 0)?.[0];
s.game.hands[0] = s.game.hands[0].filter((id) => {
const action = s.game.cards[id].sides.find(
(side) => side.length === 1 && remaining[side[0]] > 0,
)?.[0];
if (!action) return false;
remaining[action]--;
return true;

View file

@ -1,3 +1,5 @@
import { loadLocale } from "../preview/i18n.js";
await Promise.all([loadLocale("en"), loadLocale("fr")]);
import { test } from "node:test";
import assert from "node:assert/strict";
import * as e from "../bgs/engine.js";

131
test/locales.test.js Normal file
View file

@ -0,0 +1,131 @@
import test from "node:test";
import assert from "node:assert/strict";
import { readFile, readdir } from "node:fs/promises";
import { createHash } from "node:crypto";
import {
createLocaleLoader,
createLocaleSelection,
loadLocale,
translate,
normalizeLocale,
} from "../preview/i18n.js";
test("catalogs have matching messages/placeholders; chapter metadata is localized without duplicate subtitles", async () => {
const read = (name) =>
readFile(
new URL(`../preview/locales/${name}.json`, import.meta.url),
"utf8",
).then(JSON.parse);
const en = await read("en"),
fr = await read("fr");
const params = (text) =>
[...text.matchAll(/\{\w+\}/g)].map((m) => m[0]).sort();
for (const file of await readdir(
new URL("../preview/locales", import.meta.url),
)) {
const catalog = await read(file.slice(0, -5));
assert.deepEqual(Object.keys(catalog).sort(), Object.keys(en).sort());
for (const [key, value] of Object.entries(catalog)) {
assert.ok(value.trim(), key);
assert.deepEqual(params(value), params(en[key]), key);
}
}
const info = JSON.parse(
await readFile(new URL("../bgs/gameinfo.json", import.meta.url)),
);
for (const chapter of info.version.tutorial.chapters) {
assert.equal(chapter.title, en[`lesson.${chapter.id}.title`]);
assert.equal(chapter.description, "");
const metadata =
info.metadata.optionTranslations.fr[
`tutorial.chapters.${chapter.id}.title`
];
assert.equal(metadata.label, fr[`lesson.${chapter.id}.title`]);
assert.equal(
metadata.translatedFrom.hash,
createHash("sha256").update(chapter.title).digest("hex").slice(0, 16),
);
}
});
test("loads only the selected catalog, caches it, resolves regional tags, and falls back/retries on failure", async () => {
const calls = [];
let failFrench = false;
const loader = createLocaleLoader(
{ en: "locales/en.hash.json", fr: "locales/fr.hash.json" },
"https://assets.example/bundle/viewer.js",
async (url) => {
calls.push(url.href);
if (failFrench && url.pathname.includes("/fr.")) throw Error("offline");
return {
hello: url.pathname.includes("/fr.")
? "Bonjour {name}"
: "Hello {name}",
};
},
);
assert.equal(await loader.load("fr_CA"), "fr");
assert.deepEqual(calls, [
"https://assets.example/bundle/locales/fr.hash.json",
]);
await Promise.all([loader.load("fr"), loader.load("fr-FR")]);
assert.equal(calls.length, 1);
assert.equal(loader.translate("fr", "hello", { name: "Ada" }), "Bonjour Ada");
assert.equal(await loader.load("de"), "en");
assert.equal(calls.length, 2);
const retry = createLocaleLoader(
{ en: "en", fr: "fr.json" },
"https://assets.example/",
async (url) => {
if (failFrench && url.pathname.startsWith("/fr")) throw Error("offline");
return { hello: "ok" };
},
);
failFrench = true;
assert.equal(await retry.load("fr"), "en");
failFrench = false;
assert.equal(await retry.load("fr"), "fr");
assert.equal(normalizeLocale("FR-ca"), "fr");
assert.equal(normalizeLocale("pt-BR"), "en");
assert.equal(normalizeLocale("pt_BR", ["en", "pt-BR"]), "pt-BR");
});
test("late language requests and destroyed viewers cannot override newer preferences", async () => {
const pending = {},
applied = [];
const selector = createLocaleSelection(
(locale) => applied.push(locale),
(locale) => new Promise((resolve) => (pending[locale] = resolve)),
);
const french = selector.set("fr"),
english = selector.set("en");
pending.en("en");
assert.equal(await english, true);
pending.fr("fr");
assert.equal(await french, false);
const late = selector.set("fr");
selector.destroy();
pending.fr("fr");
assert.equal(await late, false);
assert.deepEqual(applied, ["en"]);
});
test("all tutorial copies load in both languages and unsupported locales use English", async () => {
const { createLessonTutorial } = await import(
"../src/tutorial-controller.js"
);
const { LESSONS } = await import("../src/tutorials.js");
for (const language of ["fr-CA", "en-GB", "de"]) {
const locale = await loadLocale(language);
for (const lesson of LESSONS) {
const tutorial = await createLessonTutorial(lesson.id, {
locale: language,
});
assert.equal(tutorial.snapshot.title, translate(locale, lesson.title));
assert.ok(tutorial.snapshot.text.length);
await tutorial.continue();
assert.ok(tutorial.snapshot.text.length);
tutorial.destroy();
}
}
});

View file

@ -0,0 +1,53 @@
import test from "node:test";
import assert from "node:assert/strict";
import { plannedRoute } from "../preview/program-route.js";
const slot = (...actions) => ({ cards: [{ sides: [actions], side: 0 }] });
test("intended route follows moves, waits and room-dependent actions without changing the program", () => {
const program = [
slot("blue"),
slot("lift"),
slot("A"),
null,
slot("red", "red"),
slot("red"),
];
const original = structuredClone(program);
assert.deepEqual(plannedRoute(program), [
"blue-upper",
"blue-lower",
"blue-lower",
"blue-lower",
"red-lower",
"red-lower",
]);
assert.deepEqual(program, original);
});
test("heroic movement and ordered multi-card actions use their actual directions", () => {
const combined = {
cards: [...slot("hero:blue").cards, ...slot("lift").cards],
};
assert.deepEqual(
plannedRoute([combined, slot("teleport:red-upper"), slot("blue", "A")]),
["blue-lower", "red-upper", "white-upper"],
);
});
test("hidden cards and movement depending on other actors stop the route without exposing information", () => {
assert.deepEqual(
plannedRoute([
slot("blue"),
{ cards: [{ category: "movement" }] },
slot("A"),
]),
["blue-upper", null, null],
);
assert.deepEqual(plannedRoute([slot("red"), slot("C"), slot("blue")]), [
"red-upper",
null,
null,
]);
assert.deepEqual(
plannedRoute([slot("special:teleporter:basic"), slot("lift")]),
[null, null],
);
});

View file

@ -1,25 +1,49 @@
import test from "node:test";
import assert from "node:assert/strict";
import { snapshot } from "../src/view.js";
import { createLessonTutorial, completedTurns } from "../src/tutorial-controller.js";
import {
createLessonTutorial,
completedTurns,
} from "../src/tutorial-controller.js";
async function place(tutorial, turn, direction) {
const s = tutorial.snapshot.state;
const id = s.game.hands[0].find(id => s.game.cards[id].sides.some(side => side.length === 1 && side[0] === direction));
const side = s.game.cards[id].sides.findIndex(side => side.length === 1 && side[0] === direction);
assert.equal(await tutorial.play({ type: "program", crew: 0, turn,
slotVersion: s.game.slotVersions[0][turn - 1], cards: [{ id, side }] }), true, tutorial.snapshot.error);
const id = s.game.hands[0].find((id) =>
s.game.cards[id].sides.some(
(side) => side.length === 1 && side[0] === direction,
),
);
const side = s.game.cards[id].sides.findIndex(
(side) => side.length === 1 && side[0] === direction,
);
assert.equal(
await tutorial.play({
type: "program",
crew: 0,
turn,
slotVersion: s.game.slotVersions[0][turn - 1],
cards: [{ id, side }],
}),
true,
tutorial.snapshot.error,
);
}
test("BGS tutorial validates moves, saves progress, and restores native checkpoints", async () => {
const data = new Map();
const storage = { getItem: key => data.get(key), setItem: (key, value) => data.set(key, value) };
const storage = {
getItem: (key) => data.get(key),
setItem: (key, value) => data.set(key, value),
};
const t = await createLessonTutorial("basics", { storage });
assert.equal(t.snapshot.step, 0);
await t.continue();
await place(t, 1, "blue");
await place(t, 2, "red");
assert.equal(snapshot(t.snapshot.state, 0).game.ship.crew[0].station, "white-upper");
assert.equal(
snapshot(t.snapshot.state, 0).game.ship.crew[0].station,
"white-upper",
);
assert.equal(t.snapshot.step, 1);
await t.play({ type: "practice-phase" });
await t.play({ type: "practice-phase" });
@ -27,7 +51,10 @@ test("BGS tutorial validates moves, saves progress, and restores native checkpoi
assert.equal(completedTurns(t.snapshot.state), 0);
for (let i = 0; i < 10 && completedTurns(t.snapshot.state) < 1; i++)
assert.equal(await t.play({ type: "resolve" }), true);
assert.equal(t.snapshot.state.game.resolution.ship.crew[0].station, "blue-upper");
assert.equal(
t.snapshot.state.game.resolution.ship.crew[0].station,
"blue-upper",
);
const restored = await createLessonTutorial("basics", { storage });
assert.deepEqual(restored.snapshot.state, t.snapshot.state);
await restored.restartStep();
@ -39,7 +66,8 @@ test("BGS tutorial validates moves, saves progress, and restores native checkpoi
assert.equal(restored.snapshot.state.stage, "programming");
assert.equal(restored.snapshot.state.game.programs[0][0], null);
await place(restored, 1, "red");
restored.destroy(); t.destroy();
restored.destroy();
t.destroy();
});
test("practice clock advances planning only; resolution remains untimed", async () => {
@ -54,7 +82,12 @@ test("practice clock advances planning only; resolution remains untimed", async
t.destroy();
});
for (const route of [["blue", "lift"], ["lift", "blue"], ["blue", "red"], ["red", "lift"]]) {
for (const route of [
["blue", "lift"],
["lift", "blue"],
["blue", "red"],
["red", "lift"],
]) {
test(`navigation lesson checks the resolved destination: ${route.join(", ")}`, async () => {
const t = await createLessonTutorial("basics");
await t.continue();
@ -66,8 +99,12 @@ for (const route of [["blue", "lift"], ["lift", "blue"], ["blue", "red"], ["red"
for (let i = 0; i < 30 && completedTurns(t.snapshot.state) < 3; i++)
assert.equal(await t.play({ type: "resolve" }), true, t.snapshot.error);
const succeeds = route.includes("blue") && route.includes("lift");
assert.equal(t.snapshot.completed, succeeds);
assert.equal(t.snapshot.state.game.resolution.ship.crew[0].station === "blue-lower", succeeds);
assert.equal(t.snapshot.step === 3, succeeds);
assert.equal(t.snapshot.completed, false);
assert.equal(
t.snapshot.state.game.resolution.ship.crew[0].station === "blue-lower",
succeeds,
);
if (!succeeds) {
await t.previousStep();
assert.equal(t.snapshot.state.stage, "programming");
@ -79,10 +116,16 @@ for (const route of [["blue", "lift"], ["lift", "blue"], ["blue", "red"], ["red"
test("BGS chapter metadata accepts the progress version emitted by every tutorial", async () => {
const { readFile } = await import("node:fs/promises");
const info = JSON.parse(await readFile(new URL("../bgs/gameinfo.json", import.meta.url)));
const info = JSON.parse(
await readFile(new URL("../bgs/gameinfo.json", import.meta.url)),
);
for (const chapter of info.version.tutorial.chapters) {
let progress;
const tutorial = await createLessonTutorial(chapter.id, { onProgress: value => { progress = value; } });
const tutorial = await createLessonTutorial(chapter.id, {
onProgress: (value) => {
progress = value;
},
});
await tutorial.continue();
assert.equal(progress.id, chapter.id);
assert.equal(progress.version, chapter.version);
@ -103,9 +146,20 @@ test("every chapter can plan, execute, complete, and replay through native contr
await place(tutorial, 3, "A");
}
while (tutorial.snapshot.state.stage === "programming")
assert.equal(await tutorial.play({ type: "practice-phase" }), true, lesson.id);
for (let i = 0; i < 200 && !tutorial.snapshot.completed; i++)
assert.equal(await tutorial.play({ type: "resolve" }), true, lesson.id);
assert.equal(
await tutorial.play({ type: "practice-phase" }),
true,
lesson.id,
);
for (let i = 0; i < 200 && !tutorial.snapshot.completed; i++) {
if (lesson.basics && tutorial.snapshot.step === 3) {
assert.equal(await tutorial.play({ type: "practice-timeout" }), true);
await place(tutorial, 1, "blue");
await tutorial.play({ type: "practice-clock", running: true });
await tutorial.play({ type: "practice-tick", ms: 5000 });
} else
assert.equal(await tutorial.play({ type: "resolve" }), true, lesson.id);
}
assert.equal(tutorial.snapshot.completed, true, lesson.id);
await tutorial.previousStep();
assert.equal(tutorial.snapshot.completed, false, lesson.id);
@ -117,13 +171,18 @@ test("every chapter can plan, execute, complete, and replay through native contr
test("first shot stops on target destruction at turn 3, and preserves new and legacy saves", async () => {
for (const objective of [true, false]) {
const data = new Map();
const storage = { getItem: key => data.get(key), setItem: (key, value) => data.set(key, value) };
const storage = {
getItem: (key) => data.get(key),
setItem: (key, value) => data.set(key, value),
};
const tutorial = await createLessonTutorial("first-shot", { storage });
await tutorial.continue();
await place(tutorial, 2, "A");
await place(tutorial, 3, "A");
if (objective) await tutorial.play({ type: "practice-run" });
else while (tutorial.snapshot.state.stage === "programming") await tutorial.play({ type: "practice-phase" });
else
while (tutorial.snapshot.state.stage === "programming")
await tutorial.play({ type: "practice-phase" });
for (let i = 0; i < 100 && !tutorial.snapshot.completed; i++)
assert.equal(await tutorial.play({ type: "resolve" }), true);
assert.equal(tutorial.snapshot.completed, true);
@ -137,7 +196,8 @@ test("first shot stops on target destruction at turn 3, and preserves new and le
const restored = await createLessonTutorial("first-shot", { storage });
assert.equal(restored.snapshot.completed, true);
assert.deepEqual(restored.snapshot.state, tutorial.snapshot.state);
restored.destroy(); tutorial.destroy();
restored.destroy();
tutorial.destroy();
}
});
@ -148,7 +208,10 @@ test("the clock demonstration waits until the actual planning deadline before re
await place(tutorial, 2, "lift");
await tutorial.play({ type: "practice-deadline" });
assert.equal(tutorial.snapshot.state.stage, "programming");
assert.equal(snapshot(tutorial.snapshot.state, 0).game.ship.crew[0].station, "white-upper");
assert.equal(
snapshot(tutorial.snapshot.state, 0).game.ship.crew[0].station,
"white-upper",
);
assert.equal(completedTurns(tutorial.snapshot.state), 0);
await tutorial.play({ type: "practice-tick", ms: 4999 });
assert.equal(tutorial.snapshot.state.stage, "programming");
@ -157,3 +220,87 @@ test("the clock demonstration waits until the actual planning deadline before re
assert.equal(completedTurns(tutorial.snapshot.state), 0);
tutorial.destroy();
});
test("first lesson freezes the early-finish clock, then executes an incomplete plan at the deadline", async () => {
const tutorial = await createLessonTutorial("basics");
await tutorial.continue();
assert.equal(tutorial.snapshot.state.tutorial.clockRunning, false);
await tutorial.play({ type: "practice-clock", running: true });
await tutorial.play({ type: "practice-tick", ms: 2000 });
await place(tutorial, 1, "blue");
await place(tutorial, 2, "lift");
const time = tutorial.snapshot.state.observedAt;
await tutorial.play({ type: "practice-run" });
assert.equal(tutorial.snapshot.state.observedAt, time);
assert.equal(tutorial.snapshot.state.tutorial.clockRunning, false);
assert.equal(tutorial.snapshot.state.tutorial.remainingMs, 598000);
assert.equal(tutorial.snapshot.state.log.at(-1).early, true);
while (tutorial.snapshot.step === 2) await tutorial.play({ type: "resolve" });
assert.equal(tutorial.snapshot.completed, false);
await tutorial.play({ type: "practice-timeout" });
await place(tutorial, 1, "blue");
await tutorial.play({ type: "practice-clock", running: true });
await tutorial.play({ type: "practice-tick", ms: 4999 });
assert.equal(tutorial.snapshot.state.stage, "programming");
assert.equal(
snapshot(tutorial.snapshot.state, 0).game.ship.crew[0].station,
"white-upper",
);
await tutorial.play({ type: "practice-tick", ms: 1 });
assert.equal(tutorial.snapshot.state.stage, "resolution");
assert.equal(tutorial.snapshot.state.tutorial.clockRunning, false);
assert.equal(tutorial.snapshot.state.tutorial.remainingMs, 0);
while (!tutorial.snapshot.completed) await tutorial.play({ type: "resolve" });
assert.equal(
tutorial.snapshot.state.game.resolution.ship.crew[0].station,
"blue-upper",
);
assert.equal(completedTurns(tutorial.snapshot.state), 3);
tutorial.destroy();
});
test("phase lesson reveals a threat before execution and locks only earlier slots at the phase deadline", async () => {
const tutorial = await createLessonTutorial("planning-phases");
await tutorial.continue();
assert.equal(tutorial.snapshot.state.game.threats.length, 0);
await tutorial.play({ type: "practice-clock", running: true });
await place(tutorial, 1, "blue");
await tutorial.play({ type: "practice-tick", ms: 2000 });
assert.equal(tutorial.snapshot.state.game.threats[0].turn, 6);
assert.equal(
snapshot(tutorial.snapshot.state, 0).game.ship.crew[0].station,
"white-upper",
);
await tutorial.play({ type: "practice-phase-deadline" });
await tutorial.play({ type: "practice-tick", ms: 4999 });
assert.equal(tutorial.snapshot.state.phase, 1);
await tutorial.play({ type: "practice-tick", ms: 1 });
assert.equal(tutorial.snapshot.state.phase, 2);
assert.equal(tutorial.snapshot.state.stage, "programming");
assert.equal(
snapshot(tutorial.snapshot.state, 0).game.ship.crew[0].station,
"white-upper",
);
assert.equal(
await tutorial.play({
type: "remove",
crew: 0,
turn: 1,
slotVersion: tutorial.snapshot.state.game.slotVersions[0][0],
}),
false,
);
await place(tutorial, 4, "lift");
await tutorial.play({ type: "practice-run" });
assert.equal(tutorial.snapshot.state.log.at(-1).early, true);
assert.equal(tutorial.snapshot.state.tutorial.clockRunning, false);
for (let i = 0; i < 150 && !tutorial.snapshot.completed; i++)
await tutorial.play({ type: "resolve" });
assert.equal(tutorial.snapshot.completed, true);
assert.equal(
tutorial.snapshot.state.game.resolution.ship.crew[0].station,
"blue-lower",
);
assert.equal(tutorial.snapshot.state.game.resolution.lastTurn, 7);
tutorial.destroy();
});

View file

@ -1,3 +1,5 @@
import { loadLocale } from "../preview/i18n.js";
await Promise.all([loadLocale("en"), loadLocale("fr")]);
import test from "node:test";
import assert from "node:assert/strict";
import { LESSONS, createLesson } from "../src/tutorials.js";