diff --git a/preview/icons.js b/preview/icons.js index 5b4e541..a01d3e2 100644 --- a/preview/icons.js +++ b/preview/icons.js @@ -1,6 +1,7 @@ // Shared silhouettes keep the ship, cards and controls visually consistent. const paths = { impact: "m12 2 2 6 6-4-3 7 5 3-7 1 1 7-5-5-5 4 1-7-5-3 7-1 3-8Z", + escape: "M5 4H3v17h17v-2M9 15 21 3M12 3h9v9", wait: "M6 3h12M6 21h12M7 3v4l5 5-5 5v4m10-18v4l-5 5 5 5v4", clock: "M2 12a10 10 0 1 0 20 0 10 10 0 1 0-20 0Zm10-6v6l4 2", pause: "M7 4h3v16H7zM14 4h3v16h-3z", diff --git a/preview/style.css b/preview/style.css index 596e53d..e3126bd 100644 --- a/preview/style.css +++ b/preview/style.css @@ -1905,19 +1905,45 @@ input:not([type="checkbox"]):not([type="range"]) { } .resolved-threat > .equipment-art { filter: saturate(0.3); - opacity: 0.55; + opacity: 0.22; } .threat-outcome { + --outcome-color: #c2d2dd; position: absolute; - top: 38%; - left: 0; - right: 0; - padding: 8px; - background: #081723db; - color: #ffe29b; + top: 58%; + left: 50%; + transform: translate(-50%, -50%); + display: flex; + flex-direction: column; + align-items: center; + gap: 7px; + width: max-content; + max-width: calc(100% - 170px); + color: var(--outcome-color); text-align: center; + font-size: 14px; + line-height: 1.2; font-weight: 700; + text-shadow: 0 2px 5px #06111c, 0 0 12px #06111c; } +.outcome-symbol { + display: grid; + place-items: center; + width: 48px; + height: 48px; + border: 1px solid currentColor; + border-radius: 50%; + background: #0a1b27f2; + box-shadow: 0 0 0 5px #0b1b2780; +} +.outcome-symbol .pictogram { + width: 28px; + height: 28px; + stroke-width: 2; +} +.resolved-threat[data-outcome="destroyed"] .threat-outcome { --outcome-color: #80e7bd; } +.resolved-threat[data-outcome="impact"] .threat-outcome { --outcome-color: #ffac83; } +.resolved-threat[data-outcome="escaped"] .threat-outcome { --outcome-color: #efd295; } .approach-track { display: flex; gap: 7px; diff --git a/preview/tactical.js b/preview/tactical.js index 749b648..7aa912a 100644 --- a/preview/tactical.js +++ b/preview/tactical.js @@ -141,14 +141,16 @@ export function createTacticalView({ (effect) => effect.type === "attack" && ["hp", "double-hp", "triple-hp"].includes(effect.amount), ); - const status = + const outcome = th.status === "destroyed" - ? t("tactical.destroyed") + ? "destroyed" : th.status === "survived" - ? t(impacted ? "tactical.impact" : "tactical.escaped") + ? impacted ? "impact" : "escaped" : th.status === "discarded" - ? t("tactical.discarded") + ? "discarded" : null; + const status = outcome ? t(`tactical.${outcome}`) : null; + const outcomeIcon = { destroyed: "check", impact: "impact", escaped: "escape", discarded: "close" }[outcome]; const visual = threatIllustration(th); const internal = th.position === "internal"; const stations = internal @@ -163,7 +165,7 @@ export function createTacticalView({ .join(", ")}` : `${t("tactical.trajectory")} : ${zoneName(th.zone)}`; const target = `${shipLocator(stations, internal ? null : th.zone)}`; - return `${target}${visual}${symbol("hull", `${t("app.hit_points")} : ${hp}/${th.hp}`, `${hp}/${th.hp}`)}${symbol("shield", `${t("app.shield")} : ${th.shield}`, `${th.shield}`)}${status ? `${esc(status)}` : ""}`; + return `${target}${visual}${symbol("hull", `${t("app.hit_points")} : ${hp}/${th.hp}`, `${hp}/${th.hp}`)}${symbol("shield", `${t("app.shield")} : ${th.shield}`, `${th.shield}`)}${status ? `${pictogram(outcomeIcon)}${esc(status)}` : ""}`; } return { shipCutaway, threatPortrait }; } diff --git a/test/threat-track.test.js b/test/threat-track.test.js index 18f69c6..011cc24 100644 --- a/test/threat-track.test.js +++ b/test/threat-track.test.js @@ -93,6 +93,7 @@ test("a seven-turn mission includes the final threat movement, reports impact, a t: (key) => translate("en", key), esc: String, symbol: () => "", zoneName: String, }); const portrait = threatPortrait(r.threats[0]); - assert.match(portrait, /class="threat-outcome">ImpactImpact<\/span>/); assert.doesNotMatch(portrait, /Escaped/); });