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
42 lines
3.7 KiB
JavaScript
42 lines
3.7 KiB
JavaScript
'use strict';
|
|
/* Response schemas of the military stage (merged into routes/schemas.js). Documentation only, like the others. */
|
|
module.exports = function addMilitarySchemas(schemas, { int, num, str, bool, obj, arr }) {
|
|
const nint = { type: ['integer', 'null'] };
|
|
const free = { type: 'object', additionalProperties: true };
|
|
const Units = { type: 'object', additionalProperties: true, description: 'unit id -> count' };
|
|
const Cost = { $ref: 'Cost' };
|
|
Object.assign(schemas, {
|
|
Units,
|
|
TrainResult: obj({ serverTime: int, eventId: int, unit: str, count: int, building: str, startAt: int, dueAt: int, cost: Cost }),
|
|
ResearchResult: obj({ serverTime: int, eventId: int, unit: str, stat: str, toLevel: int, startedAt: int, dueAt: int, cost: Cost }),
|
|
MovementSent: obj({ serverTime: int, movementId: int, type: str, fromTownId: int, toTownId: nint, to: obj({ x: int, y: int }), units: Units, cargo: free, departAt: int, arriveAt: int, protectionEnded: bool }, ['serverTime', 'movementId', 'type', 'fromTownId', 'toTownId', 'departAt', 'arriveAt']),
|
|
RecallResult: obj({ serverTime: int, recalled: int, returnMovementId: int, arriveAt: int }),
|
|
WithdrawResult: obj({ serverTime: int, movementId: int, units: Units, arriveAt: int }),
|
|
MovementEnd: obj({ townId: nint, x: int, y: int, name: { type: ['string', 'null'] }, owner: { type: ['object', 'null'], additionalProperties: true } }, ['townId', 'x', 'y']),
|
|
Movement: obj({
|
|
id: int, type: str, status: str, ownerId: int, from: { $ref: 'MovementEnd' }, to: { $ref: 'MovementEnd' }, units: Units, cargo: free,
|
|
departAt: int, arriveAt: int, recallableUntil: nint, target: { type: ['string', 'null'] }, parentId: nint, incoming: bool,
|
|
}, ['id', 'type', 'status', 'from', 'to', 'departAt', 'arriveAt']),
|
|
MovementList: obj({ serverTime: int, outgoing: arr({ $ref: 'Movement' }), incoming: arr({ $ref: 'Movement' }), alliedIncoming: arr({ $ref: 'Movement' }) }, ['serverTime', 'outgoing', 'incoming']),
|
|
Marked: obj({ serverTime: int, marked: int }),
|
|
ReportItem: obj({ id: int, type: str, createdAt: int, role: str, read: bool, summary: free }),
|
|
ReportList: obj({ serverTime: int, items: arr({ $ref: 'ReportItem' }), next: nint, unread: int }),
|
|
Report: obj({ id: int, type: str, createdAt: int, expiresAt: int, role: str, read: bool, summary: free, data: free }),
|
|
ReportResponse: obj({ serverTime: int, report: { $ref: 'Report' } }),
|
|
TileInfo: obj({
|
|
serverTime: int, x: int, y: int, type: str, bonus: { type: ['string', 'null'] },
|
|
distances: arr(obj({ townId: int, distance: num })), town: free, incumbent: free,
|
|
settle: obj({ possible: bool, code: { type: ['string', 'null'] }, footprint: num, footprintNeeded: num, maxDistance: int }),
|
|
}, ['serverTime', 'x', 'y', 'type', 'distances', 'settle']),
|
|
TownMilitary: obj({
|
|
units: obj({ home: Units, online: bool, offlineSince: nint, stationedHere: arr(free), stationedAway: arr(free), garrisoned: arr(obj({ siteId: int, x: int, y: int, units: Units })) }),
|
|
training: arr(obj({ id: int, unit: str, count: int, building: str, startAt: int, dueAt: int })),
|
|
trainable: arr(obj({ unit: str, building: str, role: str, cost: Cost, timeMs: int, missing: arr(free), locked: bool })),
|
|
research: obj({ levels: free, queue: { type: ['object', 'null'], additionalProperties: true }, speedBonus: num, maxLevel: int }),
|
|
transport: obj({ links: int, active: int, capacityPerLink: int }),
|
|
movements: obj({ outgoing: arr({ $ref: 'Movement' }), incoming: arr({ $ref: 'Movement' }) }),
|
|
protectionUntil: int,
|
|
}),
|
|
});
|
|
if (schemas.Town && schemas.Town.properties) schemas.Town.properties.military = { $ref: 'TownMilitary' }; // optional: not in `required`
|
|
};
|