Phase 2: client military/social screens, WebSocket push, trade + endgame, review findings pending
Built: units/movements/reports/send/expansion screens, alliance/messages/rankings screens, ws client + server /ws push (docs/PROTOCOL.md), Internet exchange trade, backbone endgame + world end, shared reports, buildDone relative levels. Tested: npm test 175/175. Two adversarial reviews found issues (trade-leg recall exploit, __proto__ via validate.js, rankings DoS, static headers, ...): fixes follow in the next commit. NOT done: bots/balance, e2e suite, real-device checks. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
parent
249818a7aa
commit
b18645dca1
87 changed files with 10201 additions and 71 deletions
|
|
@ -211,7 +211,8 @@ function resolveScanOnTown(ctx, mv, now, s) {
|
|||
function arriveSite(ctx, mv, now, world) {
|
||||
const { db } = ctx;
|
||||
const { x, y } = mv.to;
|
||||
const tile = R.tileAt(world.seed, world.map_radius, x, y);
|
||||
const tile = R.tileAt(world.seed, world.map_radius, x, y, R.worldAgeDays(world.start_at, now, world.speed));
|
||||
if (tile.type === 'backbone') return require('./landing')(ctx, mv, now, world, tile); // end game: backbone landing site
|
||||
if (tile.type !== 'incumbent' || (mv.type !== 'scan' && mv.type !== 'attack')) return bounce(ctx, mv, now, 'invalid_target');
|
||||
const attackerOp = U.getOperator(db, mv.ownerId);
|
||||
const ageDays = Math.max(0, (now - world.start_at) / DAY * world.speed);
|
||||
|
|
@ -274,6 +275,7 @@ function transferTown(ctx, town, newOp, oldOp, now) {
|
|||
if (home.id === g.hostTownId) U.addHome(db, home.id, g.units); else U.addStationed(db, g.hostTownId, home.id, g.units);
|
||||
}
|
||||
db.run('DELETE FROM town_power WHERE town_id = ?', town.id);
|
||||
require('../trade').onTownTransferred(ctx, town.id, now); // open Internet exchange offers of the old owner end, the escrow stays in the POP
|
||||
const oldUser = U.userOfOperator(db, oldOp.id), newUser = U.userOfOperator(db, newOp.id);
|
||||
if (oldUser) ctx.notify(oldUser, town.worldId, 'town_lost', { townId: town.id, name: town.name, by: opBrief(newOp) });
|
||||
if (newUser) ctx.notify(newUser, town.worldId, 'town_gained', { townId: town.id, name: town.name });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue