Phone UI and touch precision overhaul, proxy fixes, Orbital Uplink, four new maps

Phone panels (reviewed + QA'd, matrix of 22 layouts with real taps/bounding boxes):
- selected-tower action bar over the board (Upgrade/Sell/Target/close), info panel
  updated in place so taps are never lost, scrollable palette for 7+ towers,
  overlays with pinned footers (Help "Got it", Play solo, Join always visible),
  tappable room chip to invite, reduced-motion/contrast/forced-colors fixes,
  paused state, partner cursor labels, bigger level pips and owner flags
- touch input rewritten around "pointerdown commits nothing": pinch never builds,
  10px tap slop, palm-proof pinch, long-press pings with any tool armed, nudge
  arrows for precise placement, hotkey repeat guard, proportional wheel zoom
- new e2e: select/sell, info-panel stability, UI states, touch precision;
  camera unit tests

Proxy/server (reproduced against real nginx 1.26 with NPM v2.16 config):
- Origin check works when the proxy drops a non-default port, TRUSTED_PROXIES for
  proxies on global IPv6/CGNAT addresses, service worker no longer serves nginx's
  502 page, DEPLOY.md corrected (NPM default read timeout is 90 s, Advanced-tab
  limits, path-prefix, cookie size, per-IP cap behaviour)

Content:
- Orbital Uplink: 4-level endgame tower (450 + 500/800/1200 credits): piercing
  armour-ignoring beam, blast and lingering slow, ground+air, range 11-14;
  glyph, beam effect, sound, help text, unit tests
- Maps: The Canyon, Archipelago, Fortress, Pinwheel (7 maps total)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tb8pW2KAN4oFkh1aK1BfD8
This commit is contained in:
Claude 2026-10-10 18:03:24 +00:00
parent dad0382e10
commit a5bd09d505
22 changed files with 2423 additions and 405 deletions

View file

@ -313,7 +313,7 @@ test('fuzz: garbage commands never throw', () => {
});
test('balance tables keep the shape the client and server rely on', () => {
assert.deepEqual(TD.TOWER_ORDER, ['wall', 'filter', 'ids', 'mortar', 'throttle', 'arc']);
assert.deepEqual(TD.TOWER_ORDER, ['wall', 'filter', 'ids', 'mortar', 'throttle', 'arc', 'uplink']);
assert.deepEqual(TD.ENEMY_ORDER, ['ping', 'worm', 'trojan', 'spam', 'ghost', 'rootkit']);
assert.equal(TOWERS.wall.levels.length, 1);
assert.ok(TOWERS.wall.refund, 'walls refund in full');
@ -321,13 +321,14 @@ test('balance tables keep the shape the client and server rely on', () => {
const t = TOWERS[k];
assert.ok(t.name && t.color && t.key && t.desc, k + ' has display fields');
if (k === 'wall') continue;
assert.equal(t.levels.length, 3, k + ' has exactly 3 levels');
assert.equal(t.levels.length, k === 'uplink' ? 4 : 3, k + ' has the expected number of levels');
t.levels.forEach((lv, i) => {
assert.ok(lv.cost > 0 && lv.range > 0, k + ' L' + (i + 1) + ' cost/range');
if (k === 'throttle') assert.ok(lv.slow > 0 && lv.slow <= 0.6, 'slow is capped at 0.6 by the sim');
else assert.ok(lv.dmg > 0 && lv.rate > 0, k + ' L' + (i + 1) + ' dmg/rate');
if (k === 'mortar') assert.ok(lv.splash > 0);
if (k === 'arc') assert.ok(lv.chains >= 1 && lv.chainRange > 0 && lv.falloff > 0 && lv.falloff < 1);
if (k === 'uplink') assert.ok(lv.width > 0 && lv.splash > 0 && lv.slowOnHit > 0 && lv.slowOnHit <= 0.6 && lv.slowFor > 0);
if (i > 0) assert.ok(lv.range >= t.levels[i - 1].range, 'range never shrinks on upgrade');
});
}
@ -347,3 +348,39 @@ test('balance tables keep the shape the client and server rely on', () => {
for (let n = 2; n <= 60; n++) assert.ok(TD.hpScale(n) > TD.hpScale(n - 1));
for (let n = 2; n <= 60; n++) assert.ok(TD.rewardScale(n) >= TD.rewardScale(n - 1));
});
test('Orbital Uplink: expensive endgame beam that pierces, ignores armour, blasts, slows and hits flyers', () => {
const s = new Sim({ map: 'open', gold: 100000 });
const r = s.place('uplink', 5, 7);
assert.ok(r.ok);
const t = s.towerById(r.id), st = TOWERS.uplink.levels[0];
const idsTotal = TOWERS.ids.levels.reduce((a, l) => a + l.cost, 0);
const upTotal = TOWERS.uplink.levels.reduce((a, l) => a + l.cost, 0);
assert.ok(TOWERS.uplink.levels[0].cost >= 5 * TOWERS.ids.levels[0].cost, 'buying it costs several times an IDS Sniper');
assert.ok(upTotal >= 8 * idsTotal, 'a fully upgraded Uplink costs many times a fully upgraded IDS');
assert.ok(st.range > TOWERS.ids.levels[2].range, 'it out-ranges even a level 3 IDS');
assert.ok(st.dmg > TOWERS.ids.levels[2].dmg, 'and hits harder than a level 3 IDS from the start');
const mk = (id, x, y, extra) => Object.assign({ id, kind: 'trojan', air: false, x, y, cx: 0, cy: 0, tx: -1, ty: -1, hp: 5000, maxhp: 5000, armor: 50, speed: 1, slow: 0, slowT: 0, slowAmt: 0, rem: 10, dead: false }, extra);
// tower centre is (5.5, 7.5): three monsters on the horizontal line, one flyer on it, one far off the line, one beside the first target
const a = mk(201, 8.5, 7.5), b = mk(202, 11.5, 7.5), c = mk(203, 14.5, 7.5), air = mk(204, 12.5, 7.5, { air: true, kind: 'ghost' });
const off = mk(205, 9.5, 12.5), near = mk(206, 8.5, 8.6);
s.monsters = [a, b, c, air, off, near];
t.mode = 'close'; t.cd = 0;
s.updateTower(t, TD.STEP);
for (const o of [a, b, c, air]) assert.equal(o.hp, 5000 - st.dmg, 'on-line monster took full beam damage ignoring armour (armour 50)');
assert.equal(off.hp, 5000, 'a monster off the line is untouched');
assert.equal(near.hp, 5000 - st.dmg * 0.5, 'a monster beside the target takes half from the blast, also ignoring armour');
assert.ok(a.slowT > 0 && a.slowAmt > 0, 'hit monsters are slowed');
assert.equal(off.slowT, 0);
// slow lingers after the shot and then wears off
t.cd = 1e9; // stop it re-firing so we can watch the slow wear off
s.tick(TD.STEP); assert.ok(a.slow > 0, 'slow is applied on the next tick');
for (let i = 0; i < 60 * 3; i++) s.tick(TD.STEP);
assert.equal(a.slow, 0, 'slow wears off after a couple of seconds');
// upgrades to level 4 and refunds 70% of everything spent
assert.ok(s.upgrade(t.id).ok); assert.ok(s.upgrade(t.id).ok); assert.ok(s.upgrade(t.id).ok);
assert.equal(s.upgrade(t.id).reason, 'max');
assert.equal(t.level, 4);
const g = s.gold; s.sell(t.id);
assert.equal(s.gold, g + Math.floor(upTotal * TD.SELL_RATIO));
});