From a72f1bbe031969e7806da6838c0e7d792a201ea9 Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Mon, 19 Oct 2026 09:34:40 -0400 Subject: [PATCH] feat(call-for-fire-versus): resize fleet, add second FOB, charred destroyed cells with burn effect Command Post becomes a 3x2 rect that flips wide/tall, the Ammo Depot L grows to four cells, the FOB becomes two cells, and a second FOB (Forward Operating Base II) joins the fleet for 16 cells across five structures. Fully destroyed structures now render charred black instead of red, and their cells burn with flame and ember particles for 45 seconds after destruction, driven by a new impact timestamp on each shot. --- src/app/(frontend)/styles.css | 109 +++++++++++++ .../call-for-fire-versus/VersusMatch.tsx | 94 +++++++++-- .../call-for-fire-versus/constants.ts | 30 +++- .../minigames/call-for-fire-versus/engine.ts | 50 ++++-- .../minigames/call-for-fire-versus/types.ts | 4 + .../minigames/call-for-fire-versus/views.ts | 7 +- .../call-for-fire-versus-registry.int.spec.ts | 14 +- tests/int/call-for-fire-versus.int.spec.ts | 148 ++++++++++++++---- 8 files changed, 385 insertions(+), 71 deletions(-) diff --git a/src/app/(frontend)/styles.css b/src/app/(frontend)/styles.css index 20602293..0ab813be 100644 --- a/src/app/(frontend)/styles.css +++ b/src/app/(frontend)/styles.css @@ -2101,6 +2101,115 @@ } } +/* Burning wreckage on destroyed Call-for-Fire-versus cells (~45s per cell). */ +.versus-burn { + position: absolute; + inset: 0; + z-index: 1; + overflow: hidden; + border-radius: inherit; + pointer-events: none; +} + +.versus-burn::before, +.versus-burn::after { + content: ""; + position: absolute; + left: 50%; + bottom: -8%; + width: 72%; + height: 88%; + transform-origin: 50% 100%; + background: radial-gradient( + ellipse at 50% 100%, + rgba(251, 146, 60, 0.9) 0%, + rgba(239, 68, 68, 0.5) 45%, + rgba(127, 29, 29, 0) 75% + ); + animation: versus-flame 900ms ease-in-out infinite alternate; +} + +.versus-burn::after { + width: 42%; + height: 62%; + background: radial-gradient( + ellipse at 50% 100%, + rgba(254, 240, 138, 0.95) 0%, + rgba(251, 146, 60, 0.6) 55%, + rgba(251, 146, 60, 0) 85% + ); + animation-duration: 620ms; + animation-delay: -280ms; +} + +.versus-ember { + position: absolute; + bottom: 14%; + left: 50%; + width: 3px; + height: 3px; + border-radius: 9999px; + background: rgba(253, 186, 116, 0.95); + animation: versus-ember-rise 1.5s linear infinite; +} + +.versus-ember:nth-child(2) { + left: 30%; + animation-delay: 0.5s; +} + +.versus-ember:nth-child(3) { + left: 68%; + animation-delay: 1s; + background: rgba(252, 165, 165, 0.9); +} + +@keyframes versus-flame { + 0% { + transform: translateX(-50%) scale(0.85, 0.7); + opacity: 0.7; + } + 50% { + transform: translateX(-50%) scale(1.05, 1); + opacity: 1; + } + 100% { + transform: translateX(-50%) scale(0.9, 0.8); + opacity: 0.75; + } +} + +@keyframes versus-ember-rise { + 0% { + transform: translateY(0) scale(1); + opacity: 0; + } + 12% { + opacity: 1; + } + 100% { + transform: translateY(-14px) scale(0.3); + opacity: 0; + } +} + +@media (prefers-reduced-motion: reduce) { + .versus-burn::before, + .versus-burn::after, + .versus-ember { + animation: none; + } + .versus-burn::before { + opacity: 0.55; + } + .versus-burn::after { + display: none; + } + .versus-ember { + display: none; + } +} + .poker-action-console:not(.poker-action-console-complete) { grid-template-columns: minmax(0, 1.5fr) minmax(10rem, 0.8fr); } diff --git a/src/components/frontend/minigames/call-for-fire-versus/VersusMatch.tsx b/src/components/frontend/minigames/call-for-fire-versus/VersusMatch.tsx index 35a3f86f..db93e85f 100644 --- a/src/components/frontend/minigames/call-for-fire-versus/VersusMatch.tsx +++ b/src/components/frontend/minigames/call-for-fire-versus/VersusMatch.tsx @@ -14,6 +14,7 @@ import { import { gridDesignation, METERS_PER_CELL, type GridPoint } from "@/lib/minigames/call-for-fire"; import { FOB_FLEET, + VERSUS_BURN_MS, VERSUS_WAITING_USER_ID, type FobPlacement, type FobRotation, @@ -50,8 +51,16 @@ const FOB_STYLES: Record swatch: "bg-violet-400", ring: "border-violet-500/60", }, + "fob-2": { + cell: "border-emerald-500/70 bg-emerald-500/30 text-emerald-50", + swatch: "bg-emerald-400", + ring: "border-emerald-500/60", + }, }; +/** Charred look for a fully destroyed structure's cells. */ +const DESTROYED_CELL = "border-zinc-500/40 bg-zinc-950 text-zinc-600"; + function fobStyle(id: string) { return ( FOB_STYLES[id] ?? { @@ -66,13 +75,14 @@ function fobStyle(id: string) { function turnsForShape(shape: FobShape): number { if (shape === "square") return 1; if (shape === "l") return 4; - return 2; + return 2; // line and rect flip between two orientations } /** Toggle-button label for the selected emplacement's current orientation. */ function rotationLabel(shape: FobShape, orientation: FobRotation): string { if (shape === "square") return "Fixed"; if (shape === "l") return "Rotate 90°"; + if (shape === "rect") return orientation % 2 === 0 ? "Wide" : "Tall"; return orientation % 2 === 0 ? "Horizontal" : "Vertical"; } @@ -388,7 +398,7 @@ function PlacementPhase({ size="sm" className="h-auto" disabled={selectedIsSquare} - title={selectedIsSquare ? "The Command Post is a fixed 2x2 block." : undefined} + title={selectedIsSquare ? "This structure has a fixed orientation." : undefined} onClick={toggleOrientation} > {rotationLabel(selectedDefinition.shape, effectiveOrientation)} @@ -432,8 +442,8 @@ function PlacementPhase({
  • Click a placed structure to pick it up, then click a new cell to move it.
  • Double-click a placed structure, or press the rotate toggle, to rotate it in place. - The Command Post is a fixed 2x2 block and does not rotate; the Ammo Depot is an L and - turns through four orientations. + The Command Post is a 3x2 block that flips between wide and tall; the Ammo Depot is + a four-cell L and turns through four orientations.
  • The toggle also sets the orientation used for your next placement.
  • Structures cannot overlap, and your opponent never sees your layout.
  • @@ -513,6 +523,59 @@ function buildBoards(you: VersusMatchView["you"]) { return { myCells, incoming, myShots }; } +/** + * Cells still burning on each board. A structure burns for VERSUS_BURN_MS from + * the instant its destroying round landed; after that its cells stay charred. + */ +function burnSets( + you: VersusMatchView["you"], + now: number, +): { mine: Set; enemy: Set } { + const mine = new Set(); + const enemy = new Set(); + const freshKill = (shot: VersusShotView) => { + if (shot.outcome !== "destroyed" || !shot.assetId) return false; + const at = Date.parse(shot.at); + return Number.isFinite(at) && now - at < VERSUS_BURN_MS; + }; + // Own board: the defender knows their full layout, so every cell of a + // reduced structure burns. + for (const shot of you.incoming) { + if (!freshKill(shot)) continue; + const fob = you.fleet.find((candidate) => candidate.id === shot.assetId); + for (const cell of fob?.cells ?? []) mine.add(key(cell)); + } + // Enemy sector: the shooter only knows the cells they struck, which is + // exactly every cell of a structure they just destroyed. + for (const shot of you.shots) { + if (!freshKill(shot)) continue; + for (const other of you.shots) { + if (other.assetId === shot.assetId) enemy.add(key(other.grid)); + } + } + return { mine, enemy }; +} + +/** Asset ids whose structure has been fully destroyed (from my fire). */ +function destroyedAssetIds(shots: VersusMatchView["you"]["shots"]): Set { + const ids = new Set(); + for (const shot of shots) { + if (shot.outcome === "destroyed" && shot.assetId) ids.add(shot.assetId); + } + return ids; +} + +/** Flickering flame and ember particles over a freshly destroyed cell. */ +function BurnFlames() { + return ( +