Siegeworks: traps, engines, Outworks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2bfc430f19
commit
c35c2289e2
5 changed files with 242 additions and 14 deletions
|
|
@ -264,6 +264,7 @@ const SQUADS = [
|
|||
{ id: "guards", parts: ["militia", "weapons", "shields", "jerkins", "salves"], name: "Guards", glyph: "swordman", dmg: "slash", every: 2 },
|
||||
{ id: "archers", parts: ["arrows"], name: "Archers", glyph: "bow-arrow", dmg: "pierce", every: 1.8 },
|
||||
{ id: "walls", parts: ["walls"], name: "Walls", glyph: "stone-wall", dmg: "blunt", still: true },
|
||||
{ id: "works", parts: ["traps", "engines"], name: "Siegeworks", glyph: "catapult", dmg: "blunt", every: 3.2 },
|
||||
{ id: "folk", parts: ["townsfolk", "drilled", "rallied"], name: "Townsfolk", glyph: "farmer", dmg: "blunt", every: 2.8 },
|
||||
{ id: "swords", parts: ["mercenaries"], name: "Sellswords", glyph: "hooded-assassin", dmg: "slash", every: 2.2 },
|
||||
{ id: "ward", parts: ["ward"], name: "Temple ward", glyph: "prayer", dmg: "magic", every: 3 },
|
||||
|
|
@ -1994,6 +1995,7 @@ function itemStats(id) {
|
|||
parts.push(`+${Math.round(it[stat] * rate * 10) / 10} city defence per paid guard${it.kit === "salve" ? `, used up · max ${C.salve_cap}` : ""}`);
|
||||
}
|
||||
else if (it.armour || it.ward) parts.push(gearStats({ ...it, power: 0 }));
|
||||
if (it.siege) parts.push(`+${it.siege_power} city defence in the Outworks, ${it.siege === "trap" ? "raids only, used up" : "raids + dragons, can break"}`);
|
||||
if (it.reagent) parts.push(it.reagent === "jewel" ? "Reagent for jewellery" : `Reagent for ${C.weights[it.reagent].name.toLowerCase()} armour`);
|
||||
if (it.jewel && !["power", "ward"].includes(it.jewel)) parts.push(jewelText(it));
|
||||
if (it.tool || it.station) parts.push(`${Math.round(it.speed * 100)}% faster ${skillOf(it.tool || it.station).name.toLowerCase()}`);
|
||||
|
|
@ -2625,6 +2627,16 @@ function foodKinds(r) {
|
|||
`<span class="${meals >= r.day ? "" : "missing"}"${goto(id)} title="${esc(`${item(id).name} · ${fmt(meals)} / ${fmt(r.day)} meals${gotoTip(id)}`)}">${item(id).icon}</span>`).join("")}</div>`;
|
||||
}
|
||||
|
||||
// What stands in the Outworks, best first, with the empty places in red.
|
||||
function siegeRows(works) {
|
||||
return [["trap", "Traps"], ["engine", "Engines"]].filter(([kind]) => works[`${kind}_slots`]).map(([kind, label]) => {
|
||||
const room = works[`${kind}_slots`], placed = works[kind], laid = placed.reduce((n, [, q]) => n + q, 0);
|
||||
const chips = placed.map(([id, qty]) => `<span class="item-chip"${goto(id)} title="${esc([item(id).name, itemStats(id)].filter(Boolean).join(": ") + gotoTip(id))}">${item(id).icon} ${esc(item(id).name)} ×${fmt(qty)} <span class="have">+${fmt(item(id).siege_power)}</span></span>`);
|
||||
if (room > laid) chips.push(`<span class="item-chip short">✖ Empty ×${fmt(room - laid)}</span>`);
|
||||
return `<div class="kit-row"><span class="muted small">${label}</span><div>${chips.join("")}</div></div>`;
|
||||
}).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" };
|
||||
|
|
@ -2640,12 +2652,12 @@ function armoury(d) {
|
|||
});
|
||||
});
|
||||
return `<div class="kit-row"><span class="muted small">${label}</span><div>${chips.join("")}</div></div>`;
|
||||
}).join("");
|
||||
}).join("") + siegeRows(d.works);
|
||||
}
|
||||
|
||||
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", reinforcements: "Reinforcements" };
|
||||
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", traps: "Traps (raids only)", engines: "Siege engines", garrison: "Garrison", reinforcements: "Reinforcements" };
|
||||
const full = (d.posts - d.away) * d.wage, owed = Math.max(0, full - d.wages);
|
||||
const reqs = (ev.requests || []).map(reqRow).join("");
|
||||
return `<div class="cols">
|
||||
|
|
@ -2660,7 +2672,7 @@ function raidPrep(ev) {
|
|||
<button class="btn sm" data-wages="city" ${!owed || city.treasury < 1 ? "disabled" : ""}>From the treasury (${fmt(city.treasury)})</button></div>
|
||||
<p class="small muted">Only paid guards stand, and only they get the armoury's kit. Paying earns favour.</p>
|
||||
<h2 style="margin-top:16px">Defence</h2>
|
||||
<table class="parts">${Object.entries(d.parts).filter(([k, v]) => k !== "rallied" || v).map(([k, v]) => `<tr><td>${names[k]}</td><td>${fmt(v)}</td></tr>`).join("")}
|
||||
<table class="parts">${Object.entries(d.parts).filter(([k, v]) => !["rallied", "traps", "engines"].includes(k) || v).map(([k, v]) => `<tr><td>${names[k]}</td><td>${fmt(v)}</td></tr>`).join("")}
|
||||
${d.starving ? `<tr><td class="bad">Hungry (×0.8)</td><td></td></tr>` : ""}</table>
|
||||
<h2 style="margin-top:16px">Garrison</h2>
|
||||
<p class="small">${d.garrison.length ? d.garrison.map((g) => `${esc(g.name)} (${g.power})`).join(", ") : `<span class="muted">Nobody yet.</span>`}</p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue