Townsfolk: steady rows, effects as percentages
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
58a3e66454
commit
485008a9fa
2 changed files with 2 additions and 3 deletions
|
|
@ -2023,13 +2023,12 @@ function moodStat() {
|
|||
|
||||
function moodPanel() {
|
||||
const h = S.city.happiness, e = h.effects;
|
||||
const x = (v) => `×${+v.toFixed(2)}`;
|
||||
const needs = Object.entries(h.needs).map(([key, n]) => `<div class="need">
|
||||
<div class="need-head"><b>${NEED_NAMES[key][0]} ${NEED_NAMES[key][1]}</b><span class="muted small">${pct(n.score)}</span></div>
|
||||
${n.rows.map(reqRow).join("")}</div>`).join("");
|
||||
const locked = h.locked.map((key) => `<span class="tag" title="Needed from ${NEED_TIERS[key]}">🔒 ${NEED_NAMES[key][1]} · ${NEED_TIERS[key]}</span>`).join("");
|
||||
const mods = h.mods.map((m) => `<span class="tag ${m.value < 0 ? "bad" : "good"}">${esc(m.name)} ${m.value > 0 ? "+" : "−"}${pct(Math.abs(m.value))}</span>`).join("");
|
||||
const effects = [`🌱 Growth ${x(e.growth)}`, `🛡️ Guards ${x(e.militia)}`, `🔨 Labour ${x(e.work)}`, `${COIN} Taxes ${x(e.work)}`,
|
||||
const effects = [`🌱 Growth ${pct(e.growth)}`, `🛡️ Guards ${pct(e.militia)}`, `🔨 Labour ${pct(e.work)}`, `${COIN} Taxes ${pct(e.work)}`,
|
||||
...(e.leave ? [`<span class="bad">🚶 ${pct(e.leave)} leave a day</span>`] : [])];
|
||||
return `<div class="panel mood"><h2>${h.icon} Townsfolk · ${h.name}</h2>
|
||||
<div class="mood-bar" title="${esc(`Now ${pct(h.score)} · heading to ${pct(h.target)}`)}"><span style="width:${h.score * 100}%;--c:var(--${h.score < .4 ? "bad" : h.score < .6 ? "warn" : "good"})"></span><i style="left:${h.target * 100}%"></i></div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue