diff --git a/static/app.js b/static/app.js index 474d85a..a32adde 100644 --- a/static/app.js +++ b/static/app.js @@ -287,7 +287,7 @@ function pageHtml() { function itemChip(id, qty, have) { const short = have !== undefined && have < qty; - return `${item(id).icon} ${fmt(qty)}${have !== undefined ? ` / ${fmt(have)}` : ""}`; + return `${item(id).icon} ${fmt(qty)}${have !== undefined ? ` / ${fmt(have)}` : ""}`; } // Progress towards a building cost: "have / need". @@ -378,6 +378,19 @@ function combatPanel() { `; } +// What an item does once made: healing, defence, tool speed, and who can use it. +function itemStats(id) { + const it = item(id); + const parts = []; + if (it.heal) parts.push(`❤️ Heals ${it.heal}`); + if (it.food) parts.push(`feeds ${it.food} ${it.food === 1 ? "person" : "people"} for two days`); + if (it.power) parts.push(`+${it.power} power`); + if (it.armour) parts.push(`+${it.armour} armour`); + if (it.tool) parts.push(`${Math.round(it.speed * 100)}% faster ${skillOf(it.tool).name.toLowerCase()}`); + if (it.req && it.req[1] > 1) parts.push(`needs ${skillOf(it.req[0]).name.toLowerCase()} ${it.req[1]}`); + return parts.join(", "); +} + function actionCard(a) { const me = S.me; const active = me.action?.id === a.id; @@ -399,6 +412,8 @@ function actionCard(a) { if (a.special === "sabotage") extra += `