diff --git a/bgs/viewer.js b/bgs/viewer.js index f88809b..ea864d6 100644 --- a/bgs/viewer.js +++ b/bgs/viewer.js @@ -11,7 +11,7 @@ registerViewer("SpaceAlert", (context) => { 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 #footer,.bgs-hosted #open-setup {display:none!important} + .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 diff --git a/docs/artwork.json b/docs/artwork.json new file mode 100644 index 0000000..f87abdf --- /dev/null +++ b/docs/artwork.json @@ -0,0 +1,44 @@ +{ + "generator": "Built-in image_gen tool", + "usage": "Original illustrative equipment and threat art; live values and rules remain HTML overlays, never baked into images.", + "encoding": "WebP quality 84, original dimensions and alpha preserved.", + "assets": [ + { + "file": "preview/assets/fighter.webp", + "prompt": "Use case: stylized-concept. Asset type: polished illustrated object for a science-fiction cooperative board-game UI on a dark navy background. Primary request: One enemy fighter spacecraft, shown whole in a dynamic three-quarter top view, nose pointing down-left toward the viewer. Angular silver armor, burnt-orange wing panels, twin blazing cyan engines, threatening but readable silhouette, a faint translucent blue defensive shield arc around the hull. No other ships. Style: colorful hand-painted 3D game inventory illustration, premium tabletop game art, clear large shapes, crisp silhouette, bright ivory highlights and vivid cyan/amber accents, strong readable contrast at 120 pixels. Composition: one centered object filling 85 percent of a square image, generous clean edge margin, three-quarter isometric perspective. Background: uniform very dark navy #0b1722, no room or scenery, no star field. Lighting: bright soft key light and cyan edge light so the entire object remains readable; avoid muddy darkness. No text, UI, panels, labels, logos, watermark or border. Original design, not copied from an existing franchise." + }, + { + "file": "preview/assets/laser.webp", + "prompt": "Use case: stylized-concept. Asset type: polished illustrated object for a science-fiction cooperative board-game UI on a dark navy background. Primary request: One heavy shipboard laser turret: a large futuristic twin-barrel cannon on a circular rotating mount, ivory armor, brass mechanics, glowing amber energy chamber, two bright short red targeting beams pointing toward the upper right. The whole isolated object is visible. Style: colorful hand-painted 3D game inventory illustration, premium tabletop game art, clear large shapes, crisp silhouette, bright ivory highlights and vivid cyan/amber accents, strong readable contrast at 120 pixels. Composition: one centered object filling 85 percent of a square image, generous clean edge margin, three-quarter isometric perspective. Background: uniform very dark navy #0b1722, no room or scenery, no star field. Lighting: bright soft key light and cyan edge light so the entire object remains readable; avoid muddy darkness. No text, UI, panels, labels, logos, watermark or border. Original design, not copied from an existing franchise." + }, + { + "file": "preview/assets/computer.webp", + "prompt": "Use case: stylized-concept. Asset type: polished illustrated object for a science-fiction cooperative board-game UI on a dark navy background. Primary request: One shipboard command computer console: a broad physical workstation with two angled glowing turquoise displays, tactile amber buttons and an ivory armored pedestal. Screen graphics are abstract radar circles and blocks, absolutely no letters or numbers. The whole isolated object is visible. Style: colorful hand-painted 3D game inventory illustration, premium tabletop game art, clear large shapes, crisp silhouette, bright ivory highlights and vivid cyan/amber accents, strong readable contrast at 120 pixels. Composition: one centered object filling 85 percent of a square image, generous clean edge margin, three-quarter isometric perspective. Background: uniform very dark navy #0b1722, no room or scenery, no star field. Lighting: bright soft key light and cyan edge light so the entire object remains readable; avoid muddy darkness. No text, UI, panels, labels, logos, watermark or border. Original design, not copied from an existing franchise." + }, + { + "file": "preview/assets/battlebots.webp", + "prompt": "Use case: stylized-concept. Asset type: polished illustrated object for a science-fiction cooperative board-game UI on a dark navy background. Primary request: One sturdy friendly battle robot, full body, three-quarter front view, ivory armor over dark mechanical joints, bright cyan visor, two short heavy arm cannons, gold shoulder plates, stocky clear silhouette. The whole isolated robot is visible. Style: colorful hand-painted 3D game inventory illustration, premium tabletop game art, clear large shapes, crisp silhouette, bright ivory highlights and vivid cyan/amber accents, strong readable contrast at 120 pixels. Composition: one centered object filling 85 percent of a square image, generous clean edge margin, three-quarter isometric perspective. Background: uniform very dark navy #0b1722, no room or scenery, no star field. Lighting: bright soft key light and cyan edge light so the entire object remains readable; avoid muddy darkness. No text, UI, panels, labels, logos, watermark or border. Original design, not copied from an existing franchise." + }, + { + "file": "preview/assets/shield.webp", + "prompt": "Use case: stylized-concept. Asset type: isolated illustrated equipment for a science-fiction board-game UI on dark navy. One shipboard defensive shield generator: a squat circular ivory-and-brass projector emitting a vivid turquoise transparent hexagonal shield dome, clear protective shield silhouette. Match premium hand-painted 3D game inventory art: bright ivory armor, brass mechanisms, crisp large shapes and strong cyan/amber edge lighting. One centered object fills 85% of a square image, three-quarter isometric view, generous clean edge margin. Plain very dark navy #0b1722 backdrop without room or scenery. Readable at 80px. No text, UI, numbers, labels, logo, watermark or border. Original design." + }, + { + "file": "preview/assets/reactor.webp", + "prompt": "Use case: stylized-concept. Asset type: isolated illustrated equipment for a science-fiction board-game UI on dark navy. One shipboard power reactor: a cylindrical glowing golden-orange energy core in an ivory armored housing, heavy copper connectors and three clearly readable illuminated energy cells. Match premium hand-painted 3D game inventory art: bright ivory armor, brass mechanisms, crisp large shapes and strong cyan/amber edge lighting. One centered object fills 85% of a square image, three-quarter isometric view, generous clean edge margin. Plain very dark navy #0b1722 backdrop without room or scenery. Readable at 80px. No text, UI, numbers, labels, logo, watermark or border. Original design." + }, + { + "file": "preview/assets/pulse.webp", + "prompt": "Use case: stylized-concept. Asset type: isolated illustrated equipment for a science-fiction board-game UI on dark navy. One shipboard omnidirectional pulse cannon: a round ivory-and-brass emitter on a rotating mount with a vivid violet-blue plasma sphere and two broad luminous concentric shockwave rings. It must look different from a barrel-shaped laser cannon. Match premium hand-painted 3D game inventory art: bright ivory armor, brass mechanisms, crisp large shapes and strong cyan/amber edge lighting. One centered object fills 85% of a square image, three-quarter isometric view, generous clean edge margin. Plain very dark navy #0b1722 backdrop without room or scenery. Readable at 80px. No text, UI, numbers, labels, logo, watermark or border. Original design." + }, + { + "file": "preview/assets/rocket.webp", + "prompt": "Use case: stylized-concept. Asset type: isolated illustrated equipment for a science-fiction board-game UI on dark navy. One futuristic ship-launched missile on a small rack: an ivory rocket with orange fins, metallic body and brilliant cyan exhaust, angled diagonally up-right, whole object visible. Match premium hand-painted 3D game inventory art: bright ivory armor, brass mechanisms, crisp large shapes and strong cyan/amber edge lighting. One centered object fills 85% of a square image, three-quarter isometric view, generous clean edge margin. Plain very dark navy #0b1722 backdrop without room or scenery. Readable at 80px. No text, UI, numbers, labels, logo, watermark or border. Original design." + } + ], + "currentRendering": { + "equipment": "Flat, original SVG drawings in preview/icons.js (equipmentPicture). These replace the detailed equipment bitmaps on the ship, cards and inspectors.", + "ship": "HTML rooms and original SVG/CSS hull, doors, lifts and energy conduits in preview/tactical.js and preview/style.css.", + "threats": "Flat, original SVG silhouettes in preview/icons.js, grouped by threat family in preview/art.js. All previous bitmap illustrations are retained as design sources but are no longer displayed or bundled." + } +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..3d71c47 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,724 @@ +{ + "name": "@boardgamers/space-alert", + "version": "0.1.4", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@boardgamers/space-alert", + "version": "0.1.4", + "license": "AGPL-3.0-only", + "devDependencies": { + "@boardgamers/protocol": "0.8.1", + "esbuild": "^0.28.2" + }, + "engines": { + "node": ">=24" + } + }, + "../boardgamers-mono/node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node": { + "version": "24.11.0", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "../boardgamers-mono/node_modules/.pnpm/oxfmt@0.61.0_svelte@5.56.8_@typescript-eslint+types@8.56.1_/node_modules/oxfmt": { + "version": "0.61.0", + "dev": true, + "license": "MIT", + "dependencies": { + "tinypool": "2.1.0" + }, + "bin": { + "oxfmt": "bin/oxfmt" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxfmt/binding-android-arm-eabi": "0.61.0", + "@oxfmt/binding-android-arm64": "0.61.0", + "@oxfmt/binding-darwin-arm64": "0.61.0", + "@oxfmt/binding-darwin-x64": "0.61.0", + "@oxfmt/binding-freebsd-x64": "0.61.0", + "@oxfmt/binding-linux-arm-gnueabihf": "0.61.0", + "@oxfmt/binding-linux-arm-musleabihf": "0.61.0", + "@oxfmt/binding-linux-arm64-gnu": "0.61.0", + "@oxfmt/binding-linux-arm64-musl": "0.61.0", + "@oxfmt/binding-linux-ppc64-gnu": "0.61.0", + "@oxfmt/binding-linux-riscv64-gnu": "0.61.0", + "@oxfmt/binding-linux-riscv64-musl": "0.61.0", + "@oxfmt/binding-linux-s390x-gnu": "0.61.0", + "@oxfmt/binding-linux-x64-gnu": "0.61.0", + "@oxfmt/binding-linux-x64-musl": "0.61.0", + "@oxfmt/binding-openharmony-arm64": "0.61.0", + "@oxfmt/binding-win32-arm64-msvc": "0.61.0", + "@oxfmt/binding-win32-ia32-msvc": "0.61.0", + "@oxfmt/binding-win32-x64-msvc": "0.61.0" + }, + "peerDependencies": { + "svelte": "^5.0.0", + "vite-plus": "*" + }, + "peerDependenciesMeta": { + "svelte": { + "optional": true + }, + "vite-plus": { + "optional": true + } + } + }, + "../boardgamers-mono/node_modules/.pnpm/oxlint-tsgolint@0.16.0/node_modules/oxlint-tsgolint": { + "version": "0.16.0", + "dev": true, + "license": "MIT", + "bin": { + "tsgolint": "bin/tsgolint.js" + }, + "optionalDependencies": { + "@oxlint-tsgolint/darwin-arm64": "0.16.0", + "@oxlint-tsgolint/darwin-x64": "0.16.0", + "@oxlint-tsgolint/linux-arm64": "0.16.0", + "@oxlint-tsgolint/linux-x64": "0.16.0", + "@oxlint-tsgolint/win32-arm64": "0.16.0", + "@oxlint-tsgolint/win32-x64": "0.16.0" + } + }, + "../boardgamers-mono/node_modules/.pnpm/oxlint@1.51.0_oxlint-tsgolint@0.16.0/node_modules/oxlint": { + "version": "1.51.0", + "dev": true, + "license": "MIT", + "bin": { + "oxlint": "bin/oxlint" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxlint/binding-android-arm-eabi": "1.51.0", + "@oxlint/binding-android-arm64": "1.51.0", + "@oxlint/binding-darwin-arm64": "1.51.0", + "@oxlint/binding-darwin-x64": "1.51.0", + "@oxlint/binding-freebsd-x64": "1.51.0", + "@oxlint/binding-linux-arm-gnueabihf": "1.51.0", + "@oxlint/binding-linux-arm-musleabihf": "1.51.0", + "@oxlint/binding-linux-arm64-gnu": "1.51.0", + "@oxlint/binding-linux-arm64-musl": "1.51.0", + "@oxlint/binding-linux-ppc64-gnu": "1.51.0", + "@oxlint/binding-linux-riscv64-gnu": "1.51.0", + "@oxlint/binding-linux-riscv64-musl": "1.51.0", + "@oxlint/binding-linux-s390x-gnu": "1.51.0", + "@oxlint/binding-linux-x64-gnu": "1.51.0", + "@oxlint/binding-linux-x64-musl": "1.51.0", + "@oxlint/binding-openharmony-arm64": "1.51.0", + "@oxlint/binding-win32-arm64-msvc": "1.51.0", + "@oxlint/binding-win32-ia32-msvc": "1.51.0", + "@oxlint/binding-win32-x64-msvc": "1.51.0" + }, + "peerDependencies": { + "oxlint-tsgolint": ">=0.15.0" + }, + "peerDependenciesMeta": { + "oxlint-tsgolint": { + "optional": true + } + } + }, + "../boardgamers-mono/node_modules/.pnpm/playwright@1.62.1/node_modules/playwright": { + "version": "1.62.1", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.62.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "../boardgamers-mono/node_modules/.pnpm/typescript@7.0.2/node_modules/typescript": { + "version": "7.0.2", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc" + }, + "engines": { + "node": ">=16.20.0" + }, + "optionalDependencies": { + "@typescript/typescript-aix-ppc64": "7.0.2", + "@typescript/typescript-darwin-arm64": "7.0.2", + "@typescript/typescript-darwin-x64": "7.0.2", + "@typescript/typescript-freebsd-arm64": "7.0.2", + "@typescript/typescript-freebsd-x64": "7.0.2", + "@typescript/typescript-linux-arm": "7.0.2", + "@typescript/typescript-linux-arm64": "7.0.2", + "@typescript/typescript-linux-loong64": "7.0.2", + "@typescript/typescript-linux-mips64el": "7.0.2", + "@typescript/typescript-linux-ppc64": "7.0.2", + "@typescript/typescript-linux-riscv64": "7.0.2", + "@typescript/typescript-linux-s390x": "7.0.2", + "@typescript/typescript-linux-x64": "7.0.2", + "@typescript/typescript-netbsd-arm64": "7.0.2", + "@typescript/typescript-netbsd-x64": "7.0.2", + "@typescript/typescript-openbsd-arm64": "7.0.2", + "@typescript/typescript-openbsd-x64": "7.0.2", + "@typescript/typescript-sunos-x64": "7.0.2", + "@typescript/typescript-win32-arm64": "7.0.2", + "@typescript/typescript-win32-x64": "7.0.2" + } + }, + "../boardgamers-mono/node_modules/.pnpm/zod@4.3.6/node_modules/zod": { + "version": "4.3.6", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "../boardgamers-mono/packages/protocol": { + "name": "@boardgamers/protocol", + "version": "0.8.1", + "dev": true, + "license": "AGPL-3.0-only", + "dependencies": { + "zod": "^4.3.6" + }, + "devDependencies": { + "@types/node": "catalog:", + "oxfmt": "catalog:", + "oxlint": "^1.51.0", + "oxlint-tsgolint": "^0.16.0", + "playwright": "1.62.1", + "typescript": "catalog:" + } + }, + "../boardgamers-mono/packages/protocol/node_modules/@types/node": { + "resolved": "../boardgamers-mono/node_modules/.pnpm/@types+node@24.11.0/node_modules/@types/node", + "link": true + }, + "../boardgamers-mono/packages/protocol/node_modules/oxfmt": { + "resolved": "../boardgamers-mono/node_modules/.pnpm/oxfmt@0.61.0_svelte@5.56.8_@typescript-eslint+types@8.56.1_/node_modules/oxfmt", + "link": true + }, + "../boardgamers-mono/packages/protocol/node_modules/oxlint": { + "resolved": "../boardgamers-mono/node_modules/.pnpm/oxlint@1.51.0_oxlint-tsgolint@0.16.0/node_modules/oxlint", + "link": true + }, + "../boardgamers-mono/packages/protocol/node_modules/oxlint-tsgolint": { + "resolved": "../boardgamers-mono/node_modules/.pnpm/oxlint-tsgolint@0.16.0/node_modules/oxlint-tsgolint", + "link": true + }, + "../boardgamers-mono/packages/protocol/node_modules/playwright": { + "resolved": "../boardgamers-mono/node_modules/.pnpm/playwright@1.62.1/node_modules/playwright", + "link": true + }, + "../boardgamers-mono/packages/protocol/node_modules/typescript": { + "resolved": "../boardgamers-mono/node_modules/.pnpm/typescript@7.0.2/node_modules/typescript", + "link": true + }, + "../boardgamers-mono/packages/protocol/node_modules/zod": { + "resolved": "../boardgamers-mono/node_modules/.pnpm/zod@4.3.6/node_modules/zod", + "link": true + }, + "node_modules/@boardgamers/protocol": { + "resolved": "../boardgamers-mono/packages/protocol", + "link": true + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/esbuild": { + "version": "0.28.2", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + } + } +} diff --git a/package.json b/package.json index f506d11..478c84f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@boardgamers/space-alert", - "version": "0.1.3", + "version": "0.1.4", "private": true, "type": "module", "description": "Space Alert and The New Frontier: deterministic game engine and local playtest", @@ -19,7 +19,7 @@ "url": "git+https://github.com/boardgamers/space-alert.git" }, "devDependencies": { - "@boardgamers/protocol": "^0.8.0", + "@boardgamers/protocol": "0.8.1", "esbuild": "^0.28.2" }, "exports": { diff --git a/preview/app.js b/preview/app.js index cb8930f..0e4afce 100644 --- a/preview/app.js +++ b/preview/app.js @@ -1,8 +1,14 @@ +import { mountNavigation } from "./navigation.js"; +import { pictogram, shipLocator, specializationIcons } from "./icons.js"; +import { createTacticalView } from "./tactical.js"; +import { illustration } from "./art.js"; import { specialDescription, traitDescriptions, effectDescription, eventDescription, + zoneLabel, + stationLabel, } from "./text.js"; export function mountConsole(root, host = null) { const $ = (s) => root.querySelector(s); @@ -40,15 +46,18 @@ export function mountConsole(root, host = null) { combine = false, lastSpoken = 0; const t = (fr, en) => (locale === "fr" ? fr : en); + const navigation = mountNavigation(root, { + locale: () => locale, + hosted: !!host, + }); + let appearance = {}; + const playerBadge = (i) => { + const badge = appearance.players?.[i]?.pro && appearance.supporterBadge; + return badge ? `${esc(badge.label)}` : ""; + }; const playerName = (i) => esc(view?.players[i]?.name ?? `${t("Joueur", "Player")} ${i + 1}`); - const zones = ["red", "white", "blue"]; - const zoneName = (z) => - ({ - red: t("Rouge", "Red"), - white: t("Blanc", "White"), - blue: t("Bleu", "Blue"), - })[z] ?? z; + const zoneName = (z) => zoneLabel(z, locale); const names = { rocketeer: ["Artilleur", "Rocketeer"], "data-analyst": ["Analyste", "Data Analyst"], @@ -74,28 +83,52 @@ export function mountConsole(root, host = null) { "C · Station system or repair", ), bots: t("Attaquer avec les robots", "Battlebot attack"), - red: t("Aller vers le rouge", "Move red"), - blue: t("Aller vers le bleu", "Move blue"), + red: t("Aller à gauche", "Move left"), + blue: t("Aller à droite", "Move right"), lift: t("Changer de pont", "Change deck"), })[a] ?? (a.startsWith("special:") ? `${specialName(a.split(":")[1])} · ${a.endsWith("advanced") ? t("avancé", "advanced") : t("basique", "basic")}` : a.startsWith("teleport:") - ? t("Déplacement héroïque · ", "Heroic move · ") + a.slice(9) + ? t("Déplacement héroïque · ", "Heroic move · ") + + stationLabel(a.slice(9), locale) : a.startsWith("hero:") ? t("Héroïque · ", "Heroic · ") + label(a.slice(5)) : a); function icon(a) { + if (a === "bots") + return `${illustration("battlebots")}`; if (a.startsWith("special:")) - return `✦ ${esc(specialName(a.split(":")[1]))}
${a.endsWith("advanced") ? "Ⅱ" : "Ⅰ"}
`; - if (a.startsWith("hero:")) return "★" + icon(a.slice(5)); + return `${pictogram(specializationIcons[a.split(":")[1]])}${a.endsWith("advanced") ? "Ⅱ" : "Ⅰ"}`; + if (a.startsWith("hero:")) + return `${pictogram("star")}${icon(a.slice(5))}`; if (a.startsWith("teleport:")) - return `↗ ${esc(zoneName(a.split(":")[1].split("-")[0]))}
${a.endsWith("upper") ? "↑" : "↓"}
`; - return ( - { A: "A", B: "B", C: "C", bots: "♟", red: "←", blue: "→", lift: "↕" }[ - a - ] ?? esc(a) - ); + return `${pictogram("teleport")}${shipLocator([a.slice(9)])}`; + const actionIcon = { + bots: "bots", + red: "left", + blue: "right", + lift: "lift", + }[a]; + return actionIcon ? pictogram(actionIcon) : esc(a); + } + const symbol = (name, description, content = "") => + `${pictogram(name)}${content}`; + const { shipCutaway, threatPortrait } = createTacticalView({ + t, + esc, + symbol, + zoneName, + }); + function updateSound() { + const button = $("#sound"); + const description = sound + ? t("Désactiver les annonces vocales", "Mute voice announcements") + : t("Activer les annonces vocales", "Enable voice announcements"); + button.title = description; + button.setAttribute("aria-label", description); + button.setAttribute("aria-pressed", String(sound)); + button.innerHTML = pictogram(sound ? "speaker" : "muted"); } const duration = (ms) => { const s = Math.max(0, Math.ceil(ms / 1000)); @@ -135,12 +168,28 @@ export function mountConsole(root, host = null) { ); } function button(command, text, disabled = false, extra = "") { - return ``; + const name = { + ready: "check", + unready: "close", + "advance-phase": "step", + "finish-planning": "lock", + draw: "cards", + "draw-android": "android", + resolve: "step", + "resolve-all": "forward", + }[command]; + return ``; } function phaseFor(turn) { return turn <= 3 ? 1 : turn <= 7 ? 2 : 3; } function localizeSetup() { + updateSound(); + $("#seat").setAttribute("aria-label", t("Point de vue", "Viewpoint")); + $("#program-crew").setAttribute( + "aria-label", + t("Équipier à programmer", "Crew to program"), + ); const fields = { players: ["Joueurs", "Players"], "crew-size": ["Équipage", "Crew"], @@ -194,27 +243,21 @@ export function mountConsole(root, host = null) { ], }; options.difficulty = options["serious-difficulty"] = [ - ["Blanches", "White"], - ["Blanches + jaunes", "White + yellow"], - ["Jaunes", "Yellow"], - ["Toutes", "All"], - ["Jaunes + rouges", "Yellow + red"], - ["Rouges", "Red"], + ["Niveau 1", "Level 1"], + ["Niveaux 1 + 2", "Levels 1 + 2"], + ["Niveau 2", "Level 2"], + ["Tous les niveaux", "All levels"], + ["Niveaux 2 + 3", "Levels 2 + 3"], + ["Niveau 3", "Level 3"], ]; for (const [id, values] of Object.entries(options)) [...$("#" + id).options].forEach( (o, i) => (o.textContent = t(...values[i])), ); for (const [id, words] of Object.entries({ - "new-button": ["Nouvelle session locale", "New local session"], - "ready-all": [ - "Confirmer tous les joueurs · test local", - "Ready all players · local test", - ], - "next-event": [ - "Prochaine annonce · test local", - "Next announcement · local test", - ], + "new-button": ["Préparer la mission", "Prepare mission"], + "ready-all": ["Tout l’équipage est prêt", "Ready all crew"], + "next-event": ["Prochaine annonce", "Next announcement"], "create-explorer-button": ["Créer un explorateur", "Create explorer"], })) $("#" + id).textContent = t(...words); @@ -230,12 +273,6 @@ export function mountConsole(root, host = null) { if (crew >= view.crewSize) crew = seat; root.lang = locale; localizeSetup(); - $("#locale").value = locale; - const openThreats = new Set( - [...root.querySelectorAll("details[data-threat][open]")].map( - (el) => el.dataset.threat, - ), - ); const g = view.game, own = view.players[seat] ?? { ready: true, @@ -266,30 +303,12 @@ export function mountConsole(root, host = null) { $("#crew").innerHTML = view.players .map( (p) => - `${playerName(p.seat)} · ${p.planningPhase ? `${p.finishedPlanning ? "🔒" : t("Phase", "Phase")} ${p.planningPhase}` : p.ready ? t("présent", "ready") : t("attente", "waiting")}`, + `${playerName(p.seat)}${playerBadge(p.seat)} · ${p.planningPhase ? `${p.finishedPlanning ? "🔒" : t("Phase", "Phase")} ${p.planningPhase}` : p.ready ? t("présent", "ready") : t("attente", "waiting")}`, ) .join(""); $("#ship-title").textContent = t("Le vaisseau", "The ship"); $("#threat-title").textContent = t("Menaces détectées", "Detected threats"); $("#program-title").textContent = t("Programme de vol", "Flight program"); - $("#journal-title").textContent = t("Journal de mission", "Mission log"); - $("#setup-title").textContent = t( - "Session locale · configuration", - "Local session · setup", - ); - $("#help-title").textContent = t("Guide de bord", "Flight guide"); - $("#notice").textContent = t( - "Jeu de base et The New Frontier · version locale en cours de validation.", - "Base game and The New Frontier · local playtest under rules review.", - ); - $("#scope").textContent = t( - "103 menaces, doubles actions, spécialisations et carrières disponibles. Choisissez une mission courte pour débuter.", - "103 threats, double actions, specializations and careers available. Choose a short mission to start.", - ); - $("#lessons-title").textContent = t( - "École de vol · exercices libres", - "Flight school · untimed exercises", - ); $("#lesson-list").innerHTML = lessons .map( (l) => @@ -298,55 +317,45 @@ export function mountConsole(root, host = null) { .join(" "); $("#lesson-guide").hidden = !view.tutorial; $("#lesson-guide").innerHTML = view.tutorial - ? `

${esc(view.tutorial.title[locale === "fr" ? 0 : 1])}

    ${view.tutorial.instructions.map((p) => `
  1. ${esc(p[locale === "fr" ? 0 : 1])}
  2. `).join("")}
${view.stage === "programming" ? `` : ""} ` + ? `
    ${view.tutorial.instructions.map((p) => `
  1. ${esc(p[locale === "fr" ? 0 : 1])}
  2. `).join("")}
${view.stage === "programming" ? `` : ""} ` : ""; - $("#footer").textContent = t( - "Adaptation en cours · Space Alert, Vlaada Chvátil / Czech Games Edition. Hôte local de test ; aucune connexion à BGS.", - "Adaptation in progress · Space Alert, Vlaada Chvátil / Czech Games Edition. Local test host; no BGS connection.", + $("#comms").innerHTML = symbol( + view.communicationsAvailable ? "comms" : "muted", + view.communicationsAvailable + ? t("Communications disponibles", "Communications online") + : t( + "Communications interrompues : gardez le silence", + "Communications down: stay silent", + ), + view.communicationsAvailable + ? "" + : `${t("Silence", "Silence")}`, ); - $("#comms").textContent = view.communicationsAvailable - ? t("COMMS · OK", "COMMS · ONLINE") - : t("COMMS · SILENCE", "COMMS · BLACKOUT"); $("#comms").classList.toggle("offline", !view.communicationsAvailable); $("#phase").textContent = view.phase ? `${t("PHASE", "PHASE")} ${view.phase}` : ""; if (ship) { - $("#ship").innerHTML = ["upper", "lower"] - .flatMap((deck) => - zones.map((z) => { - const station = `${z}-${deck}`, - s = ship.zones[z], - crewHere = ship.crew.filter( - (p) => p.station === station && !p.space, - ); - const system = deck === "upper" ? "shield" : "reactor", - capacity = - (system === "shield" - ? z === "white" - ? 3 - : 2 - : z === "white" - ? 5 - : 3) - Number(s.damage.includes(system)); - const c = { - "red-upper": t("Intercepteurs", "Interceptors"), - "white-upper": t("Ordinateur", "Computer"), - "blue-upper": t("Robots", "Battlebots"), - "red-lower": t("Robots", "Battlebots"), - "white-lower": t("Observation", "Visual confirmation"), - "blue-lower": t("Roquette", "Rocket"), - }[station]; - return `
${esc(zoneName(z))} ${deck === "upper" ? "↑" : "↓"}
${deck === "lower" && z === "white" ? "◎" : "⌁"} ${(deck === "upper" ? (z === "white" ? 5 : 4) : z === "white" ? 1 : 2) - Number(s.damage.includes(`${deck}-weapon`) && station !== "white-lower")}
A ${deck === "lower" && z === "white" ? t("Impulsion", "Pulse") : t("Laser", "Laser")}
B ${system === "shield" ? "⛨" : "⚡"} ${s[system]}/${capacity}
C ${esc(c)}
${crewHere.map((p) => `${p.id + 1}`).join("")}
${s.damage.length ? `
${t("Dégâts", "Damage")} ${s.damage.length}/6
` : ""}
`; - }), - ) - .join(""); + $("#ship").innerHTML = shipCutaway({ + ship, + selectedCrew: crew, + canPlan: + view.stage === "programming" && + seat >= 0 && + (g?.solo || crew === seat || crew >= view.players.length) && + !own.finishedPlanning, + crewLabel: (id) => + view.players[id]?.name ?? `${t("Androïde", "Android")} ${id + 1}`, + }); $("#resources").innerHTML = - `⚡ ${t("Combustible", "Fuel")} ${ship.fuel}↗ ${t("Roquettes", "Rockets")} ${ship.rockets}⌨ ${ship.computer.map((x) => (x ? "●" : "○")).join(" ")}♟ ${ship.bots.filter((b) => b.owner === null && b.station && !b.disabled).length} ${t("disponibles", "available")}${ship.crew + `${symbol("fuel", `${t("Combustible", "Fuel")} : ${ship.fuel}`, `${ship.fuel}`)}${symbol("rocket", `${t("Roquettes", "Rockets")} : ${ship.rockets}`, `${ship.rockets}`)}${symbol("computer", t("Ordinateur", "Computer") + " · " + ship.computer.map((x, i) => `${t("Phase", "Phase")} ${i + 1} : ${x ? t("entretenu", "maintained") : t("à entretenir", "not maintained")}`).join(" · "), ship.computer.map((x, i) => `${i + 1}`).join(""))}${symbol("bots", `${t("Robots disponibles", "Available battlebots")} : ${ship.bots.filter((b) => b.owner === null && b.station && !b.disabled).length}`, `${ship.bots.filter((b) => b.owner === null && b.station && !b.disabled).length}`)}${ship.crew .filter((p) => p.space) - .map( - (p) => - `↗ ${t("Équipier", "Crew")} ${p.id + 1} · ${t("portée", "range")} ${p.space}${p.knockedOut ? " †" : ""}`, + .map((p) => + symbol( + "interceptor", + `${t("Équipier", "Crew")} ${p.id + 1} · ${t("portée", "range")} ${p.space}${p.knockedOut ? " · " + t("hors combat", "knocked out") : ""}`, + `${p.id + 1} · ${p.space}${p.knockedOut ? " †" : ""}`, + ), ) .join("")}`; } @@ -359,7 +368,7 @@ export function mountConsole(root, host = null) { threats .map( (th) => - `
T+${th.turn}${esc(th.name)}${th.status === "destroyed" ? "✓" : th.status === "survived" ? "↘" : `${Math.max(0, th.hp - (th.damage ?? 0))} ♥ · ${th.shield} ⛨`}

${th.position === "internal" ? esc(th.stations.join(", ")) + " · " + esc(label(th.repair)) : esc(zoneName(th.zone))} · ${t("Vitesse", "Speed")} ${th.speed}

${traitDescriptions( + `
${(th.track ?? g.tracks[th.zone ?? "internal"]) ? trackHtml(th, g) : ""}
`, ) .join("") || `

${t("En attente des premières détections.", "Awaiting the first detections.")}

`; @@ -401,7 +410,7 @@ export function mountConsole(root, host = null) { $("#program-crew").innerHTML = Array.from( { length: view.crewSize }, (_, i) => - ``, + ``, ).join(""); const planning = view.stage === "programming", canOwn = @@ -416,7 +425,8 @@ export function mountConsole(root, host = null) { canOwn && !own.finishedPlanning && phaseFor(slot.turn) === ownPhase; - return ``; + const description = `T+${slot.turn} · ${slot.cards.map((c) => (c.sides ? c.sides[c.side].map(label).join(" → ") : c.category === "movement" ? t("Déplacement", "Movement") : t("Action", "Action"))).join(" + ") || t("Vide", "Empty")}`; + return ``; }) .join(""); $("#player-help").textContent = planning @@ -426,8 +436,8 @@ export function mountConsole(root, host = null) { "Choose a turn for this card.", ) : t( - "Choisissez une moitié de carte, puis un tour. Cliquez sur un tour rempli pour reprendre sa carte.", - "Choose a card half, then a turn. Click a filled turn to retrieve its card.", + "Choisissez une carte, puis un tour.", + "Choose a card, then a turn.", ) : view.stage === "presence" ? t( @@ -469,7 +479,10 @@ export function mountConsole(root, host = null) { $("#ready-controls").replaceChildren( ...(preparing ? [...$("#controls").childNodes] : []), ); - if (preparing && host) $("#notice").textContent = view.mission.title; + if (preparing) + $("#ready-help").textContent = + view.mission.title + " · " + $("#ready-help").textContent; + $("#crew").hidden = view.players.length === 1 && !preparing; const hand = [ ...(g?.hand ?? []), ...(g?.androidCards ?? []).filter((c) => c.owner === crew), @@ -491,7 +504,7 @@ export function mountConsole(root, host = null) { g.specializations.some( (s) => s && ["medic", "special-ops"].includes(s.name), ) - ? `` + ? `` : ""; $("#card-help").textContent = selected .map((choice) => { @@ -528,11 +541,11 @@ export function mountConsole(root, host = null) { .join("") : ""; $("#hand-filter").innerHTML = - planning && canOwn && grouped.length > 12 + planning && canOwn && (grouped.length > 12 || handFilter !== "all") ? ["all", "A", "B", "C", "bots", "move"] .map( (f) => - ``, + ``, ) .join("") : ""; @@ -569,15 +582,36 @@ export function mountConsole(root, host = null) { $("#ready-all").disabled = view.stage !== "presence"; $("#next-event").disabled = !!view.tutorial || !["programming", "countdown"].includes(view.stage); - $("#help").innerHTML = t( - "

Planifier. 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.

Coordonner. 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.

Ordinateur. 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.

Menaces. 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.

Coopérer à distance. Utilisez une conversation vocale externe. Pendant une panne de communication, gardez le silence : cette page ne peut pas couper votre appel.

", - "

Plan. 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.

Coordinate. 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.

Computer. 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.

Threats. 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.

Remote cooperation. Use external voice chat. Stay silent during communications blackouts; this page cannot mute your call.

", - ); + $("#ready-all").hidden = $("#ready-all").disabled; + $("#next-event").hidden = $("#next-event").disabled; + $("#help").innerHTML = + `
${[ + ["laser", t("Laser", "Laser")], + ["pulse", t("Impulsion", "Pulse")], + ["shield", t("Bouclier", "Shield")], + ["reactor", t("Réacteur", "Reactor")], + ["fuel", t("Combustible", "Fuel")], + ["computer", t("Ordinateur", "Computer")], + ["bots", t("Robots", "Battlebots")], + ["android", t("Androïde", "Android")], + ["interceptor", t("Intercepteurs", "Interceptors")], + ["observation", t("Observation", "Visual confirmation")], + ["rocket", t("Roquette", "Rocket")], + ["hull", t("Points de vie", "Hit points")], + ] + .map(([name, text]) => `${pictogram(name)}${esc(text)}`) + .join("")}
` + + `

${t("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.", "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.")}

` + + t( + "

Planifier. 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.

Coordonner. 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.

Ordinateur. 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.

Menaces. 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.

Coopérer à distance. Utilisez une conversation vocale externe. Pendant une panne de communication, gardez le silence : cette page ne peut pas couper votre appel.

", + "

Plan. 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.

Coordinate. 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.

Computer. 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.

Threats. 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.

Remote cooperation. Use external voice chat. Stay silent during communications blackouts; this page cannot mute your call.

", + ); + navigation.sync(); } function calledHtml(data) { if (!data) return ""; const c = data.card; - return `

${t("Renfort", "Reinforcement")} · ${esc(c.name)}

${c.hp} ♥ · ${c.shield} ⛨ · ${t("Vitesse", "Speed")} ${c.speed}${c.stations ? " · " + esc(c.stations.join(", ")) + " · " + esc(label(c.repair)) : ""}

${traitDescriptions( + return `

${t("Renfort", "Reinforcement")} · ${esc(c.name)}

${c.hp} ♥ · ${c.shield} ⛨ · ${t("Vitesse", "Speed")} ${c.speed}${c.stations ? " · " + esc(c.stations.map((s) => stationLabel(s, locale)).join(", ")) + " · " + esc(label(c.repair)) : ""}

${traitDescriptions( c, locale, ) @@ -591,15 +625,16 @@ export function mountConsole(root, host = null) { } function trackHtml(th, g) { const track = th.track ?? g.tracks[th.zone ?? "internal"]; - return `
${Array.from( + const pending = ["pending", "announced", "waiting"].includes(th.status); + return `
${pending ? t("À l’arrivée", "On arrival") : t("Approche", "Approach")}
${Array.from( { length: track.length }, (_, i) => track.length - i, ) .map( (n) => - ` x[0] === n) ? "mark" : ""}">${track.marks.find((x) => x[0] === n)?.[1] ?? ""}`, + ` x[0] === n)[1] : ""}" class="${!pending && th.positionOnTrack === n ? "current" : ""} ${pending && n === track.length ? "entry" : ""} ${track.marks.some((x) => x[0] === n) ? "mark" : ""}">${track.marks.find((x) => x[0] === n)?.[1] ?? (!pending && th.positionOnTrack === n ? "●" : "")}`, ) - .join("")}
`; + .join("")}
${pictogram("ship")}
`; } function logText(e) { return eventDescription( @@ -625,7 +660,7 @@ export function mountConsole(root, host = null) { ? Array.from( { length: Number($("#players").value) }, (_, id) => - ``; if (c.stage === "ready") - content += `

${t("Prochaine mission : celle sélectionnée dans la configuration.", "Next mission: the one selected in setup.")}

`; + content += `

${t("Prochaine mission : celle sélectionnée dans la configuration.", "Next mission: the one selected in setup.")}

`; if (c.outcome) content += `

${t("Score de campagne", "Campaign score")} : ${c.outcome.score}

`; $("#campaign").innerHTML = content; @@ -737,15 +773,6 @@ export function mountConsole(root, host = null) { const k = JSON.stringify([locale, next.explorers]); if (k === careerKey) return; careerKey = k; - $("#career-title").textContent = t( - host ? "Explorateurs · cette table" : "Explorateurs · carrières locales", - host ? "Explorers · this table" : "Explorers · local careers", - ); - const opened = new Set( - [...root.querySelectorAll("details[data-explorer][open]")].map( - (d) => d.dataset.explorer, - ), - ); $("#explorers").innerHTML = (next.explorers ?? []) .map((e) => { const spent = Object.values(e.specializations).reduce( @@ -766,9 +793,9 @@ export function mountConsole(root, host = null) { : ""; const claims = !e.activeRun && !e.dead && e.eligible.length && (!host || e.editable) - ? `

${t("Conditions officielles des succès", "Official achievement requirements")}

` + ? `

${t("Conditions officielles des succès", "Official achievement requirements")}

` : ""; - return `
${esc(e.name)} · ${t("Niveau", "Level")} ${e.level} · ${e.xp} XP ${e.dead ? "†" : e.activeRun ? "· " + t("en mission", "on mission") : ""}

${e.cloning ? t("Clonage autorisé", "Cloning enabled") : t("Hardcore", "Hardcore")} · ${e.clones} ${t("clone(s)", "clone(s)")}

${Object.entries( + return `

${esc(e.name)} · ${t("Niveau", "Level")} ${e.level} · ${e.xp} XP ${e.dead ? "†" : e.activeRun ? "· " + t("en mission", "on mission") : ""}

${e.cloning ? t("Clonage autorisé", "Cloning enabled") : t("Hardcore", "Hardcore")} · ${e.clones} ${t("clone(s)", "clone(s)")}

${Object.entries( e.specializations, ) .map(([n, l]) => `${esc(specialName(n))} ${l}`) @@ -794,7 +821,7 @@ export function mountConsole(root, host = null) { (r) => `

  • ${r.survived ? "✓" : "✕"} ${r.score} · +${r.xp} XP
  • `, ) - .join("")}
    `; + .join("")}`; }) .join(""); setupSpecialists(); @@ -854,7 +881,7 @@ export function mountConsole(root, host = null) { try { const next = await fetch(`/api/state?seat=${seat}`).then((r) => r.json()); render(next); - $("#connection").textContent = t("HÔTE LOCAL", "LOCAL HOST"); + $("#connection").textContent = ""; } catch { $("#connection").textContent = t("RECONNEXION", "RECONNECTING"); } @@ -868,8 +895,7 @@ export function mountConsole(root, host = null) { return; if (!el || pending) return; if (el.id === "open-setup") { - $("#setup").open = true; - $("#setup").scrollIntoView({ block: "start" }); + navigation.openPanel("setup"); return; } if (el.dataset.lesson) { @@ -879,7 +905,7 @@ export function mountConsole(root, host = null) { selected = []; replayFrame = null; await localPost("/api/lesson", { lesson: el.dataset.lesson }); - $("#lessons").open = false; + navigation.closePanel(); $("#lesson-guide").scrollIntoView({ block: "start" }); }); return; @@ -893,6 +919,14 @@ export function mountConsole(root, host = null) { rerender(); return; } + if (el.dataset.pickAction) { + handFilter = el.dataset.pickAction; + selected = []; + navigation.closePanel(); + rerender(); + $("#hand-filter").scrollIntoView({ block: "center" }); + return; + } if (el.id === "campaign-continue" || el.id === "campaign-return") { perform(() => command("campaign-vote", { continue: el.id === "campaign-continue" }), @@ -1070,8 +1104,7 @@ export function mountConsole(root, host = null) { } if (el.id === "sound") { sound = !sound; - el.setAttribute("aria-pressed", sound); - el.textContent = sound ? "♫" : "♪"; + updateSound(); if (sound) speak(t("Annonces activées", "Announcements enabled")); else speechSynthesis.cancel(); } @@ -1095,10 +1128,6 @@ export function mountConsole(root, host = null) { rerender(); } }); - $("#locale").addEventListener("change", (e) => { - locale = e.target.value; - rerender(); - }); $("#seat").addEventListener("change", (e) => { seat = Number(e.target.value); crew = seat; @@ -1167,7 +1196,7 @@ export function mountConsole(root, host = null) { selected = []; crew = seat; render(next); - $("#setup").open = false; + navigation.closePanel(); }); }); if (!host) intervals.push(setInterval(refresh, 650)); @@ -1211,7 +1240,7 @@ export function mountConsole(root, host = null) { if (host) { root.classList.add("bgs-hosted"); fillMissions(host.missions); - $("#connection").textContent = "BGS"; + $("#connection").textContent = ""; $(".brand").removeAttribute("href"); } else { void (async () => { @@ -1231,7 +1260,7 @@ export function mountConsole(root, host = null) { "1,2"; } render(next); - if (host) $("#connection").textContent = "BGS"; + if (host) $("#connection").textContent = ""; }, setPlayer(index) { seat = index ?? -1; @@ -1240,11 +1269,13 @@ export function mountConsole(root, host = null) { rerender(); }, setPreferences(prefs) { + appearance = prefs.bgs ?? {}; if (prefs.locale) locale = prefs.locale; if (prefs.sound !== undefined) sound = !!prefs.sound; rerender(); }, destroy() { + navigation.destroy(); for (const id of intervals) clearInterval(id); for (const [type, fn] of rootListeners) root.removeEventListener(type, fn); diff --git a/preview/art.js b/preview/art.js new file mode 100644 index 0000000..99f6720 --- /dev/null +++ b/preview/art.js @@ -0,0 +1,28 @@ +import { equipmentPicture, pictogram } from "./icons.js"; + +export function illustration(name) { + return ( + equipmentPicture(name) ?? + `${pictogram(name)}` + ); +} + +export function threatIllustration(threat) { + if (threat.position === "internal") + return illustration(threat.repair === "bots" ? "battlebots" : "computer"); + // Canonical catalogue names do not change with the viewer's language. + const family = + [ + [/asteroid|meteoroid|planetoid/i, "asteroid"], + [/swarm/i, "swarm"], + [/satellite|saucer/i, "satellite"], + [/capsule/i, "capsule"], + [/amoeba|jellyfish|octopus|crab|spider|snake|dragon/i, "organism"], + [/cloud|maelstrom|pulse ball|phasing pulser/i, "energy-cloud"], + [ + /destroyer|frigate|man-of-war|tanker|carrier|juggernaut|behemoth|overlord/i, + "cruiser", + ], + ].find(([pattern]) => pattern.test(threat.name))?.[1] ?? "fighter"; + return illustration(family); +} diff --git a/preview/assets/battlebots.webp b/preview/assets/battlebots.webp new file mode 100644 index 0000000..2199989 Binary files /dev/null and b/preview/assets/battlebots.webp differ diff --git a/preview/assets/computer.webp b/preview/assets/computer.webp new file mode 100644 index 0000000..0b8b4c6 Binary files /dev/null and b/preview/assets/computer.webp differ diff --git a/preview/assets/fighter.webp b/preview/assets/fighter.webp new file mode 100644 index 0000000..447446f Binary files /dev/null and b/preview/assets/fighter.webp differ diff --git a/preview/assets/laser.webp b/preview/assets/laser.webp new file mode 100644 index 0000000..eec2586 Binary files /dev/null and b/preview/assets/laser.webp differ diff --git a/preview/assets/pulse.webp b/preview/assets/pulse.webp new file mode 100644 index 0000000..45639f7 Binary files /dev/null and b/preview/assets/pulse.webp differ diff --git a/preview/assets/reactor.webp b/preview/assets/reactor.webp new file mode 100644 index 0000000..0a59837 Binary files /dev/null and b/preview/assets/reactor.webp differ diff --git a/preview/assets/rocket.webp b/preview/assets/rocket.webp new file mode 100644 index 0000000..d0120a2 Binary files /dev/null and b/preview/assets/rocket.webp differ diff --git a/preview/assets/shield.webp b/preview/assets/shield.webp new file mode 100644 index 0000000..a6eeaf8 Binary files /dev/null and b/preview/assets/shield.webp differ diff --git a/preview/icons.js b/preview/icons.js new file mode 100644 index 0000000..61a562c --- /dev/null +++ b/preview/icons.js @@ -0,0 +1,107 @@ +// Shared silhouettes keep the ship, cards and controls visually consistent. +const paths = { + journal: "M5 3h14v18H5zM9 7h6M9 11h6M9 15h4", + training: "m3 9 9-6 9 6-9 6-9-6Zm4 3v6l5 3 5-3v-6", + ship: "m4 20 4-11L20 4l-5 12-11 4Zm4-11 7 7M3 15l6 6", + crew: "M8 8a4 4 0 1 0 8 0 4 4 0 1 0-8 0ZM4 21v-3a8 8 0 0 1 16 0v3", + guide: "M4 4h6l2 2 2-2h6v16h-6l-2 2-2-2H4V4Zm8 2v16", + android: "M5 7h14v13H5zM12 3v4M10 3h4M8 11h1m6 0h1M8 16h8M2 10v6m20-6v6", + bots: "m5 4 7-2 7 2v9l-7 4-7-4V4ZM8 8h2m4 0h2M9 12h6M4 21l2-6m14 6-2-6M9 17v4m6-4v4", + laser: "M3 14h8v6H3zM6 14V9h4v5M9 9l8-6M14 10l7-5M17 13l5-4", + pulse: + "M9 12a3 3 0 1 0 6 0 3 3 0 1 0-6 0ZM6 6a8.5 8.5 0 0 0 0 12m12-12a8.5 8.5 0 0 1 0 12M3 3a13 13 0 0 0 0 18m18-18a13 13 0 0 1 0 18", + shield: "m12 2 8 3v6c0 5-4 8-8 11-4-3-8-6-8-11V5l8-3Z", + reactor: "m13 2-8 11h6l-1 9 9-12h-6l1-8Z", + fuel: "M7 3h8v3H7zM5 6h14v15H5zM5 10h4m6 0h4M13 11l-4 5h3l-1 4 5-6h-3v-3Z", + computer: "M3 3h18v13H3zM8 21h8m-4-5v5M6 7l3 2-3 2m6 1h5", + observation: + "M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12Zm7 0a3 3 0 1 0 6 0 3 3 0 1 0-6 0Z", + rocket: + "M9 15C7 7 13 2 21 3c1 8-4 14-12 12ZM9 9H5l-3 6h6m7 0v4l-6 3v-6M5 18l-3 4m13-14h2v2h-2z", + interceptor: "m12 2 3 9 7 5v3l-8-3v5h-4v-5l-8 3v-3 7-5 3-9Z", + left: "M21 12H3m7-7-7 7 7 7", + right: "M3 12h18m-7-7 7 7-7 7", + up: "M12 21V3m-7 7 7-7 7 7", + down: "M12 3v18m-7-7 7 7 7-7", + lift: "M8 21V3L3 8m14-5v18l5-5", + move: "M3 12h18M8 7l-5 5 5 5m8-10 5 5-5 5", + lock: "M6 10h12v11H6zM8 10V6a4 4 0 0 1 8 0v4m-4 5v2", + step: "m5 4 11 8L5 20V4Zm14 0v16", + forward: "m2 5 9 7-9 7V5Zm10 0 9 7-9 7V5Z", + restart: "M4 10a8 8 0 1 1 1 8M4 3v7h7", + check: "m4 12 5 5L20 6", + close: "m5 5 14 14M5 19 19 5", + cards: "M7 7h13v15H7zM4 18H2V2h13v2", + combine: "M2 6h7v12H2zM15 6h7v12h-7zM9 12h6m-3-3v6", + speaker: "M3 9h4l5-5v16l-5-5H3V9Zm13-2a7 7 0 0 1 0 10m3-13a11 11 0 0 1 0 16", + muted: "M3 9h4l5-5v16l-5-5H3V9Zm13 0 6 6m-6 0 6-6", + comms: + "M12 12v9m-4 0h8M8 7a6 6 0 0 0 0 8m8-8a6 6 0 0 1 0 8M5 3a11 11 0 0 0 0 16M19 3a11 11 0 0 1 0 16M11 10h2v2h-2z", + warning: "m12 2 10 19H2L12 2Zm0 6v6m0 3v1", + hull: "m12 2 9 5v10l-9 5-9-5V7l9-5Zm-5 6h10v8H7z", + speed: "M3 18a9 9 0 1 1 18 0M12 14l5-7M10 16a2 2 0 1 0 4 0 2 2 0 1 0-4 0Z", + star: "m12 2 3 7 7 1-5 5 1 7-6-4-6 4 1-7-5-5 7-1 3-7Z", + medic: "M9 3h6v6h6v6h-6v6H9v-6H3V9h6V3Z", + teleport: "M7 2C1 5 1 19 7 22m10-20c6 3 6 17 0 20M5 12h14m-5-5 5 5-5 5", + compass: "M2 12a10 10 0 1 0 20 0 10 10 0 1 0-20 0Zm14-5-3 7-6 3 3-7 6-3Z", + spy: "M3 8h18M5 8l3-6 4 2 4-2 3 6M4 13h6v4H4zM14 13h6v4h-6zM10 14h4", + leader: "M6 3h12v18H6zM9 8l3-3 3 3m-6 5 3-3 3 3m-6 5 3-3 3 3", + wrench: "m15 3-3 3 1 5 5 1 3-3a7 7 0 0 1-9 9l-6 5-4-4 6-6a7 7 0 0 1 7-10Z", +}; + +export const specializationIcons = { + rocketeer: "rocket", + "data-analyst": "cards", + "energy-technician": "reactor", + "pulse-gunner": "pulse", + medic: "medic", + teleporter: "teleport", + hypernavigator: "compass", + "special-ops": "spy", + "squad-leader": "leader", + mechanic: "wrench", +}; + +export function pictogram(name) { + return ``; +} + +// A miniature of the actual six-room plan, readable without colour. +export function shipLocator(stations, incomingZone = null) { + const zones = ["red", "white", "blue"]; + const incoming = zones.includes(incomingZone); + const offset = incoming ? 22 : 0; + const x = zones.indexOf(incomingZone) * 20 + 13; + return ``; +} + +// Large, flat equipment drawings stay readable on the cutaway's smallest rooms. +// Colours, silhouettes and action letters provide independent visual cues. +const equipment = { + laser: ``, + "light-laser": ``, + pulse: ``, + shield: ``, + reactor: ``, + computer: ``, + battlebots: ``, + interceptor: ``, + observation: ``, + rocket: ``, + fuel: ``, + fighter: ``, + cruiser: ``, + asteroid: ``, + "energy-cloud": ``, + organism: ``, + swarm: ``, + satellite: ``, + capsule: ``, +}; + +export function equipmentPicture(name) { + const drawing = equipment[name === "bots" ? "battlebots" : name]; + return drawing + ? `` + : null; +} diff --git a/preview/index.html b/preview/index.html index 9d42e97..1f0b064 100644 --- a/preview/index.html +++ b/preview/index.html @@ -9,14 +9,10 @@
    ✦ - SPACE ALERTSITTING DUCK · FLIGHT CONSOLE✦ SPACE ALERTSITTING DUCK
    -
    +
    - LOCAL +

    Space Alert

    @@ -43,7 +40,6 @@
    -
    @@ -51,7 +47,7 @@

    -
    +

    @@ -63,11 +59,8 @@

    -
    +

    @@ -81,117 +74,131 @@
    -
    - -
      -
      -
      - École de vol · exercices libres -
      -
      -
      - -
      - - - - - -
      -
      - -
      -

      - -
      -
      - Explorateurs · carrières locales -
      - -
      -
      -
      -
      - -
      -
      -
      + +
      + + +
      +
      + + + + + + +
      +
      + +
      +

      + +
      +
      +
      diff --git a/preview/navigation.js b/preview/navigation.js new file mode 100644 index 0000000..252fad6 --- /dev/null +++ b/preview/navigation.js @@ -0,0 +1,251 @@ +import { pictogram, specializationIcons } from "./icons.js"; + +const navIcons = { + journal: "journal", + lessons: "training", + setup: "ship", + "career-manager": "crew", + guide: "guide", +}; +const labels = { + journal: ["Journal", "Log"], + lessons: ["Entraînement", "Training"], + setup: ["Missions", "Missions"], + "career-manager": ["Équipage", "Crew"], + guide: ["Guide", "Guide"], +}; +export function mountNavigation(root, { locale, hosted }) { + const $ = (s) => root.querySelector(s); + const t = (fr, en) => (locale() === "fr" ? fr : en); + const menu = $("#console-menu"); + const picker = $("#choice-menu"); + const error = $("#error"); + const errorAnchor = document.createComment("mission errors"); + error.before(errorAnchor); + const controls = new WeakMap(); + let activePanel = null, + choiceId = null, + inspected = null, + navLocale = null; + function openPanel(id, title) { + if (hosted && ["setup", "lessons"].includes(id)) return; + activePanel = id; + for (const panel of root.querySelectorAll("[data-panel-content]")) + panel.hidden = panel.id !== 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); + if (!menu.open) menu.showModal(); + $(".dialog-body").scrollTop = 0; + } + function closePanel() { + if (picker.open) picker.close(); + if (menu.open) menu.close(); + } + function labelFor(select) { + return ( + select.getAttribute("aria-label") ?? + select.parentElement.firstChild?.textContent.trim() ?? + "" + ); + } + function optionButton(option, select, pickerOption = false) { + const button = document.createElement("button"); + button.type = "button"; + button.textContent = option.textContent; + if (select.id === "program-crew") { + button.innerHTML = pictogram(option.dataset.kind); + const name = document.createElement("span"); + name.textContent = option.dataset.shortLabel; + button.append(name); + if (option.dataset.specialization) { + const badge = document.createElement("span"); + badge.className = "crew-specialization"; + badge.innerHTML = pictogram( + specializationIcons[option.dataset.specialization], + ); + button.append(badge); + } + button.title = option.textContent; + button.setAttribute("aria-label", option.textContent); + } + button.disabled = option.disabled || select.disabled; + button.dataset.choiceValue = option.value; + button.dataset.choiceFor = select.id; + button.setAttribute("aria-pressed", String(option.selected)); + if (pickerOption) button.dataset.pickerOption = ""; + return button; + } + function syncChoices() { + for (const select of root.querySelectorAll("select")) { + if (!select.id) continue; + let control = controls.get(select); + if (!control) { + // The native select remains the form's state, while visible controls use buttons. + const parent = select.parentElement; + if (parent.tagName === "LABEL") { + const field = document.createElement("div"); + for (const attr of parent.attributes) + field.setAttribute(attr.name, attr.value); + field.classList.add("field"); + field.append(...parent.childNodes); + parent.replaceWith(field); + } + select.hidden = true; + select.tabIndex = -1; + control = document.createElement("div"); + control.className = "choice-control"; + control.setAttribute("role", "group"); + select.after(control); + controls.set(select, control); + } + const text = labelFor(select); + control.hidden = + (hosted && select.id === "seat") || + (select.id === "seat" && select.options.length < 2); + control.setAttribute("aria-label", text); + control.classList.toggle("crew-tabs", select.id === "program-crew"); + const signature = JSON.stringify([ + text, + select.value, + select.disabled, + [...select.options].map((o) => [ + o.value, + o.textContent, + o.disabled, + { ...o.dataset }, + ]), + ]); + if (control.dataset.signature === signature) continue; + control.dataset.signature = signature; + const focused = control.contains(root.ownerDocument.activeElement) + ? root.ownerDocument.activeElement.dataset.choiceValue + : null; + const inline = select.options.length <= 5 && select.id !== "seat"; + control.classList.toggle("segmented", inline); + control.replaceChildren(); + if (inline) { + for (const option of select.options) + control.append(optionButton(option, select)); + } else { + const trigger = document.createElement("button"); + trigger.type = "button"; + trigger.className = "choice-trigger"; + trigger.dataset.choose = select.id; + trigger.disabled = select.disabled || !select.options.length; + trigger.setAttribute("aria-haspopup", "dialog"); + trigger.setAttribute( + "aria-label", + `${text} : ${select.selectedOptions[0]?.textContent ?? ""}`, + ); + const value = document.createElement("span"); + value.textContent = select.selectedOptions[0]?.textContent ?? "—"; + trigger.append(value); + const symbol = document.createElement("span"); + symbol.className = "choice-symbol"; + symbol.textContent = "↗"; + symbol.setAttribute("aria-hidden", "true"); + trigger.append(symbol); + control.append(trigger); + } + if (focused !== null) + [...control.querySelectorAll("button")] + .find((b) => b.dataset.choiceValue === focused) + ?.focus({ preventScroll: true }); + } + } + function inspect(key) { + const card = [...root.querySelectorAll("[data-inspect]")].find( + (el) => el.dataset.inspect === key, + ); + if (!card) return; + inspected = key; + $("#inspection").replaceChildren( + card.parentElement.querySelector("template").content.cloneNode(true), + ); + openPanel( + "inspection", + card.dataset.inspectTitle ?? card.querySelector("strong").textContent, + ); + } + function sync() { + if (navLocale !== locale()) { + navLocale = locale(); + $("#console-nav").innerHTML = Object.entries(labels) + .filter(([id]) => !hosted || !["setup", "lessons"].includes(id)) + .map( + ([id, words]) => + ``, + ) + .join(""); + for (const close of root.querySelectorAll("[data-close-dialog]")) + close.setAttribute("aria-label", t("Fermer", "Close")); + if (activePanel && activePanel !== "inspection") + $("#menu-title").textContent = t(...labels[activePanel]); + } + syncChoices(); + if (hosted) + $('[data-panel="career-manager"]').hidden = + !$("#explorers").childElementCount; + if (menu.open && activePanel === "inspection" && inspected) { + const card = [...root.querySelectorAll("[data-inspect]")].find( + (el) => el.dataset.inspect === inspected, + ); + if (card) { + const template = card.parentElement.querySelector("template"); + if ($("#inspection").innerHTML !== template.innerHTML) + $("#inspection").innerHTML = template.innerHTML; + } + } + if (picker.open && !root.querySelector(`#${CSS.escape(choiceId)}`)) + picker.close(); + } + function click(event) { + const button = event.target.closest("button"); + if (!button || !root.contains(button)) return; + if (button.hasAttribute("data-close-dialog")) + button.closest("dialog").close(); + else if (button.dataset.panel) openPanel(button.dataset.panel); + else if (button.dataset.inspect) inspect(button.dataset.inspect); + else if (button.dataset.choose) { + choiceId = button.dataset.choose; + const select = root.querySelector(`#${CSS.escape(choiceId)}`); + $("#choice-title").textContent = labelFor(select); + $("#choice-list").replaceChildren( + ...[...select.options].map((o) => optionButton(o, select, true)), + ); + picker.showModal(); + } else if (button.dataset.choiceFor) { + const select = root.querySelector( + `#${CSS.escape(button.dataset.choiceFor)}`, + ); + if (!select || select.disabled) return; + if (button.hasAttribute("data-picker-option")) picker.close(); + select.value = button.dataset.choiceValue; + select.dispatchEvent(new Event("change", { bubbles: true })); + sync(); + } + } + function closed() { + errorAnchor.after(error); + activePanel = null; + inspected = null; + for (const button of root.querySelectorAll("[data-panel]")) + button.setAttribute("aria-expanded", "false"); + } + root.addEventListener("click", click); + menu.addEventListener("close", closed); + sync(); + return { + sync, + syncChoices, + openPanel, + closePanel, + destroy() { + closePanel(); + root.removeEventListener("click", click); + menu.removeEventListener("close", closed); + }, + }; +} diff --git a/preview/server.js b/preview/server.js index c8b99e8..d500897 100644 --- a/preview/server.js +++ b/preview/server.js @@ -397,11 +397,28 @@ export function createPreviewServer({ clock = Date.now, storagePath } = {}) { view: viewFor(seat), }); } + if ( + req.method === "GET" && + /^\/assets\/(fighter|laser|computer|battlebots|shield|reactor|pulse|rocket)\.webp$/.test( + url.pathname, + ) + ) { + res.writeHead(200, { + "Content-Type": "image/webp", + "Cache-Control": "no-store", + }); + res.end(await readFile(new URL(`.${url.pathname}`, import.meta.url))); + return; + } const file = { "/": "index.html", "/app.js": "app.js", "/local.js": "local.js", "/text.js": "text.js", + "/navigation.js": "navigation.js", + "/icons.js": "icons.js", + "/art.js": "art.js", + "/tactical.js": "tactical.js", "/style.css": "style.css", }[url.pathname]; if (req.method === "GET" && file) { diff --git a/preview/style.css b/preview/style.css index 3d7047e..fff4da2 100644 --- a/preview/style.css +++ b/preview/style.css @@ -1,9 +1,9 @@ :root { font-family: Inter, ui-sans-serif, system-ui, sans-serif; - color: #d4e1e6; + color: #eaf3f7; background: #0b141c; font-synthesis: none; - --muted: #95aab6; + --muted: #bfd0dc; --line: #2b3c48; --gold: #e8c984; --panel: #12232f; @@ -21,6 +21,9 @@ body { background: radial-gradient(ellipse at 10% 0, #20344450, transparent 60%); min-height: 100vh; } +body:has(.console-dialog[open]) { + overflow: hidden; +} button, select, input { @@ -39,17 +42,50 @@ select { button { cursor: pointer; } +.pictogram { + display: inline-block; + width: 24px; + height: 24px; + flex-shrink: 0; + fill: none; + stroke: currentColor; + stroke-width: 2.1; + stroke-linecap: round; + stroke-linejoin: round; + vertical-align: middle; +} +.icon-button, +.icon-label, +.controls button { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 8px; + vertical-align: middle; +} +.icon-button, +#sound { + min-width: 44px; + min-height: 44px; + padding: 8px; +} +.symbol-stat { + display: inline-flex; + align-items: center; + gap: 5px; + white-space: nowrap; +} button:hover { border-color: var(--gold); } button:focus-visible, select:focus-visible, -summary:focus-visible { +input:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; } button:disabled { - opacity: 0.4; + opacity: 0.6; cursor: default; } button.quiet { @@ -144,14 +180,6 @@ h1 { content: "● "; color: var(--cyan); } -.notice { - font-size: 12px; - color: var(--muted); - border-left: 2px solid #67737b; - padding: 4px 12px; - margin-bottom: 20px; - line-height: 1.5; -} .flight-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); @@ -180,74 +208,6 @@ h2 { #comms.offline { color: var(--red); } -.ship { - display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); - gap: 7px; - padding: 12px 10px; - background: linear-gradient(130deg, #1d3444, #11202b); - border: 1px solid #3a5260; - border-radius: 50% 50% 14px 14px/12% 12% 10px 10px; -} -.station { - border: 1px solid #405864; - border-top: 3px solid var(--zone); - background: #0d1c28ce; - padding: 10px 7px; - border-radius: 6px; - min-width: 0; - position: relative; -} -.station-title { - font-size: 10px; - color: var(--zone); - text-transform: uppercase; - font-weight: 700; - letter-spacing: 0.4px; -} -.station .weapon { - font-size: 20px; - margin: 9px 0 5px; - color: var(--zone); -} -.systems { - font-size: 10px; - line-height: 1.8; - color: #b1c4cf; -} -.systems b { - display: inline-block; - color: var(--gold); - min-width: 15px; -} -.occupants { - min-height: 23px; - display: flex; - gap: 2px; - flex-wrap: wrap; - margin-top: 6px; -} -.pawn { - display: inline-flex; - align-items: center; - justify-content: center; - border: 1px solid var(--gold); - background: #e8c98420; - color: var(--gold); - border-radius: 50%; - width: 21px; - height: 21px; - font-size: 11px; - font-weight: 700; -} -.pawn.out { - opacity: 0.5; - text-decoration: line-through; -} -.damage { - color: var(--red); - font-size: 10px; -} .resources { display: flex; justify-content: space-between; @@ -259,6 +219,27 @@ h2 { } .resources b { color: var(--gold); + font-size: 14px; +} +.resources .pictogram { + width: 21px; + height: 21px; +} +.computer-phase { + display: inline-flex; + align-items: center; + justify-content: center; + width: 16px; + height: 18px; + border: 1px solid var(--line); + border-radius: 3px; + color: var(--muted); + font-size: 10px; +} +.computer-phase.maintained { + background: #24494b; + border-color: var(--cyan); + color: #d5ffff; } .threat { border: 1px solid var(--line); @@ -268,19 +249,30 @@ h2 { padding: 9px 11px; background: #101f2b; } -.threat summary { +.threat-card { display: flex; gap: 7px; align-items: center; cursor: pointer; font-size: 12px; } -.threat summary strong { +.threat-card strong { flex: 1; } .threat .stats { color: var(--muted); font-size: 11px; + display: inline-flex; + gap: 10px; +} +.threat .stats .pictogram { + width: 17px; + height: 17px; +} +.threat-facts { + display: flex; + gap: 20px; + color: var(--gold); } .threat p { font-size: 12px; @@ -330,11 +322,23 @@ h2 { color: var(--muted); display: block; } +.slot .turn .pictogram { + width: 10px; + height: 10px; +} .slot .action { font-size: 18px; - display: block; + display: flex; + justify-content: center; + align-items: center; + flex-wrap: wrap; + gap: 2px; min-height: 22px; } +.slot .action .pictogram { + width: 22px; + height: 22px; +} .slot.future { opacity: 0.4; } @@ -390,6 +394,14 @@ h2 { padding: 4px; font-size: 20px; background: transparent; + display: flex; + align-items: center; + justify-content: center; + gap: 3px; +} +.card button > .pictogram { + min-width: 0; + flex-shrink: 1; } .card button + button { border-top: 1px solid var(--line); @@ -411,6 +423,75 @@ h2 { color: var(--muted); pointer-events: none; } +.special-action, +.hero-action, +.teleport-action { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 3px; + min-width: 0; +} +.special-action small { + color: var(--gold); + font-size: 10px; +} +.hero-action > .pictogram:first-child { + width: 12px; + height: 12px; + color: var(--gold); +} +.teleport-action > .pictogram { + position: absolute; + top: 0; + left: 0; + width: 13px; + height: 13px; +} +.teleport-action { + position: relative; + display: block; + width: 39px; + height: 29px; +} +.teleport-action .ship-locator { + width: 34px; + height: 24px; + margin: 5px 0 0 5px; +} +.ship-locator { + display: block; + width: 60px; + height: auto; + flex-shrink: 0; +} +.ship-locator .locator-hull { + fill: #10232f; + stroke: #8ea5b3; + stroke-width: 1.2; +} +.ship-locator rect { + fill: #142e3d; + stroke: #728e9d; + stroke-width: 1; +} +.ship-locator rect.located { + fill: var(--zone, #eaf3f7); + stroke: #f5fbff; + stroke-width: 1.5; +} +.ship-locator .incoming-arrow { + fill: none; + stroke: var(--zone, #eaf3f7); + stroke-width: 2.5; + stroke-linecap: round; + stroke-linejoin: round; +} +.card button.selected .special-action small, +.card button.selected .hero-action > .pictogram, +.card button.selected .teleport-action { + color: inherit; +} .empty { font-size: 13px; color: var(--muted); @@ -433,17 +514,6 @@ h2 { font-size: 12px; line-height: 1.6; } -main > details { - border-top: 1px solid var(--line); - margin-top: 24px; - padding-top: 12px; -} -summary { - cursor: pointer; - font-size: 13px; - min-height: 36px; - line-height: 1.5; -} ol { padding-left: 24px; } @@ -454,10 +524,8 @@ li { color: var(--muted); } #announcements { - max-height: 330px; - overflow: auto; - overscroll-behavior: auto; - touch-action: auto; + margin: 0; + padding-left: 24px; } form { display: flex; @@ -465,29 +533,24 @@ form { align-items: end; flex-wrap: wrap; } -label { +label, +.field { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; } -form button { +form button[type="submit"], +#create-explorer-button { background: var(--gold); color: #10202a; } -#scope, #help { font-size: 13px; line-height: 1.7; color: var(--muted); } -footer { - margin-top: 30px; - color: #78929f; - font-size: 11px; - line-height: 1.6; -} #error { color: #ffc6b7; font-size: 13px; @@ -529,16 +592,6 @@ footer { .timer strong { font-size: 26px; } - .notice { - margin-bottom: 14px; - font-size: 11px; - } - .station { - padding: 8px 6px; - } - .ship { - padding: 10px 7px; - } .program { grid-template-columns: repeat(6, minmax(0, 1fr)); } @@ -574,9 +627,6 @@ footer { max-width: 180px; font-size: 12px; } - .systems { - font-size: 9px; - } } @media (prefers-reduced-motion: reduce) { * { @@ -624,7 +674,7 @@ footer { #hand-filter { display: flex; flex-wrap: wrap; - gap: 0.3rem; + gap: 3px; margin: 0.4rem 0; } #hand-filter [aria-pressed="true"] { @@ -634,12 +684,6 @@ footer { #explorers button { margin: 0.2rem 0.1rem; } -#explorers details { - margin: 0.6rem 0; - padding: 0.7rem; - border: 1px solid #34434d; - border-radius: 0.6rem; -} #explorers select { max-width: 100%; } @@ -686,18 +730,14 @@ input:not([type="checkbox"]):not([type="range"]) { background: #102530; } #lesson-guide li { - margin: 0.6rem 0; + margin: 0.15rem 0; line-height: 1.5; } -#lesson-guide h2 { - font-size: 1rem; -} #lesson-list button { margin: 0.3rem 0.1rem; } -.preparing .flight-layout, -.preparing #journal { +.preparing .flight-layout { display: none; } #preparation { @@ -707,3 +747,1215 @@ input:not([type="checkbox"]):not([type="range"]) { margin-bottom: 12px; color: var(--muted); } + +/* The console remains the play surface; secondary screens live in a game menu. */ +#connection:empty { + display: none; +} +.console-nav { + display: flex; + flex-wrap: wrap; + gap: 4px; + max-width: 1260px; + margin: auto; + padding: 8px 28px; + border-bottom: 1px solid var(--line); +} +.console-nav button { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 8px; + background: transparent; + border-color: transparent; + font-size: 12px; + color: var(--muted); +} +.console-nav button:hover, +.console-nav button[aria-expanded="true"] { + background: var(--panel); + border-color: var(--line); + color: var(--gold); +} +.console-nav svg { + width: 19px; + height: 19px; + fill: none; + stroke: currentColor; + stroke-width: 1.6; + stroke-linecap: round; + stroke-linejoin: round; +} +.console-dialog { + color: #d4e1e6; + background: linear-gradient(135deg, #172b39, #0d1b26 65%); + border: 1px solid #536977; + border-radius: 12px; + padding: 0; + width: 880px; + max-width: calc(100% - 32px); + max-height: calc(100% - 48px); + max-height: calc(100dvh - 48px); + box-shadow: 0 20px 90px #0009; +} +.console-dialog[open] { + display: flex; + flex-direction: column; +} +.console-dialog::backdrop { + background: #03090edd; +} +.dialog-header { + display: flex; + flex-shrink: 0; + align-items: center; + justify-content: space-between; + gap: 16px; + padding: 14px 20px; + border-bottom: 1px solid var(--line); +} +.dialog-header h2 { + color: var(--gold); + font-size: 16px; + letter-spacing: 1px; +} +.dialog-header button { + min-width: 44px; + height: 44px; + background: transparent; + font-size: 24px; + border-color: var(--line); +} +.dialog-body { + min-height: 0; + overflow: auto; + padding: 22px; + touch-action: auto; +} +.dialog-body p, +.dialog-body li { + font-size: 13px; + line-height: 1.6; +} +.choice-dialog { + width: 640px; +} +.choice-list { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); + gap: 8px; +} +.choice-list button { + text-align: left; + min-height: 52px; +} +.choice-control { + display: flex; + gap: 4px; + min-width: 0; +} +.choice-control.segmented { + flex-wrap: wrap; +} +.choice-control button { + font-size: 12px; + min-height: 44px; + background: #0c1b26; + color: #b7cbd7; + border-color: #344c5d; +} +.choice-control button[aria-pressed="true"], +.choice-list button[aria-pressed="true"] { + background: #293b3d; + border-color: var(--gold); + color: #ffe4a7; +} +.choice-trigger { + display: flex; + justify-content: space-between; + align-items: center; + gap: 14px; + width: 100%; + text-align: left; +} +.choice-trigger > span:first-child { + min-width: 0; + overflow-wrap: anywhere; +} +.choice-symbol { + color: var(--gold); +} +.crew-tabs { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); + gap: 5px; + margin-bottom: 12px; +} +.crew-tabs button { + min-width: 0; + padding: 8px 6px; + border-radius: 6px 6px 2px 2px; + border-bottom-width: 3px; + overflow-wrap: anywhere; + display: flex; + justify-content: center; + align-items: center; + gap: 6px; +} +.crew-tabs button > span:not(.crew-specialization) { + min-width: 0; +} +.crew-specialization .pictogram { + width: 14px; + height: 14px; + color: var(--gold); +} +.pictogram-legend { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); + gap: 12px; + margin-bottom: 22px; +} +.pictogram-legend > span { + display: flex; + align-items: center; + gap: 8px; +} +#new-session { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + align-items: start; + gap: 20px; +} +#new-session .token-controls, +#new-button { + grid-column: 1 / -1; +} +#new-session .token-controls:empty { + display: none; +} +#new-session .field { + min-width: 0; +} +#new-session .choice-control button { + flex: 1; +} +#new-button { + justify-self: end; + min-width: 180px; +} +#ready-all, +#next-event { + margin-top: 20px; +} +#lesson-list { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 12px; + counter-reset: lessons; +} +#lesson-list button { + counter-increment: lessons; + display: flex; + align-items: center; + gap: 14px; + min-height: 82px; + margin: 0; + text-align: left; + background: #142a38; +} +#lesson-list button::before { + content: counter(lessons, decimal-leading-zero); + color: var(--gold); + font-size: 22px; + font-variant-numeric: tabular-nums; +} +.explorer-card { + padding: 18px; + background: #122633; + border: 1px solid var(--line); + border-radius: 8px; + margin: 16px 0; +} +.explorer-card h3 { + color: var(--gold); + margin: 0 0 12px; + font-size: 16px; +} +#lesson-guide { + padding: 10px 14px; +} +#lesson-guide ol { + margin: 0 0 10px; +} +.threat { + padding: 0; +} +.threat-card { + width: 100%; + min-height: 48px; + background: transparent; + border: 0; + padding: 10px; + text-align: left; +} +.inspect-symbol { + color: var(--gold); +} +#inspection .track { + margin-top: 24px; +} +#inspection p { + margin: 14px 0; +} +@media (max-width: 760px) { + .threat-portrait { + height: 180px; + } + #threats { + grid-template-columns: minmax(0, 1fr); + } + .system-detail-art { + width: 140px; + height: 115px; + } +} +@media (max-width: 760px) { + header { + padding: 10px 12px; + } + .console-nav { + padding: 4px 8px; + gap: 0; + flex-wrap: nowrap; + } + .console-nav button { + flex: 1; + min-width: 0; + flex-direction: column; + gap: 3px; + padding: 6px 3px; + font-size: 10px; + } + .console-dialog { + max-width: calc(100% - 16px); + max-height: calc(100% - 16px); + max-height: calc(100dvh - 16px); + border-radius: 10px; + } + .dialog-header { + padding: 8px 12px; + } + .dialog-body { + padding: 14px; + } + #new-session { + grid-template-columns: minmax(0, 1fr); + gap: 18px; + } + #lesson-list { + grid-template-columns: minmax(0, 1fr); + gap: 8px; + } + #lesson-list button { + min-height: 64px; + } + .choice-list { + grid-template-columns: minmax(0, 1fr); + } + .crew-tabs { + grid-template-columns: repeat(auto-fit, minmax(56px, 1fr)); + } + .crew-tabs button { + font-size: 11px; + } + .header-tools .choice-trigger { + max-width: 110px; + font-size: 10px; + padding: 5px 7px; + } + .brand small { + display: none; + } +} +/* Equipment drawings use broad silhouettes and a shared, high-contrast palette. */ +.equipment-art { + display: block; + width: 100%; + height: 100%; + object-fit: contain; + border-radius: 6px; + pointer-events: none; +} +.card-art { + display: inline-block; + width: 30px; + height: 30px; + flex-shrink: 0; +} +.slot .card-art { + width: 27px; + height: 27px; +} +.equipment-symbol { + display: flex; + align-items: center; + justify-content: center; + color: #b8f4ff; + background: radial-gradient(ellipse, #21536b, #0b1722 70%); +} +.equipment-symbol .pictogram { + width: 42px; + height: 42px; +} +.action-key { + display: inline-flex; + align-items: center; + justify-content: center; + flex-shrink: 0; + width: 23px; + height: 23px; + border-radius: 5px; + background: #ffda83; + border: 1px solid #ffeba5; + color: #172332; + font-size: 14px; + font-weight: 800; +} +/* Fixed six-room cutaway. Only the document scrolls, including over controls. */ +.cutaway { + position: relative; + container-type: inline-size; + padding: 0 9px; + border-inline: 5px solid #526c79; + border-radius: 40% 40% 18px 18px / 24px 24px 18px 18px; + background: #172c39; + box-shadow: inset 0 0 0 2px #263f4d; +} +.ship-bow { + margin: 0 -9px; + height: 40px; +} +.ship-bow svg { + width: 100%; + height: 100%; + stroke: #8296a0; + stroke-width: 2; + fill: none; +} +.ship-bow .hull-shell { + fill: #314e5c; +} +.ship-bow .bridge-window { + fill: #79ccd4; + stroke: #122b3b; +} +.ship-deck { + position: relative; + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 12px; +} +.station { + position: relative; + min-width: 0; + display: flex; + flex-direction: column; + padding: 7px 5px 5px; + border: 2px solid #5b7581; + border-top: 3px solid var(--zone); + border-radius: 9px 9px 5px 5px; + background: + linear-gradient( + 90deg, + transparent 49%, + #2c465240 49%, + #2c465240 51%, + transparent 51% + ), + #112330; +} +.station.selected-station { + background-color: #203744; +} +.station-title { + display: flex; + flex-wrap: wrap; + gap: 3px; + align-items: center; + min-height: 19px; + color: #eaf3f7; + font-size: 10px; + font-weight: 700; + text-transform: uppercase; +} +.station-title .pictogram { + width: 13px; + height: 13px; +} +.station-title .damage { + margin-left: auto; + color: #ffab8d; + font-size: 9px; +} +.station-title .damage .symbol-stat { + gap: 2px; +} +.illustrated-systems { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 2px; + margin: 4px 0; +} +.system-card { + min-width: 0; +} +.weapon-system { + grid-column: 1; + grid-row: 1; +} +.special-system { + grid-column: 2; + grid-row: 1; +} +.energy-system { + grid-column: 1 / -1; + grid-row: 2; +} +.deck-lower .weapon-system, +.deck-lower .special-system { + grid-row: 2; +} +.deck-lower .energy-system { + grid-row: 1; +} +.system-card button { + position: relative; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + width: 100%; + min-height: 78px; + gap: 0; + padding: 4px 0 2px; + color: #f1f8fc; + border: 1px solid transparent; + background: transparent; + border-radius: 8px; +} +.system-card button:hover, +.system-card button:focus-visible { + background: #355361; + border-color: #bfdee2; +} +.system-card .action-key { + position: absolute; + top: 1px; + left: 0; + width: 18px; + height: 18px; + font-size: 11px; + z-index: 1; +} +.system-card .equipment-art { + width: 56px; + height: 56px; + max-width: 100%; +} +.system-caption { + display: flex; + justify-content: center; + align-items: center; + gap: 3px; + font-size: 10px; +} +.system-caption strong { + font-size: 10px; + font-weight: 500; +} +.weapon-system .system-caption strong, +.special-system .system-caption { + display: none; +} +.power-value { + color: #ffe0a3; + font-size: 15px; + font-weight: 700; +} +.power-value .symbol-stat { + gap: 3px; +} +.power-value .pictogram { + width: 14px; + height: 14px; +} +.energy-system button { + min-height: 55px; + display: grid; + grid-template-columns: 48px minmax(0, 1fr); + gap: 3px; + padding: 2px 5px; + border-block: 1px solid #466979; + background: #1a3645; +} +.energy-system .equipment-art { + width: 44px; + height: 44px; +} +.energy-system .system-caption { + display: flex; + flex-direction: column; + gap: 3px; +} +.energy-system .system-caption strong { + display: none; +} +.energy-system .action-key { + top: 2px; + left: 1px; +} +.energy-value { + color: #b8f6f6; + font-size: 18px; + font-weight: 750; + font-variant-numeric: tabular-nums; +} +.charge-pips { + display: flex; + width: 100%; + max-width: 90px; + gap: 3px; +} +.charge-pips i { + height: 5px; + flex: 1; + min-width: 0; + background: #112330; + border: 1px solid #7696a4; + border-radius: 2px; +} +.charge-pips i.filled { + background: #96ebed; + border-color: #d6ffff; +} +.energy-system.depleted button { + border-color: #c99871; +} +.energy-system.depleted .energy-value { + color: #ffc39c; +} +.occupants { + display: flex; + flex-wrap: wrap; + gap: 4px; + align-items: end; + justify-content: center; + min-height: 30px; + margin-top: auto; + padding-top: 2px; +} +.crew-pawn { + position: relative; + display: inline-flex; + width: 23px; + height: 29px; + color: #bfd0db; +} +.crew-pawn > svg { + width: 100%; + height: 100%; + fill: currentColor; + stroke: #0a2231; + stroke-width: 1.5; +} +.crew-pawn .visor { + fill: #2a5969; +} +.crew-pawn b { + position: absolute; + bottom: 3px; + width: 100%; + color: #0d2330; + text-align: center; + font-size: 11px; +} +.crew-pawn.selected { + color: #ffe0a0; + filter: drop-shadow(0 0 2px #e8c98460); +} +.crew-pawn.out { + opacity: 0.55; +} +.crew-pawn.out b { + text-decoration: line-through; +} +.crew-pawn i { + position: absolute; + right: -5px; + top: 0; + color: #98eef1; + background: #112330; + border-radius: 3px; +} +.crew-pawn i .pictogram { + width: 12px; + height: 12px; +} +.ship-passage { + position: absolute; + top: 48%; + z-index: 2; + transform: translate(-50%, -50%); +} +.passage-1 { + left: calc(33.333% - 2px); +} +.passage-2 { + left: calc(66.667% + 2px); +} +.ship-passage button { + display: flex; + align-items: center; + justify-content: center; + width: 26px; + min-height: 44px; + padding: 0; + border: 2px solid #8499a3; + border-block-color: #203947; + background: #294652; + border-radius: 3px; +} +.ship-passage .pictogram { + width: 20px; + height: 20px; +} +.between-decks { + position: relative; + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + height: 44px; +} +.energy-conduits { + position: absolute; + inset: 0; + width: 100%; + height: 100%; + fill: none; + stroke: #e7bf75; + stroke-width: 2; + pointer-events: none; +} +.energy-conduits .conduit-back { + stroke: #071927; + stroke-width: 8; +} +.lift-bay { + display: flex; + align-items: center; + justify-content: end; + padding-right: 10%; +} +.lift-control { + display: flex; + align-items: center; + justify-content: center; + width: 36px; + min-height: 40px; + padding: 0; + background: #213e4e; + border: 2px solid #8499a3; + border-radius: 5px; + z-index: 1; +} +.lift-control .pictogram { + width: 22px; + height: 22px; +} +.lift-control.damaged-lift { + color: #ffb895; + border-color: #e5a984; +} +.passage-explanation { + display: flex; + justify-content: center; + margin: 16px; + color: #9ce7ec; +} +.passage-explanation .pictogram { + width: 65px; + height: 65px; +} +.ship-stern { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 12px; + padding: 0 10px; +} +.ship-stern > span { + display: flex; + gap: 5px; + justify-content: center; + width: 65%; + margin: auto; + padding: 6px 10px 9px; + border: 2px solid #81939a; + border-top: 0; + border-radius: 0 0 12px 12px; + background: #29424e; +} +.ship-stern i { + width: 12px; + height: 14px; + background: #95dfe7; + border-radius: 0 0 6px 6px; + box-shadow: 0 3px 7px #82eff04a; +} +.ship-key { + display: flex; + gap: 12px; + justify-content: center; + flex-wrap: wrap; + font-size: 10px; + color: #c9dbe5; + padding: 10px 0; +} +.ship-key > span { + display: inline-flex; + gap: 4px; + align-items: center; +} +.ship-key b { + color: #ffdfa1; + font-size: 12px; +} +@container (max-width: 400px) { + .station { + padding: 5px 2px 3px; + } + .ship-deck { + gap: 10px; + } + .system-card button { + min-height: 67px; + } + .system-card .equipment-art { + width: 44px; + height: 44px; + } + .energy-system button { + grid-template-columns: 36px minmax(0, 1fr); + gap: 1px; + min-height: 47px; + padding: 2px 3px; + } + .energy-system .equipment-art { + width: 35px; + height: 40px; + } + .energy-value { + font-size: 15px; + } + .system-card .action-key { + width: 15px; + height: 15px; + font-size: 10px; + } + .station-title { + font-size: 9px; + gap: 1px; + } + .station-title .damage .pictogram { + display: none; + } + .crew-pawn { + width: 19px; + height: 25px; + } + .crew-pawn b { + font-size: 10px; + } + .occupants { + gap: 1px; + min-height: 27px; + } + .ship-passage button { + width: 22px; + } + .ship-passage .pictogram { + width: 16px; + } + .lift-bay { + padding-right: 4%; + } + .lift-control { + width: 31px; + } + .ship-stern > span { + width: 75%; + padding: 5px 5px 6px; + } + .ship-stern i { + height: 10px; + } +} +/* Compact fallback for browsers without container queries. */ +@supports not (container-type: inline-size) { + @media (max-width: 760px) { + .station { + padding: 5px 2px 3px; + } + .ship-deck { + gap: 10px; + } + .system-card button { + min-height: 67px; + } + .system-card .equipment-art { + width: 44px; + height: 44px; + } + .energy-system button { + grid-template-columns: 36px minmax(0, 1fr); + gap: 1px; + min-height: 47px; + padding: 2px 3px; + } + .energy-system .equipment-art { + width: 35px; + height: 40px; + } + .energy-value { + font-size: 15px; + } + .system-card .action-key { + width: 15px; + height: 15px; + font-size: 10px; + } + .station-title { + font-size: 9px; + gap: 1px; + } + .station-title .damage .pictogram { + display: none; + } + .crew-pawn { + width: 19px; + height: 25px; + } + .crew-pawn b { + font-size: 10px; + } + .occupants { + gap: 1px; + min-height: 27px; + } + .ship-passage button { + width: 22px; + } + .ship-passage .pictogram { + width: 16px; + } + .lift-bay { + padding-right: 4%; + } + .lift-control { + width: 31px; + } + .ship-stern > span { + width: 75%; + padding: 5px 5px 6px; + } + .ship-stern i { + height: 10px; + } + } +} +@media (max-width: 760px) { + .cutaway { + margin-inline: -9px; + padding-inline: 6px; + border-inline-width: 3px; + } + .ship-bow { + height: 30px; + margin-inline: -6px; + } +} +/* Shared equipment inspector and threat cards. */ +.system-detail-art { + width: 180px; + height: 150px; + margin: 0 auto; +} +.system-detail-art .equipment-symbol { + width: 100%; + height: 100%; +} +.room-location { + text-align: center; + color: var(--gold); +} +.energy-flow { + display: grid; + grid-template-columns: 1fr 30px 1fr; + gap: 18px; + align-items: center; + margin: 8px auto 20px; + max-width: 460px; +} +.energy-flow > span { + display: grid; + justify-items: center; + gap: 5px; + text-align: center; +} +.energy-flow .equipment-art, +.energy-flow .equipment-symbol { + width: 80px; + height: 70px; +} +.energy-flow b { + font-size: 24px; + color: #e7fcff; +} +.energy-flow small { + color: var(--muted); +} +.energy-flow + p { + color: #eef6f9; +} +#inspection .planning-note { + color: var(--muted); + padding: 12px; + background: #0b1d29; + border-left: 2px solid #6794ae; +} +.weapon-facts { + display: flex; + justify-content: center; + gap: 25px; + font-size: 22px; + color: var(--gold); +} +#threats { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); + gap: 12px; +} +.illustrated-threat { + min-width: 0; + margin: 0; + overflow: clip; + background: #0b1722; + border-color: #4c697c; +} +.illustrated-threat .threat-card { + display: block; + padding: 0; + color: #eff7fa; +} +.threat-heading { + display: flex; + justify-content: space-between; + align-items: center; + gap: 12px; + padding: 11px 12px; + font-size: 16px; +} +.threat-portrait { + display: block; + position: relative; + height: 180px; + background: #10212d; + overflow: hidden; +} +.threat-portrait > .equipment-art { + width: 128px; + height: 118px; + margin: 24px auto 0; + border-radius: 0; +} +.threat-timing { + color: #d6e5ef; + font-size: 12px; + font-weight: 600; + font-variant-numeric: tabular-nums; + white-space: nowrap; +} +.threat-target { + display: flex; + justify-content: center; + align-items: end; + width: 56px; + min-height: 48px; + flex-shrink: 0; +} +.threat-target .ship-locator { + width: 56px; +} +.threat-hud { + position: absolute; + bottom: 8px; + left: 10px; + right: 10px; + display: flex; + align-items: end; + justify-content: space-between; + gap: 8px; +} +.hull-gauge, +.shield-badge { + padding: 6px 9px; + background: #081723eb; + border: 1px solid #607580; + border-radius: 7px; + color: #f2ffd9; +} +.hull-gauge { + min-width: 84px; +} +.hull-gauge .symbol-stat, +.shield-badge .symbol-stat { + gap: 7px; +} +.hull-gauge b, +.shield-badge b { + font-size: 24px; + line-height: 1; +} +.hull-gauge small { + font-size: 13px; + color: #c4d3dd; +} +.hull-bar { + display: block; + margin-top: 5px; + height: 5px; + background: #344034; + border-radius: 4px; + overflow: hidden; +} +.hull-bar i { + display: block; + height: 100%; + background: #b4eb6d; +} +.shield-badge { + color: #9eeaff; + border-color: #4988a0; +} +.threat-hud .pictogram { + width: 25px; + height: 25px; +} +.threat-footer { + display: flex; + align-items: center; + justify-content: space-between; + gap: 10px; + padding: 7px 12px; + color: var(--muted); + font-size: 12px; +} +.threat-footer .pictogram { + width: 23px; + height: 23px; +} +.threat-footer .symbol-stat { + color: #e5f2fc; + font-size: 15px; +} +.resolved-threat > .equipment-art { + filter: saturate(0.3); + opacity: 0.55; +} +.threat-outcome { + position: absolute; + top: 38%; + left: 0; + right: 0; + padding: 8px; + background: #081723db; + color: #ffe29b; + text-align: center; + font-weight: 700; +} +.approach-track { + display: flex; + gap: 7px; + align-items: center; + padding: 10px; + border-top: 1px solid #344d60; +} +.approach-track > .pictogram { + width: 22px; + height: 22px; + color: var(--gold); +} +.track-caption { + font-size: 10px; + color: var(--muted); +} +.approach-track .track { + margin: 0; + flex: 1; + min-width: 0; + gap: 2px; +} +.approach-track .track span { + height: 20px; + line-height: 19px; + font-size: 11px; + color: #d4e5f0; + border-radius: 2px; +} +.approach-track .track .mark { + border-bottom: 2px solid #ffaf83; +} +.approach-track .track .current { + background: #ffe19a; + color: #13202c; + outline: 1px solid #fff5d8; +} +.approach-track .track .entry { + outline: 1px dashed #ffe19a; +} +#inspection .threat-portrait { + height: 220px; + max-width: 440px; + margin: 0 auto; + border-radius: 9px; +} +#inspection .threat-portrait > .equipment-art { + width: 164px; + height: 150px; + margin-top: 28px; +} +#inspection .threat-facts { + margin-top: 15px; +} +.console-nav svg { + width: 23px; + height: 23px; + stroke-width: 1.9; +} +.console-nav button { + color: #dcebf4; +} +.slot.future { + opacity: 0.7; +} +@media (max-width: 760px) { + .threat-portrait { + height: 180px; + } + #threats { + grid-template-columns: minmax(0, 1fr); + } + .system-detail-art { + width: 140px; + height: 115px; + } +} diff --git a/preview/tactical.js b/preview/tactical.js new file mode 100644 index 0000000..91ab0d9 --- /dev/null +++ b/preview/tactical.js @@ -0,0 +1,180 @@ +import { illustration, threatIllustration } from "./art.js"; +import { pictogram, shipLocator } from "./icons.js"; + +export function createTacticalView({ t, esc, symbol, zoneName }) { + const meter = (value, capacity) => + ``; + + function stationControls({ + station, + zone, + deck, + ship, + power, + capacity, + system, + cIcon, + c, + canPlan, + }) { + 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 charge = + system === "shield" + ? t("Charger le bouclier", "Charge the shield") + : t("Recharger le réacteur", "Refill the reactor"); + const centralRefuel = station === "white-lower"; + const sourceValue = centralRefuel + ? ship.fuel + : system === "shield" + ? s.reactor + : ship.zones.white.reactor; + const sourceName = centralRefuel + ? t("Combustible", "Fuel") + : `${t("Réacteur", "Reactor")} ${zoneName(system === "shield" ? zone : "white")}`; + const sourceIcon = centralRefuel ? "fuel" : "reactor"; + const weapon = pulse + ? t("Canon à impulsion", "Pulse cannon") + : light + ? t("Laser léger", "Light laser") + : t("Laser lourd", "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.", + ); + 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.", + ) + : 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.", + ); + 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 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 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 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-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.", + ), + }[station]; + const flow = `
      ${illustration(sourceIcon)}${sourceValue}${esc(sourceName)}${pictogram("right")}${illustration(system)}${s[system]}/${capacity}${esc(energyName)}
      `; + 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)}
      +
      `; + } + + function shipCutaway({ ship, selectedCrew, canPlan, crewLabel }) { + const zones = ["red", "white", "blue"]; + const movementHelp = (lift) => + ``; + const deck = (level) => + `
      ${zones + .map((zone) => { + const station = `${zone}-${level}`, + s = ship.zones[zone]; + const system = level === "upper" ? "shield" : "reactor"; + const capacity = + (system === "shield" + ? zone === "white" + ? 3 + : 2 + : zone === "white" + ? 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", "Battlebots")], + "red-lower": ["bots", t("Robots", "Battlebots")], + "white-lower": [ + "observation", + t("Observation", "Visual confirmation"), + ], + "blue-lower": ["rocket", t("Roquette", "Rocket")], + }[station]; + const pulse = station === "white-lower"; + const power = + (level === "upper" ? (zone === "white" ? 5 : 4) : pulse ? 1 : 2) - + Number(s.damage.includes(`${level}-weapon`) && !pulse); + const occupants = ship.crew.filter( + (p) => p.station === station && !p.space, + ); + const deckName = + level === "upper" + ? t("Pont supérieur", "Upper deck") + : t("Pont inférieur", "Lower deck"); + return `
      ${esc(zoneName(zone))}${symbol(level === "upper" ? "up" : "down", deckName)}${level === "upper" && s.damage.length ? `${symbol("warning", `${t("Dégâts de la zone", "Zone damage")} : ${s.damage.length}/6`, `${s.damage.length}/6`)}` : ""}
      ${stationControls({ station, zone, deck: level, ship, power, capacity, system, cIcon, c, canPlan })}
      ${occupants.map((p) => `${p.id + 1}${p.bots !== null ? `${pictogram("bots")}` : ""}`).join("")}
      `; + }) + .join( + "", + )}${[1, 2].map((i) => `
      ${movementHelp(false)}
      `).join("")}
      `; + return `${deck("upper")}
      ${zones.map((z) => `
      ${movementHelp(true)}
      `).join("")}
      ${deck("lower")}
      A${t("Tirer", "Fire")}B${t("Énergie", "Energy")}C${t("Systèmes", "Systems")}
      `; + } + + function threatPortrait(th) { + const hp = Math.max(0, th.hp - (th.damage ?? 0)); + const gone = ["destroyed", "survived", "discarded"].includes(th.status); + const status = + th.status === "destroyed" + ? t("Détruite", "Destroyed") + : th.status === "survived" + ? t("Échappée", "Escaped") + : th.status === "discarded" + ? t("Écartée", "Discarded") + : null; + const visual = threatIllustration(th); + const internal = th.position === "internal"; + const stations = internal + ? (th.stations ?? []) + : [`${th.zone}-upper`, `${th.zone}-lower`]; + const targetName = internal + ? `${t("Salles touchées", "Affected rooms")} : ${stations + .map((s) => { + const [z, d] = s.split("-"); + return `${zoneName(z)} ${d === "upper" ? "↑" : "↓"}`; + }) + .join(", ")}` + : `${t("Trajectoire", "Trajectory")} : ${zoneName(th.zone)}`; + const target = `${shipLocator(stations, internal ? null : th.zone)}`; + return `${visual}${symbol("hull", `${t("Points de vie", "Hit points")} : ${hp}/${th.hp}`, `${hp}/${th.hp}`)}${target}${symbol("shield", `${t("Bouclier", "Shield")} : ${th.shield}`, `${th.shield}`)}${status ? `${esc(status)}` : ""}`; + } + return { shipCutaway, threatPortrait }; +} diff --git a/preview/text.js b/preview/text.js index 2feec1d..96e1fdc 100644 --- a/preview/text.js +++ b/preview/text.js @@ -1,4 +1,12 @@ const choose = (pair, locale) => pair?.[locale === "fr" ? 0 : 1]; +const zoneLabels = { + red: ["Gauche", "Left"], + white: ["Centre", "Center"], + blue: ["Droite", "Right"], +}; +export function zoneLabel(zone, locale) { + return choose(zoneLabels[zone], locale) ?? zone; +} const specials = { rocketeer: [ [ @@ -7,7 +15,7 @@ const specials = { ], [ "En bas à droite : lance deux roquettes en un tir de force 5. Ailleurs : effectue C.", - "Lower blue: launch two rockets as a strength-5 shot. Elsewhere: perform C.", + "Lower right: launch two rockets as a strength-5 shot. Elsewhere: perform C.", ], ], "data-analyst": [ @@ -67,7 +75,7 @@ const specials = { ], [ "En bas au centre, au tour 10 ou 11 : termine ce tour puis passe au dernier tour sans actions d’équipage.", - "Lower white on turn 10 or 11: finish this turn, then skip to the final turn without crew actions.", + "Lower center on turn 10 or 11: finish this turn, then skip to the final turn without crew actions.", ], ], "special-ops": [ @@ -87,7 +95,7 @@ const specials = { ], [ "Avec des robots actifs, sauf en bas à droite : rejoint les intercepteurs et décolle. Déjà en vol : attaque héroïque.", - "With active battlebots, except in lower blue: reach the interceptors and launch. Already in space: heroic attack.", + "With active battlebots, except in lower right: reach the interceptors and launch. Already in space: heroic attack.", ], ], mechanic: [ @@ -162,7 +170,7 @@ const traits = { ], deathKnockout: [ "Réparation terminée : assomme les équipiers en bas dans les zones latérales.", - "Final repair knocks out crew in lower red and lower blue.", + "Final repair knocks out crew in lower left and lower right.", ], deathKnocksAttacker: [ "Détruite : assomme son attaquant et désactive ses robots, même avec une attaque héroïque.", @@ -219,16 +227,16 @@ Object.assign(traits, { "The final repair consumes 1 local reactor energy; it cannot finish with an empty reactor.", ], parityStation: [ - "Station initiale : rouge supérieur sur un numéro impair, bleu supérieur sur un numéro pair.", - "Starts in upper red on an odd threat number, upper blue on an even number.", + "Station initiale : haut à gauche sur un numéro impair, haut à droite sur un numéro pair.", + "Starts in upper left on an odd threat number, upper right on an even number.", ], shortCircuit: [ "Bloque l’impulsion. Chaque tir du laser lourd central provoque une attaque 1 sur chaque zone.", "Blocks pulse. Every central heavy-laser shot triggers an attack 1 on every zone.", ], poison: [ - "Dès son apparition, le Ninja empoisonne les mouvements commençant ou finissant en bleu supérieur ou blanc inférieur. Après sa destruction, seuls les déjà empoisonnés restent menacés jusqu’à Z.", - "From appearance, Ninja poisons movements starting or ending in upper blue or lower white. After destruction, only already-poisoned crew remain threatened until Z.", + "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.", + "From appearance, Ninja poisons movements starting or ending in upper right or lower center. After destruction, only already-poisoned crew remain threatened until Z.", ], infection: [ "Les infections déjà transmises restent actives jusqu’à Z, même après sa destruction.", @@ -243,8 +251,8 @@ Object.assign(traits, { "At Z, a surprise common internal threat resolves all its actions.", ], teleportsOnHit: [ - "Après un dégât, se téléporte en rouge supérieur.", - "After taking damage, teleports to upper red.", + "Après un dégât, se téléporte en haut à gauche.", + "After taking damage, teleports to upper left.", ], gremlin: [ "Si non détruit avant le saut, assomme tout l’équipage. Les systèmes sabotés se réparent séparément.", @@ -326,9 +334,9 @@ export function traitDescriptions(th, locale) { return result; } const dictionary = { - red: ["rouge", "red"], - white: ["blanc", "white"], - blue: ["bleu", "blue"], + red: ["gauche", "left"], + white: ["centre", "center"], + blue: ["droite", "right"], shield: ["bouclier", "shield"], reactor: ["réacteur", "reactor"], speed: ["vitesse", "speed"], @@ -372,8 +380,8 @@ const dictionary = { "+1 shield to all external threats until destroyed", ], "double-red": [ - "double les dégâts à la zone rouge", - "double damage to red zone", + "double les dégâts à la zone de gauche", + "double damage to left zone", ], "double-all": [ "double les dégâts à toutes les zones", @@ -422,16 +430,16 @@ Object.assign(dictionary, { "subsequent attacks ignore shields", ], "poison-entry": [ - "empoisonne ceux qui commencent ou terminent un déplacement en bleu supérieur ou blanc inférieur", - "poisons crew starting or ending a movement in upper blue or lower white", + "empoisonne ceux qui commencent ou terminent un déplacement en haut à droite ou bas au centre", + "poisons crew starting or ending a movement in upper right or lower center", ], "sealed-red": [ - "portes vers la zone rouge scellées", - "doors to red zone sealed", + "portes vers la zone de gauche scellées", + "doors to left zone sealed", ], "sealed-blue": [ - "portes vers la zone bleue scellées", - "doors to blue zone sealed", + "portes vers la zone de droite scellées", + "doors to right zone sealed", ], "sealed-door": ["porte scellée", "sealed door"], "cyber-gremlin": [ @@ -442,12 +450,12 @@ Object.assign(dictionary, { function word(x, locale) { return choose(dictionary[x], locale) ?? String(x ?? ""); } -function station(x, locale) { +export function stationLabel(x, locale) { if (x && typeof x === "object" && x.zone && x.deck) x = `${x.zone}-${x.deck}`; if (typeof x !== "string" || !/^(red|white|blue)-(upper|lower)$/.test(x)) return ""; const [z, d] = x.split("-"); - return `${word(z, locale)} ${d === "upper" ? "↑" : "↓"}`; + return `${zoneLabel(z, locale)} ${d === "upper" ? "↑" : "↓"}`; } export function effectDescription(e, locale) { const t = (fr, en) => (locale === "fr" ? fr : en), @@ -502,7 +510,7 @@ export function effectDescription(e, locale) { case "disable-stored-bots": text = t( "Désactive les robots en réserve en bas à gauche.", - "Disable stored battlebots in lower red.", + "Disable stored battlebots in lower left.", ); break; case "fuel-lost": @@ -597,8 +605,8 @@ export function effectDescription(e, locale) { break; case "drill-move": text = t( - "Avance d’une station vers la zone la plus endommagée ; égalité : vers le blanc.", - "Move one station toward the most damaged zone; ties: toward white.", + "Avance d’une station vers la zone la plus endommagée ; égalité : vers le centre.", + "Move one station toward the most damaged zone; ties: toward the center.", ); break; case "shambler": @@ -609,8 +617,8 @@ export function effectDescription(e, locale) { break; case "blind": text = t( - `Obstrue la visée ${e.zone === "lateral" ? "d’une zone latérale" : "du blanc"}. Observation ou intercepteurs requis pour y tirer au laser.`, - `Obscure ${e.zone === "lateral" ? "a side zone" : "white"} targeting. Visual confirmation or interceptors are required for laser fire there.`, + `Obstrue la visée ${e.zone === "lateral" ? "d’une zone latérale" : "du centre"}. Observation ou intercepteurs requis pour y tirer au laser.`, + `Obscure ${e.zone === "lateral" ? "a side zone" : "center"} targeting. Visual confirmation or interceptors are required for laser fire there.`, ); break; case "mine": @@ -639,8 +647,8 @@ export function effectDescription(e, locale) { break; case "poison-detonate": text = t( - "Assomme les empoisonnés. Si le Ninja vit encore : chaque roquette restante provoque une attaque 2 en rouge, puis est détruite.", - "Knock out poisoned crew. If Ninja is still alive, each remaining rocket causes an attack 2 on red, then is destroyed.", + "Assomme les empoisonnés. Si le Ninja vit encore : chaque roquette restante provoque une attaque 2 à gauche, puis est détruite.", + "Knock out poisoned crew. If Ninja is still alive, each remaining rocket causes an attack 2 on the left, then is destroyed.", ); break; case "repeat-action": @@ -651,8 +659,8 @@ export function effectDescription(e, locale) { break; case "swap-zones": text = t( - "Les équipiers en zones latérales échangent rouge / bleu, sans changer de pont.", - "Crew in side zones swap red / blue without changing deck.", + "Les équipiers en zones latérales échangent gauche / droite, sans changer de pont.", + "Crew in side zones swap left / right without changing deck.", ); break; case "vortex-draw": @@ -687,8 +695,8 @@ export function effectDescription(e, locale) { break; case "parasite-attack": text = t( - "5 dégâts directs dans la zone de l’hôte ; hôte en vol : attaque 5 en blanc.", - "5 direct damage to the host’s zone; host in space: attack 5 on white.", + "5 dégâts directs dans la zone de l’hôte ; hôte en vol : attaque 5 au centre.", + "5 direct damage to the host’s zone; host in space: attack 5 in the center.", ); break; default: @@ -742,20 +750,20 @@ export function eventDescription(e, locale, threats) { ), "cryoshield-broken": t("Cryobouclier détruit", "Cryoshield broken"), move: t( - `${station(e.from, locale)} → ${station(e.to, locale)}`, - `${station(e.from, locale)} → ${station(e.to, locale)}`, + `${stationLabel(e.from, locale)} → ${stationLabel(e.to, locale)}`, + `${stationLabel(e.from, locale)} → ${stationLabel(e.to, locale)}`, ), teleport: t( - `Téléportation → ${station(e.to, locale)}`, - `Teleport → ${station(e.to, locale)}`, + `Téléportation → ${stationLabel(e.to, locale)}`, + `Teleport → ${stationLabel(e.to, locale)}`, ), fire: t( - `Tir ${station(e.station, locale)}, force ${e.strength}, portée ${e.range}`, - `Fire ${station(e.station, locale)}, strength ${e.strength}, range ${e.range}`, + `Tir ${stationLabel(e.station, locale)}, force ${e.strength}, portée ${e.range}`, + `Fire ${stationLabel(e.station, locale)}, strength ${e.strength}, range ${e.range}`, ), energy: t( - `Transfert de ${e.amount} énergie · ${station(e.station, locale)} · ${w(e.system)}`, - `Transfer ${e.amount} energy · ${station(e.station, locale)} · ${w(e.system)}`, + `Transfert de ${e.amount} énergie · ${stationLabel(e.station, locale)} · ${w(e.system)}`, + `Transfer ${e.amount} energy · ${stationLabel(e.station, locale)} · ${w(e.system)}`, ), computer: t( `Ordinateur entretenu · phase ${e.phase}`, diff --git a/src/tutorials.js b/src/tutorials.js index 6b0e627..af6fc06 100644 --- a/src/tutorials.js +++ b/src/tutorials.js @@ -33,8 +33,8 @@ export const LESSONS = [ ["Énergie et coordination", "Energy and coordination"], [ [ - "Le réacteur blanc 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.", - "White starts with 3 reactor energy. Heavy laser and pulse share it; B upstairs fills the shield, not the reactor.", + "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.", ], [ "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.", @@ -51,12 +51,12 @@ export const LESSONS = [ ["Réparer une panne", "Repairing a malfunction"], [ [ - "La panne apparaît en bleu supérieur 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 blue on turn 2. It overrides the indicated button: that button repairs instead of using the system.", + "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.", ], [ - "Androïde 1 : flèche bleue 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: blue arrow on turn 1, then B on turns 2, 3 and 4. Inspect the threat card for hit points and X/Y/Z effects.", + "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é.", @@ -70,12 +70,12 @@ export const LESSONS = [ ["Robots et intercepteurs", "Battlebots and interceptors"], [ [ - "Les robots attendent en bleu supérieur et rouge inférieur. C prend une escouade ; le symbole robot est une action distincte qui combat les intrus.", - "Battlebots wait in upper blue and lower red. C picks up a squad; the battlebot symbol is a separate action for fighting intruders.", + "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.", ], [ - "Androïde 1 : flèche bleue, C, flèche rouge aux tours 1–3. En phase 2 : flèche rouge puis C pour décoller depuis le rouge supérieur avec vos robots.", - "Android 1: blue arrow, C, red arrow on turns 1–3. In phase 2: red arrow, then C to launch from upper red with your battlebots.", + "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.", @@ -92,8 +92,8 @@ export const LESSONS = [ "This deck has double-action cards. Choose a half normally: its two symbols execute left to right.", ], [ - "Comparez flèche bleue + A avec A + flèche bleue au tour 2 : le laser utilisé change. Vous ne pouvez pas volontairement ignorer une moitié réalisable.", - "Compare blue arrow + A with A + blue arrow on turn 2: they fire different lasers. You cannot voluntarily skip a performable half.", + "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.",