diff --git a/bgs/tutorial.js b/bgs/tutorial.js index 8864d85..a188f80 100644 --- a/bgs/tutorial.js +++ b/bgs/tutorial.js @@ -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) => ``; 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 = `
${escape(LESSONS[index].title[locale === "fr" ? 0 : 1])}
${standalone ? `${t("Partie locale", "Local game")}` : ''}${transport("sound", soundOn ? "speaker" : "muted", soundOn ? t("Couper les sons", "Mute sounds") : t("Activer les sons", "Enable sounds"))}
+ guide.innerHTML = `
${standalone ? `${t("Partie locale", "Local game")}` : ''}${transport("sound", soundOn ? "speaker" : "muted", soundOn ? t("Couper les sons", "Mute sounds") : t("Activer les sons", "Enable sounds"))}

${escape(s.title)}

${escape(missed ? t("Destination manquée. Revenez préparer un autre trajet.", "Destination missed. Go back and plan another route.") : s.text)}

-
${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 ? `` : ''}${s.completed && (nextChapter || standalone && LESSONS[index + 1]) ? `` : ''}
+
${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 ? `` : ''}${s.completed && (nextChapter || standalone && LESSONS[index + 1]) ? `` : ''}
${s.error ? `

${escape(s.error)}

` : ''}`; } 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(); diff --git a/preview/app.js b/preview/app.js index 4cca28d..38c6629 100644 --- a/preview/app.js +++ b/preview/app.js @@ -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) => - `
${c.count > 1 ? `×${c.count}` : ""}${c.sides.map((side, index) => basic && !(side.length === 1 && ["red", "blue", "lift"].includes(side[0])) ? "" : ``).join("")}
`, + `
${c.count > 1 ? `×${c.count}` : ""}${c.sides.map((side, index) => teachingActions && !(side.length === 1 && teachingActions.includes(side[0])) ? "" : ``).join("")}
`, ) .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; diff --git a/preview/style.css b/preview/style.css index eec901a..e875fb1 100644 --- a/preview/style.css +++ b/preview/style.css @@ -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; } diff --git a/preview/tactical.js b/preview/tactical.js index 7bfa1b4..742b240 100644 --- a/preview/tactical.js +++ b/preview/tactical.js @@ -108,9 +108,9 @@ export function createTacticalView({ const details = (key, art, text, extra = "") => ``; return `
-
${details("A", weaponArt, fireText, `
${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")}
`)}
-
${details("B", system, chargeText, flow)}
-
${details("C", cIcon, cText)}
+
${details("A", weaponArt, fireText, `
${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")}
`)}
+
${details("B", system, chargeText, flow)}
+
${details("C", cIcon, cText)}
`; } diff --git a/src/tutorial-controller.js b/src/tutorial-controller.js index 8c0788d..8fd4860 100644 --- a/src/tutorial-controller.js +++ b/src/tutorial-controller.js @@ -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."), diff --git a/src/tutorials.js b/src/tutorials.js index fcd2da6..1887943 100644 --- a/src/tutorials.js +++ b/src/tutorials.js @@ -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: [ diff --git a/test/tutorial-controller.test.js b/test/tutorial-controller.test.js index 8fdd23d..85d433a 100644 --- a/test/tutorial-controller.test.js +++ b/test/tutorial-controller.test.js @@ -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(); + } +});