Phase 4: close loot/refund leaks, landing-site garrisons, speed-scaled shipping, update/offsite tooling, broad e2e
Built: - Economy: raid loot capped to the room the raiders have at home (rest stays with the victim, "lootLeft" in the report); trade escrow reserves its room so refunds always fit; trade accept refuses with no_room_for_goods when the goods would not fit. Loot destroyed per 30-day run 31-61k -> ~1k, refunds clipped ~27k -> 0 (docs/BALANCE.md, 3 seeds). - End game: members of the holding alliance garrison landing sites (migration 005_site_garrison.sql), garrison counts in site defence, 72 h capture shield, withdraw route, POP view lists garrisoned units. Shipping capacity scales with world speed (3x world: winner 76-98 -> ~30-36 days after sites open). Bot runs show real contests (84-194 attacks on held sites at 1x). - Ops: deploy/update.sh (backup, stop, ff-merge, npm ci --ignore-scripts, health check, rollback), deploy/upstream-offsite (rsync only), admin end-world snapshots results, EPIPE fix, docs/workflows/ filled in. - e2e 62 -> 163 checks: units, raids/reports, alliance+messages, trade, end game, nb, PWA, reconnect, slow polling fallback (opt-in). Two app bugs found: message push ignored, "New" button stayed English. Tested: npm test 274/274, openapi check, npm run e2e 163/163 (137 s), bot runs 50x30d seeds 1-3 and 140-day/60-day speed-3 end-game runs INVARIANTS OK, adversarial review pass (findings fixed or documented). NOT tested: update.sh on a real box (systemd, real npm, runuser; stubs only, shellcheck not installed), garrison card/loot text on a phone, Node 22.13, humans. Known leaks left open and documented (BALANCE S6): loot/shipments can still overflow when stock arrives in flight, bounced backbone shipments lose overflow (reported to the sender). Garrison numbers (heldDefenceMult 2, shield 72 h) are first guesses from 2 seeds. Not claimed: balanced. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
parent
9104480463
commit
3c23c51902
92 changed files with 4887 additions and 300 deletions
|
|
@ -185,6 +185,7 @@
|
|||
kids.push(h('div', { class: 'wld-building' }, h('span', { class: 'row-sub wrap' }, App.t('wld.building', { n: s.build.toLevel }) + ' ', cd(s.build.dueAt)), b));
|
||||
}
|
||||
if (s.holder && s.id) kids.push(h('div', { class: 'row-sub wrap' }, App.t('wld.stock') + ' ', mil().resChips(s.pool)));
|
||||
if (s.shieldUntil && s.shieldUntil > now && !ended) kids.push(h('div', { class: 'row-sub wrap' }, h('span', { class: 'pill amber' }, icon('shield'), App.t('wld.shield', { t: mil().dayTime(s.shieldUntil) }))));
|
||||
const acts = [];
|
||||
if (kind === 'mine' && s.id) acts.push(h('button', { class: 'btn small primary', type: 'button', disabled: ended, onclick: () => openManage(s) }, icon('up'), App.t('wld.manage')));
|
||||
if (kind !== 'mine' && App.openSend && App.state.towns.length) acts.push(h('button', { class: 'btn small primary', type: 'button', disabled: ended, onclick: () => App.openSend({ x: s.x, y: s.y }) }, icon('target'), App.t('wld.attack')));
|
||||
|
|
@ -308,6 +309,35 @@
|
|||
sec.appendChild(btn);
|
||||
body.appendChild(sec);
|
||||
|
||||
// ---- garrison: what defends the site on top of its static part (units of the holders' POPs); call your own home, station more
|
||||
const gv = E.garrisonView(data);
|
||||
const gar = h('section', { class: 'wld-sec' }, h('h3', { class: 'sub', text: App.t('wld.gar.head') }));
|
||||
const garErr = h('p', { class: 'form-error', role: 'alert', hidden: true });
|
||||
gar.appendChild(h('div', null,
|
||||
kv(App.t('wld.gar.static'), h('b', { class: 'mono', text: num(gv.static) })),
|
||||
kv(App.t('wld.gar.units'), h('b', { class: 'mono', text: num(gv.garrison) })),
|
||||
kv(App.t('wld.gar.total'), h('b', { class: 'mono', text: num(gv.total) }))));
|
||||
if (!gv.rows.length) gar.appendChild(h('p', { class: 'row-sub wrap', text: App.t('wld.gar.empty') }));
|
||||
else {
|
||||
gar.appendChild(h('ul', { class: 'mil-list' }, gv.rows.map((r) => h('li', { class: 'mil-row' },
|
||||
h('span', { class: 'row-main' },
|
||||
h('b', { text: r.name + (r.mine ? ' · ' + App.t('wld.gar.mine') : '') }),
|
||||
h('span', { class: 'row-sub wrap', text: [r.townName, mil().unitsText(r.units), r.online ? App.t('wld.gar.share', { p: Math.round(r.share * 100) }) : App.t('wld.gar.offline')].filter(Boolean).join(' · ') })),
|
||||
r.mine ? h('button', { class: 'btn small', type: 'button', disabled: App.worldEnded(), onclick: async (ev) => {
|
||||
const b = ev.currentTarget; b.disabled = true; garErr.hidden = true;
|
||||
try {
|
||||
await App.api.post('/backbone/' + s.id + '/withdraw', { fromTownId: r.ownerTownId }, { intent: 'bb-wd:' + s.id + ':' + r.ownerTownId + ':' + nonce() });
|
||||
toast(App.t('wld.gar.withdrawn'), 'ok');
|
||||
App.refreshTown().catch(() => {}); App.refreshMovements().catch(() => {});
|
||||
await load();
|
||||
} catch (e) { garErr.textContent = App.errMsg(e); garErr.hidden = false; b.disabled = false; load(); }
|
||||
} }, icon('return'), App.t('wld.gar.withdraw')) : null))));
|
||||
}
|
||||
gar.appendChild(garErr);
|
||||
gar.appendChild(h('p', { class: 'row-sub wrap', text: App.t('wld.gar.hint') }));
|
||||
if (you.canReinforce && App.openSend && App.state.towns.length) gar.appendChild(h('button', { class: 'btn wide', type: 'button', disabled: App.worldEnded(), onclick: () => App.openSend({ x: s.x, y: s.y, type: 'reinforce' }) }, icon('shield'), App.t('wld.gar.station')));
|
||||
body.appendChild(gar);
|
||||
|
||||
// ---- ship resources
|
||||
const ship = h('section', { class: 'wld-sec' }, h('h3', { class: 'sub', text: App.t('wld.ship.head') }));
|
||||
const cur = pops.find((q) => q.id === sh.fromId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue