Replace threat outcome banners with pictogram badges

This commit is contained in:
coyotte508 2026-10-31 23:51:52 +01:00
commit 32fcd7a8cb
4 changed files with 43 additions and 13 deletions

View file

@ -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",

View file

@ -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;

View file

@ -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 = `<span class="threat-target" style="--zone:var(--${["red", "white", "blue"].includes(th.zone) ? th.zone : "cyan"})" role="img" aria-label="${esc(targetName)}" title="${esc(targetName)}">${shipLocator(stations, internal ? null : th.zone)}</span>`;
return `<span class="threat-portrait ${pending ? "pending-threat" : ""} ${gone ? "resolved-threat" : ""}">${target}${visual}<span class="threat-hud"><span class="hull-gauge"><span>${symbol("hull", `${t("app.hit_points")} : ${hp}/${th.hp}`, `<b>${hp}<small>/${th.hp}</small></b>`)}</span><span class="hull-bar"><i style="width:${Math.max(0, Math.min(100, (hp / Math.max(1, th.hp)) * 100))}%"></i></span></span><span class="shield-badge">${symbol("shield", `${t("app.shield")} : ${th.shield}`, `<b>${th.shield}</b>`)}</span></span>${status ? `<span class="threat-outcome">${esc(status)}</span>` : ""}</span>`;
return `<span class="threat-portrait ${pending ? "pending-threat" : ""} ${gone ? "resolved-threat" : ""}" ${outcome ? `data-outcome="${outcome}"` : ""}>${target}${visual}<span class="threat-hud"><span class="hull-gauge"><span>${symbol("hull", `${t("app.hit_points")} : ${hp}/${th.hp}`, `<b>${hp}<small>/${th.hp}</small></b>`)}</span><span class="hull-bar"><i style="width:${Math.max(0, Math.min(100, (hp / Math.max(1, th.hp)) * 100))}%"></i></span></span><span class="shield-badge">${symbol("shield", `${t("app.shield")} : ${th.shield}`, `<b>${th.shield}</b>`)}</span></span>${status ? `<span class="threat-outcome"><span class="outcome-symbol">${pictogram(outcomeIcon)}</span><span>${esc(status)}</span></span>` : ""}</span>`;
}
return { shipCutaway, threatPortrait };
}

View file

@ -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">Impact</);
assert.match(portrait, /data-outcome="impact"/);
assert.match(portrait, />Impact<\/span>/);
assert.doesNotMatch(portrait, /Escaped/);
});