Simplify all tutorial objectives and guide first-shot programming visually

This commit is contained in:
coyotte508 2026-10-31 18:23:09 +01:00
commit 267a0ffa57
7 changed files with 121 additions and 89 deletions

View file

@ -23,6 +23,7 @@ export async function mountLesson(target, { chapter = "basics", locale = "en", o
style.textContent = css;
target.prepend(style);
target.classList.add("native-tutorial");
target.dataset.chapter = chapter;
const guide = document.createElement("section");
guide.className = "native-guide";
target.querySelector("#basics-guide").before(guide);
@ -63,11 +64,13 @@ export async function mountLesson(target, { chapter = "basics", locale = "en", o
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;
guide.innerHTML = `<div class="native-guide-top"><span>${escape(LESSONS[index].title[locale === "fr" ? 0 : 1])}</span><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>
guide.innerHTML = `<div class="native-guide-top"><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>
<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>
<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">${canPlay(s) ? transport("playback", playing ? "pause" : "right", playing ? t("Pause", "Pause") : t("Lire le programme", "Play program")) : ""}${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>
<div class="native-guide-controls">${canPlay(s) ? transport("playback", playing ? "pause" : "right", playing ? t("Pause", "Pause") : t("Lire le programme", "Play program")) : ""}${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)}${!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 ? transport("run", "step", t("Exécuter le programme · ↵", "Run program · ↵"), (chapter === "first-shot" ? !readyToFire : !planned) || s.busy) : ""}${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 unsubscribe = tutorial.subscribe(s => {
@ -95,6 +98,13 @@ export async function mountLesson(target, { chapter = "basics", locale = "en", o
target.dataset.tutorialStep = String(s.step);
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");
renderGuide(s);
});
const onClick = async event => {
@ -104,6 +114,11 @@ export async function mountLesson(target, { chapter = "basics", locale = "en", o
if (action === "sound") {
soundOn = !soundOn; sound.enable(soundOn); sound.cue("select"); renderGuide(tutorial.snapshot); return;
}
if (action === "phase") { await play({ type: "practice-phase" }); return; }
if (action === "run") {
while (tutorial.snapshot.state.stage === "programming") await play({ type: "practice-phase" });
return;
}
if (action === "playback") {
playing = !playing; renderGuide(tutorial.snapshot); return;
}
@ -117,7 +132,7 @@ 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") { await tutorial.restartStep(); playing = canPlay(tutorial.snapshot); renderGuide(tutorial.snapshot); }
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();

View file

@ -95,14 +95,14 @@ export function mountConsole(root, host = null) {
const specialName = (n) => names[n]?.[locale === "fr" ? 0 : 1] ?? n;
const label = (a) =>
({
A: t("Armes · Tirer ou réparer (A)", "Weapons · Fire or repair (A)"),
A: t("Armes · Tirer ou réparer", "Weapons · Fire or repair"),
B: t(
"Énergie · Transférer ou réparer (B)",
"Energy · Transfer or repair (B)",
"Énergie · Transférer ou réparer",
"Energy · Transfer or repair",
),
C: t(
"Systèmes · Utiliser ou réparer (C)",
"Systems · Operate or repair (C)",
"Systèmes · Utiliser ou réparer",
"Systems · Operate or repair",
),
bots: t("Robot de combat · Attaquer", "Battlebot · Attack"),
red: t("Aller à gauche", "Move left"),
@ -300,6 +300,8 @@ export function mountConsole(root, host = null) {
root.lang = locale;
localizeSetup();
const basic = !!view.tutorial?.basics;
const firstShot = host?.tutorial && view.tutorial?.id === "first-shot";
const teachingActions = basic ? ["red", "blue", "lift"] : firstShot ? ["A"] : null;
root.classList.toggle("learning-basics", basic);
$("#basics-guide").hidden = !basic;
if (basic)
@ -382,7 +384,7 @@ export function mountConsole(root, host = null) {
ship: basic ? { ...ship, crew: [ship.crew[0]] } : ship,
selectedCrew: crew,
canPlan:
!basic && view.stage === "programming" &&
!basic && (!host?.tutorial || view.tutorial.nativeStep === 1) && view.stage === "programming" &&
seat >= 0 &&
(g?.solo || crew === seat || crew >= view.players.length) &&
!own.finishedPlanning,
@ -470,10 +472,10 @@ export function mountConsole(root, host = null) {
ownPhase =
g?.solo || crew >= view.players.length ? view.phase : own.planningPhase;
$("#program").innerHTML = (g?.programs[crew] ?? [])
.slice(0, basic ? 3 : view.mission.phaseEndsMs.length === 2 ? 7 : 12)
.slice(0, basic || firstShot ? 3 : view.mission.phaseEndsMs.length === 2 ? 7 : 12)
.map((slot) => {
const editable =
(!basic || slot.turn < 3) && planning &&
(!basic || slot.turn < 3) && (!firstShot || slot.turn === 2 || slot.turn === 3) && (!host?.tutorial || view.tutorial.nativeStep === 1) && planning &&
canOwn &&
!own.finishedPlanning &&
phaseFor(slot.turn) === ownPhase;
@ -542,12 +544,12 @@ export function mountConsole(root, host = null) {
];
const grouped = [];
for (const card of hand) {
if (basic && !card.sides.some(side => side.length === 1 && ["red", "blue", "lift"].includes(side[0]))) continue;
if (teachingActions && !card.sides.some(side => side.length === 1 && teachingActions.includes(side[0]))) continue;
const same = grouped.find(
(c) =>
c.kind === "normal" &&
card.kind === "normal" &&
JSON.stringify(basic ? c.sides.filter(side => side.length === 1 && ["red", "blue", "lift"].includes(side[0])) : c.sides) === JSON.stringify(basic ? card.sides.filter(side => side.length === 1 && ["red", "blue", "lift"].includes(side[0])) : card.sides),
JSON.stringify(teachingActions ? c.sides.filter(side => side.length === 1 && teachingActions.includes(side[0])) : c.sides) === JSON.stringify(teachingActions ? card.sides.filter(side => side.length === 1 && teachingActions.includes(side[0])) : card.sides),
);
if (same) same.count++;
else grouped.push({ ...card, count: 1 });
@ -590,7 +592,7 @@ export function mountConsole(root, host = null) {
)
.map(
(c) =>
`<div class="card ${c.kind}">${c.count > 1 ? `<span class="copies">×${c.count}</span>` : ""}${c.sides.map((side, index) => basic && !(side.length === 1 && ["red", "blue", "lift"].includes(side[0])) ? "" : `<button data-card="${esc(c.id)}" data-side="${index}" class="${selected.some((s) => s.id === c.id && s.side === index) ? "selected" : ""}" aria-pressed="${selected.some((s) => s.id === c.id && s.side === index)}" title="${esc(side.map(label).join(" → "))}" aria-label="${esc(side.map(label).join(" → "))}">${side.map(icon).join(" · ")}</button>`).join("")}</div>`,
`<div class="card ${c.kind}">${c.count > 1 ? `<span class="copies">×${c.count}</span>` : ""}${c.sides.map((side, index) => teachingActions && !(side.length === 1 && teachingActions.includes(side[0])) ? "" : `<button data-card="${esc(c.id)}" data-side="${index}" class="${selected.some((s) => s.id === c.id && s.side === index) ? "selected" : ""}" aria-pressed="${selected.some((s) => s.id === c.id && s.side === index)}" title="${esc(side.map(label).join(" → "))}" aria-label="${esc(side.map(label).join(" → "))}">${side.map(icon).join(" · ")}</button>`).join("")}</div>`,
)
.join("")
: "";
@ -962,7 +964,7 @@ export function mountConsole(root, host = null) {
if (event.target.closest?.("input, textarea, select, [contenteditable]:not([contenteditable=false]), dialog")) return;
if (root.querySelector("dialog[open]")) return;
if (event.key === "Enter") {
const run = $("#basics-run");
const run = $("#basics-run") ?? $('[data-guide="run"]');
if (!run || !run.getClientRects().length) return;
event.preventDefault();
if (!run.disabled && !pending && !event.repeat) run.click();
@ -1442,7 +1444,7 @@ export function mountConsole(root, host = null) {
})();
}
return {
resetTutorial() { basicsPicked = false; basicsStarted = false; selected = []; replayFrame = null; key = ""; },
resetTutorial() { $("#error").textContent = ""; basicsPicked = false; basicsStarted = false; selected = []; replayFrame = null; key = ""; },
render(next) {
if (host && next.bgs?.settings) {
$("#mission").value = next.bgs.settings.mission ?? next.mission.id;

View file

@ -2449,3 +2449,30 @@ input:not([type="checkbox"]):not([type="range"]) {
.native-tutorial[data-tutorial-stage="resolution"] #controls,
.native-tutorial.learning-basics[data-tutorial-stage="resolution"] #controls { display: none !important; }
.native-tutorial .native-guide-top { justify-content: flex-end; }
.native-tutorial[data-tutorial-step="0"] #lesson-guide,
.native-tutorial[data-tutorial-step="0"] #basics-guide,
.native-tutorial[data-chapter="first-shot"] #lesson-guide,
.native-tutorial[data-chapter="first-shot"] #program-crew,
.native-tutorial[data-chapter="first-shot"] .crew-tabs,
.native-tutorial[data-chapter="first-shot"] #controls,
.native-tutorial[data-chapter="first-shot"] #hand-filter,
.native-tutorial[data-chapter="first-shot"] #player-help,
.native-tutorial[data-chapter="first-shot"] #resources { display: none !important; }
.native-tutorial[data-chapter="first-shot"] .flight-layout { grid-template-columns: minmax(0, 600px) minmax(280px, 340px); gap: 28px; justify-content: start; }
.native-tutorial[data-chapter="first-shot"] [data-inspect="system-white-upper-A"],
.native-tutorial[data-chapter="first-shot"] #program .slot.empty:not(:disabled),
.native-tutorial[data-chapter="first-shot"] #threats > :first-child { outline: 2px dashed #e8c984; outline-offset: 3px; }
.native-tutorial[data-chapter="first-shot"] #program { display: flex; gap: 10px; }
.native-tutorial[data-chapter="first-shot"] #program .slot { width: 88px; min-height: 104px; }
.native-tutorial[data-chapter="first-shot"] #hand { grid-template-columns: 88px; margin-top: 16px; }
.native-tutorial[data-chapter="first-shot"] #hand .card > button { min-height: 76px; display: flex; align-items: center; justify-content: center; }
@media (max-width: 800px) { .native-tutorial[data-chapter="first-shot"] .flight-layout { grid-template-columns: 1fr; } }
.native-tutorial #lesson-guide { display: none !important; }
.native-tutorial .lesson-focus { outline: 2px dashed #e8c984; outline-offset: 3px; }
.native-tutorial .flight-layout { grid-template-columns: minmax(0, 600px) minmax(280px, 480px); gap: 28px; justify-content: start; }
@media (max-width: 800px) { .native-tutorial .flight-layout { grid-template-columns: 1fr; } }
/* BGS already supplies the game name and chapter header. */
.native-tutorial > header { display: none; }

View file

@ -108,9 +108,9 @@ export function createTacticalView({
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>`;
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} · A · ${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("hull", t("Puissance de tir", "Firepower"), power)}</span></span></button>${details("A", weaponArt, fireText, `<div class="weapon-facts">${symbol("hull", `${t("Puissance", "Power")} ${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} · B · ${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 special-system"><button title="${esc(c)}" data-inspect="system-${station}-C" data-inspect-title="${esc(c)}" aria-haspopup="dialog" aria-label="C · ${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 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("hull", t("Puissance de tir", "Firepower"), power)}</span></span></button>${details("A", weaponArt, fireText, `<div class="weapon-facts">${symbol("hull", `${t("Puissance", "Power")} ${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 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>`;
}

View file

@ -37,9 +37,9 @@ export function createLessonTutorial(id, { locale = "en", storage, onProgress }
},
steps: [
{ id: "discover", title: lesson.title[locale === "fr" ? 0 : 1],
text: lesson.basics ? t("Préparez vos actions, puis regardez-les s’exécuter. Commençons sans menace, avec un seul androïde.", "Plan your actions, then watch them execute. Start without threats, with one android.") : lesson.instructions.map(p => p[locale === "fr" ? 0 : 1]).join("\n\n") },
text: lesson.basics ? t("Préparez vos actions, puis regardez-les s’exécuter. Commençons sans menace, avec un seul androïde.", "Plan your actions, then watch them execute. Start without threats, with one android.") : lesson.instructions[0]?.[locale === "fr" ? 0 : 1] ?? "" },
{ id: "plan", title: t("Préparer le programme", "Plan the program"),
text: 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.") : t("Programmez les cartes sur le vaisseau, puis terminez la programmation. Le chrono est facultatif ici.", "Program cards on the ship, then finish planning. The clock is optional here."),
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."),

View file

@ -18,20 +18,8 @@ export const LESSONS = [
lesson(
"first-shot",
["Votre premier tir", "Your first shot"],
[
[
"La menace arrive au tour 2. Le T+ indique un tour de résolution, pas une minute. Les androïdes sont tous au centre ; le second s’occupe déjà de l’ordinateur.",
"The threat arrives on turn 2. T+ is a resolution turn, not a minute. Everyone starts on the bridge; android 2 already handles the computer.",
],
[
"Avec l’androïde 1, programmez A aux tours 2 et 3. Les tirs du laser central coûtent chacun 1 énergie. Le bouclier ennemi s’applique de nouveau à chaque tour.",
"For android 1, program A on turns 2 and 3. Each central laser shot uses 1 energy. Enemy shields apply again each turn.",
],
[
"Passez à la phase 2, puis lancez la résolution. Suivez le journal : les tirs combinés du tour précèdent le mouvement de la menace. Vous pouvez recommencer et comparer.",
"Advance to phase 2, then resolve. Watch the log: a turn’s combined fire happens before threat movement. Restart and compare different programs.",
],
],
[["Détruisez la cible avec le laser surligné. Tirez aux tours 2 et 3.",
"Destroy the target with the highlighted laser. Fire on turns 2 and 3."]],
{ threat: "E1-07", turn: 2 },
),
lesson(
@ -39,17 +27,13 @@ export const LESSONS = [
["Énergie et coordination", "Energy and coordination"],
[
[
"Le réacteur central commence avec 3 énergies. Le laser lourd et l’impulsion utilisent cette même réserve ; B à l’étage recharge le bouclier, pas le réacteur.",
"The central reactor starts with 3 energy. Heavy laser and pulse share it; B upstairs fills the shield, not the reactor.",
"Alimentez le laser central pour tirer quatre fois.",
"Power the central laser for four shots."
],
[
"Androïde 1 : A, A, A aux tours 1–3, puis A au tour 4. Sans ravitaillement, ce dernier tir échouera. Essayez ensuite : androïde 3, ascenseur au tour 1 puis B au tour 2.",
"Android 1: A, A, A on turns 1–3, then A on turn 4. Without refueling, that last shot fails. Then try android 3: lift on turn 1, B on turn 2.",
],
[
"Dans la résolution, vérifiez la capsule consommée, l’énergie disponible et les tirs sans effet. Chaque arme ne peut tirer qu’une fois par tour, même si deux équipiers utilisent A.",
"During resolution, check the consumed capsule, available energy and failed shots. Each weapon can fire only once per turn, even if two crew use A.",
],
"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(
@ -57,17 +41,13 @@ export const LESSONS = [
["Réparer une panne", "Repairing a malfunction"],
[
[
"La panne apparaît en haut à droite au tour 2. Une panne détourne le bouton indiqué : il répare au lieu d’utiliser le système.",
"The malfunction appears in upper right on turn 2. It overrides the indicated button: that button repairs instead of using the system.",
"Réparez la panne surlignée.",
"Repair the highlighted malfunction."
],
[
"Androïde 1 : flèche droite au tour 1, puis B aux tours 2, 3 et 4. Inspectez la carte de menace pour lire ses vies et ses actions X/Y/Z.",
"Android 1: right arrow on turn 1, then B on turns 2, 3 and 4. Inspect the threat card for hit points and X/Y/Z effects.",
],
[
"Un B joué avant l’apparition aurait chargé le bouclier au lieu de réparer. Comparez les résultats en modifiant le programme après avoir recommencé.",
"A B before the threat appears would fill the shield instead of repairing. Restart and change your program to compare.",
],
"→ au tour 1, puis énergie aux tours 2–4.",
"→ on turn 1, then energy on turns 2–4."
]
],
{ threat: "I1-05", turn: 2 },
),
@ -76,17 +56,13 @@ export const LESSONS = [
["Robots et intercepteurs", "Battlebots and interceptors"],
[
[
"Les robots attendent en haut à droite et en bas à gauche. C prend une escouade ; le symbole robot est une action distincte qui combat les intrus.",
"Battlebots wait in upper right and lower left. C picks up a squad; the battlebot symbol is a separate action for fighting intruders.",
"Prenez les robots, puis rejoignez les intercepteurs.",
"Collect the battlebots, then reach the interceptors."
],
[
"Androïde 1 : flèche droite, C, flèche gauche aux tours 1–3. En phase 2 : flèche gauche puis C pour décoller depuis la salle en haut à gauche avec vos robots.",
"Android 1: right arrow, C, left arrow on turns 1–3. In phase 2: left arrow, then C to launch from upper left with your battlebots.",
],
[
"En vol : robot pour rester et tirer ; une case vide vous fait rentrer. Une autre action est retardée au retour. Les robots désactivés ne permettent pas de décoller.",
"In flight: battlebot action to stay and fire; an empty slot returns you. Other actions are delayed on return. Disabled battlebots cannot launch.",
],
"→ · 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(
@ -94,17 +70,13 @@ export const LESSONS = [
["Deux actions, dans l’ordre", "Two actions, in order"],
[
[
"Ce paquet contient des cartes à deux actions. Choisissez une moitié comme d’habitude : ses deux symboles s’exécutent de gauche à droite.",
"This deck has double-action cards. Choose a half normally: its two symbols execute left to right.",
"Déplacez-vous et tirez avec une seule carte.",
"Move and fire with one card."
],
[
"Comparez flèche droite + A avec A + flèche droite au tour 2 : le laser utilisé change. Vous ne pouvez pas volontairement ignorer une moitié réalisable.",
"Compare right arrow + A with A + right arrow on turn 2: they fire different lasers. You cannot voluntarily skip a performable half.",
],
[
"Si la première moitié provoque un retard (ascenseur occupé, Slime), la seconde passe au tour suivant. Les intercepteurs peuvent désormais changer de portée avec les doubles actions.",
"If the first half causes a delay (busy lift, Slime), the second moves to the next turn. Double actions also let interceptors change range.",
],
"Comparez → + armes et armes + → : l’ordre choisit le laser utilisé.",
"Compare → + weapons with weapons + →: the order determines which laser fires."
]
],
{ doubleActions: true },
),
@ -113,17 +85,13 @@ export const LESSONS = [
["Menaces de l’extension", "Expansion threats"],
[
[
"Le chasseur apparaît au tour 1. Dépliez sa carte : il alterne un tour visible et un tour déphasé. Les attaques entre crochets concernent les tours déphasés.",
"The fighter appears on turn 1. Open its card: it alternates a visible turn and a phased-out turn. Bracketed attacks apply on phased-out turns.",
"Touchez le chasseur lorsqu’il est visible.",
"Hit the fighter while it is visible."
],
[
"Essayez A aux tours 1, 2 et 3. Pendant le tour déphasé, votre arme l’ignore totalement et pourrait toucher une autre cible derrière lui.",
"Try A on turns 1, 2 and 3. While phased out, it is ignored completely and a weapon could hit another target behind it.",
],
[
"Le catalogue ajoute aussi plasma, mégaboucliers, renforts et intrus spéciaux. Chaque carte décrit ses exceptions ; les renforts sont révélés avec la menace qui peut les appeler.",
"Other new threats introduce plasma, megashields, reinforcements and special intruders. Each card explains its exceptions; reinforcements are revealed with their potential caller.",
],
"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."
]
],
{ threat: "E2-102", turn: 1 },
),
@ -132,17 +100,13 @@ export const LESSONS = [
["Spécialisations", "Specializations"],
[
[
"Les spécialisations remplacent les cartes héroïques. Niveau 1 : une capacité basique ; niveau 2 : une carte permettant basique ou avancée ; niveau 3 : les deux cartes.",
"Specializations replace heroic cards. Level 1: one basic ability; level 2: one card with basic or advanced; level 3: both cards.",
"Lancez une roquette à distance avec l’Artilleur.",
"Launch a rocket remotely with the Rocketeer."
],
[
"L’androïde 1 est Artilleur niveau 3. Essayez sa capacité basique depuis la passerelle : la roquette part à distance et touche au tour suivant. Lisez l’aide affichée quand vous sélectionnez une capacité.",
"Android 1 is a level-3 Rocketeer. Try the basic ability from the bridge: it launches remotely and hits next turn. Selecting an ability shows its rules.",
],
[
"Une carte de spécialisation ne s’échange pas. Le Médecin et l’Agent spécial peuvent combiner certaines cartes ; le Téléporteur place ses jetons pendant les transferts. En partie libre, choisissez les spécialités dans la configuration.",
"Specialization cards cannot be transferred. Medic and Special Ops can combine some cards; Teleporter assigns tokens during transfers. Choose specialties in setup for free play.",
],
"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."
]
],
{
specializations: [

View file

@ -89,3 +89,27 @@ test("BGS chapter metadata accepts the progress version emitted by every tutoria
tutorial.destroy();
}
});
test("every chapter can plan, execute, complete, and replay through native controls", async () => {
const { LESSONS } = await import("../src/tutorials.js");
for (const lesson of LESSONS) {
const tutorial = await createLessonTutorial(lesson.id);
await tutorial.continue();
if (lesson.basics) {
await place(tutorial, 1, "blue");
await place(tutorial, 2, "lift");
} else if (lesson.id === "first-shot") {
await place(tutorial, 2, "A");
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(tutorial.snapshot.completed, true, lesson.id);
await tutorial.previousStep();
assert.equal(tutorial.snapshot.completed, false, lesson.id);
assert.equal(completedTurns(tutorial.snapshot.state), 0, lesson.id);
tutorial.destroy();
}
});