diff --git a/game.py b/game.py index cccb1c9..1592c5f 100644 --- a/game.py +++ b/game.py @@ -4758,11 +4758,11 @@ def wear_share(ratio: float) -> float: return 0.1 + 0.2 * max(0.0, 2 - ratio) -def issued_kit(world: dict, slot: str) -> list[tuple[str, int]]: - """The `slot` items handed to the guards on duty, best first.""" +def issued_kit(world: dict, slot: str, people: int | None = None) -> list[tuple[str, int]]: + """The `slot` items handed to the guards on duty (or `people` guards), best first.""" stock = world["city"]["stockpile"] stat = KIT_DEFENCE[slot][0] - people = guards_on_duty(world) + people = guards_on_duty(world) if people is None else people issued = [] for item in sorted((i for i in stock if kit_slot(i) == slot), key=lambda i: -ITEMS[i].get(stat, 0)): if not people: @@ -4868,7 +4868,8 @@ def defence(world: dict, guards: int | None = None) -> dict: if city["starving"]: total *= 0.8 return {"parts": parts, "garrison": garrison, "total": round(total, 1), "starving": city["starving"], - "guards": armed, "posts": posts, "wages": int(city.get("wages", 0)), "wage": GUARD_WAGE} + "guards": armed, "posts": posts, "wages": int(city.get("wages", 0)), "wage": GUARD_WAGE, + "kit": {slot: issued_kit(world, slot, posts) for slot in KIT_DEFENCE}} def standing_defence(world: dict) -> float: @@ -6842,6 +6843,9 @@ ORDER_RECIPES, ORDER_RAW = _order_sources() # What changed, shown on the Patch notes page. Newest first; every shipped change adds a # line here (new / balance / fix), and a new release a new entry on top. PATCH_NOTES = [ + {"date": "2026-10-30", "title": "Armoury", "notes": [ + ("new", "Added armoury to raid readiness."), + ]}, {"date": "2026-10-29", "title": "Frames, no coal past steel", "notes": [ ("balance", "Mithril, adamant and rune bars: no coal. Steel still takes 2."), ("balance", "Ore worth: mithril 15 → 21, adamantite 30 → 36, runite 55 → 63. Bars: mithril 47 → 32, adamant 74 → 54, rune 114 → 95."), diff --git a/static/app.js b/static/app.js index 3ad15ce..418ae56 100644 --- a/static/app.js +++ b/static/app.js @@ -2442,6 +2442,24 @@ function foodKinds(r) { `${item(id).icon}`).join("")}`; } +// What each guard post carries, best first: unpaid posts faded, guards with nothing in red. +function armoury(d) { + const slots = { weapon: "Weapons", shield: "Shields", jerkin: "Body armour", salve: "Salves" }; + return Object.entries(slots).map(([slot, label]) => { + const issued = d.kit[slot] || [], bare = d.posts - issued.reduce((n, [, q]) => n + q, 0); + let seat = 0; + const chips = [...issued, ...(bare > 0 ? [[null, bare]] : [])].flatMap(([id, qty]) => { + const paid = Math.max(0, Math.min(qty, d.guards - seat)); + seat += qty; + return [[paid, true], [qty - paid, false]].filter(([n]) => n).map(([n, on]) => { + const tip = id ? [item(id).name, itemStats(id)].filter(Boolean).join(": ") + gotoTip(id) : `No ${label.toLowerCase()}`; + return `${id ? `${item(id).icon} ${esc(item(id).name)}` : "✖ None"} ×${fmt(n)}${id ? ` +${fmt(item(id)[C.kit_defence[slot][0]] || 0)}` : ""}`; + }); + }); + return `
${label}
${chips.join("")}
`; + }).join(""); +} + function raidPrep(ev) { const city = S.city, me = S.me, d = city.defence; const names = { mercenaries: "Hired sellswords", ward: "Divine ward (temple)", rallied: "Rallied militia (favour)", drilled: "Drilled militia", townsfolk: "Townsfolk with pitchforks", walls: "Walls", militia: "Paid guards (barracks)", weapons: "Weapons the guards hold", shields: "Shields the guards hold", jerkins: "Body armour the guards wear", salves: "Salves", arrows: "Arrows", garrison: "Garrison" }; @@ -2449,7 +2467,8 @@ function raidPrep(ev) { const reqs = (ev.requests || []).map(reqRow).join(""); return `

Raid readiness

${reqs} -

Stockpile gear arms the defenders, best first. Fights use up arrows and break some gear.

+

Stockpile gear arms the defenders, best first. Fights use up arrows and break some gear.

+

Armoury

${armoury(d)}

Guards · ${d.guards} / ${d.posts} paid

Wage chest ${COIN} ${fmt(d.wages)} / ${fmt(full)} · ${d.wage} gold a guard per threat

diff --git a/static/styles.css b/static/styles.css index 211cf5c..3a56f22 100644 --- a/static/styles.css +++ b/static/styles.css @@ -312,6 +312,10 @@ select { background: var(--bg); border: 1px solid var(--line); border-radius: 8p table.parts { width: 100%; border-collapse: collapse; font-size: 14px; } table.parts td { padding: 4px 0; border-bottom: 1px solid var(--line); } table.parts td:last-child { text-align: right; font-variant-numeric: tabular-nums; } +.kit-row { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: baseline; margin-bottom: 8px; } +.kit-row > div { display: flex; flex-wrap: wrap; gap: 4px; } +.item-chip.unpaid { opacity: .45; } +.kit-row .item-chip .have { color: var(--muted); } .report { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; margin-bottom: 14px; } .report.win { border-left-color: var(--good); } .report.loss { border-left-color: var(--bad); }