Playtest #6 fixes: summons placed by hand, boss pool stall, bounties, 联防 leak counter, distinct offers, 机变 card text, phone buy tap, skill triggers, blocking, push force, 孤立, enemies, element bar

- #1 #2 skill / device summons (赫默's drone, 巫恋's doll, 凯瑟琳's devices) are hand cards placed by the player;
  placed summons deploy once at battle start, then a skill summon re-appears at its tile on each cast (the user's call)
- #3 叙拉古 隐匿 ends on time (32 + 0.4 × layers s); 忍冬 S3 迷彩 lasts until her next cast (official), kept apart from 隐匿
- #4 multi-round bounty cards last two battles (the user's call; MULTI_ROUND_BOUNTY_BATTLES), blue / red card text
- #5 the shared boss pool's float dust (≈3.6e-12 HP) stalled Final Assault leaders at 0 %; < 1 HP now clears the pool,
  and the team LP reaching 0 first is a defeat (PRTS)
- #6 #10 机变 cards show their official effect text; an invisible 详情 button no longer swallows the confirming tap on phones
- #7 live ×N counter of a leaker's enemies still on the 联防 field (LP loss stays capped at 10)
- #8 #15 #16 skill triggers per 技能策略: skill-range triggers, injured-ally heals (古米, 塞雷娅), tank take-damage
  triggers with a 3 s cooldown; 新约能天使 S2 shields the highest-aggro operator in range
- #9 official per-enemy model scales (威龙)
- #11 element bar under the unit's HP bar (white = 元素值 left, element-coloured refill after a burst), floor rounding
- #12 枯朽战车 kit per PRTS; every ranged enemy reaches its target's 0.25 collider
- #13 恐惧 wander (萨科塔之翼 at half HP, operator fears make enemies flee) with re-planning after pushes
- #14 push / pull distance by 力度 − 重量 (PRTS table); #17 every blocker attacks what it blocks; ASPD floor 20
- #18 炎佑 is 孤立: no heals or ally buffs
- #19 every free pick-one chess offer (promotion reward, 信标, 寻呼模块) shows different operators
- DESIGN §20 and the normative lines, SIM / META / DATA / PLAYING updated; 2747 unit tests and all 27 browser suites
  green; dev recordings regenerated
This commit is contained in:
sganggs committed 2026-10-01 19:08:23 +08:00
1 parent e6628f0cfe
commit 6464e4b46a
138 files changed
+7946 -1379

No files matched your search

+43 -7
View File
@@ -18,14 +18,19 @@
// HeadlessJob / runHeadless(battle) step a battle to its end — in wall-clock-bounded slices (bots, takeovers
// under a real scheduler) or at once (verification, virtual time) — and keep a
// progress timeline [[gt, killed, total]] for the teammates' waiting UI
// (联防: [gt, killed, total, left] — left = spec.js uniteLeft, the leakers'
// enemies still standing, for their live counter; user playtest #6 item 7)
// HeadlessPacer real-time pacing of a dynamic set of server-run battles without snapshots
// (boss fields that share the pool while other fields run on clients); a
// takeover's fast-forward is spread over the pacing intervals
// specBounds(spec, gd) / validateClientResult(spec, result, { gd })
// a client's b.result is accepted only when it is plausible for its spec;
// the returned result is rebuilt from whitelisted fields (never the raw object)
// uniteBillBounds(spawns, gd) 联防: per leaker, the most survivors settlement can bill (sent in + the
// offspring bound) — the live counter's clamp
// syntheticResult(players, progress) stand-in when a boss field's client never reported
import { TICK, SNAPSHOT_EVERY } from '../sim/constants.js';
import { uniteLeft } from '../sim/spec.js';
export const MAX_TICKS_PER_INTERVAL = 8;
export const INTERVAL_MS = 1000 / 30;
@@ -251,20 +256,34 @@ export const HEADLESS_SLICE_MS = 8;
export const CATCHUP_TICKS_PER_INTERVAL = 240;
const perfNow = () => (globalThis.performance ? globalThis.performance.now() : Date.now());
/**
* A timeline sample of a battle: [gt, killed, total], plus — 联防 — the leakers' enemies still standing
* (spec.js uniteLeft; omitted when unknown).
*/
export function timelineSample(b) {
const s = [Number(b && b.time) || 0, Number(b && b.killed) || 0, Number(b && b.total) || 0];
if (b && b.kind === 'unite') {
let left = null;
try { left = uniteLeft(b); } catch { left = null; }
if (left) s.push(left);
}
return s;
}
/**
* A server-run battle stepped to its end, in one go or in wall-clock-bounded slices (a low-power host must not stall
* its event loop for the ~0.1–1 s a whole battle takes, several times at once when bots fight): `run(budgetMs)` steps
* until the battle ends (→ true) or the budget is used (→ false; checked every 16 ticks). `timeline` grows while it
* runs ([[gt, killed, total]] every TIMELINE_EVERY game seconds, then the final state); `output()` once done gives
* `{ battle, result, timeline, crashed }`. A throwing battle is force-ended, then replaced by a DeadBattle; the run is
* bounded by HARD_CAP_SECONDS.
* runs (timelineSample: [gt, killed, total(, left)] every TIMELINE_EVERY game seconds, then the final state);
* `output()` once done gives `{ battle, result, timeline, crashed }`. A throwing battle is force-ended, then replaced by
* a DeadBattle; the run is bounded by HARD_CAP_SECONDS.
*/
export class HeadlessJob {
constructor(battle, { onError = null, players = [] } = {}) {
this.battle = battle;
this.onError = onError;
this.players = players;
this.timeline = [[0, 0, Number(battle && battle.total) || 0]];
this.timeline = [timelineSample(battle)];
this.every = Math.max(1, Math.round(TIMELINE_EVERY / TICK));
this.cap = Math.ceil(HARD_CAP_SECONDS / TICK);
this.n = 0;
@@ -284,7 +303,7 @@ export class HeadlessJob {
b.step();
this.n++;
k++;
if (this.n % this.every === 0) this.timeline.push([Number(b.time) || 0, Number(b.killed) || 0, Number(b.total) || 0]);
if (this.n % this.every === 0) this.timeline.push(timelineSample(b));
if (timed && (k & 15) === 0 && !b.finished && now() - t0 >= budgetMs) return false;
}
if (!b.finished) b.forceEnd('timeout');
@@ -307,7 +326,7 @@ export class HeadlessJob {
for (const pid of this.players) perPlayer[pid] = emptyPerPlayer();
result = { time: Number(b.time) || 0, reason: 'forced', perPlayer, killed: 0, total: 0, errors: 1, synthetic: true };
}
this.timeline.push([Number(b.time) || 0, Number(b.killed) || 0, Number(b.total) || 0]);
this.timeline.push(timelineSample(b));
this.done = true;
this._out = { battle: b, result, timeline: this.timeline, crashed: this.crashed };
}
@@ -324,7 +343,7 @@ export function runHeadless(battle, opts = {}) {
return job.output();
}
/** Timeline sample at game time `gt`: [gt, killed, total] of the last sample ≤ gt. */
/** Timeline sample at game time `gt`: [gt, killed, total(, left)] of the last sample ≤ gt. */
export function timelineAt(timeline, gt) {
if (!Array.isArray(timeline) || !timeline.length) return [0, 0, 0];
let lo = 0, hi = timeline.length - 1;
@@ -626,6 +645,23 @@ export function specBounds(spec, gd = null) {
};
}
/**
* 联防: the most enemies settlement can bill each leaker — what it sent in plus what those enemies can leave behind
* (splits / summons within offspringPerParent, maxTotal without a data bound): validateClientResult's (key, leaker)
* budgets summed per leaker. Bounds the live counter (Match._uniteLeft; user playtest #6 item 7).
* @param {object[]} spawns the 联防 spawns (unite.js plan.leaked: { enemyKey, sourcePlayerId, … })
* @returns {Map<string, number>} leaker id → bound
*/
export function uniteBillBounds(spawns, gd = null) {
const B = specBounds({ spawns: Array.isArray(spawns) ? spawns : [] }, gd);
const out = new Map();
for (const [ks, n] of [...B.keySourceCounts, ...B.derivedSourceCounts]) {
const pid = ks.slice(ks.lastIndexOf('|') + 1);
if (pid) out.set(pid, (out.get(pid) || 0) + n);
}
return out;
}
const finiteIn = (v, lo, hi) => typeof v === 'number' && Number.isFinite(v) && v >= lo && v <= hi;
const sameMods = (a, b) => {
const ka = a && typeof a === 'object' ? Object.keys(a).filter((k) => a[k] !== undefined).sort() : [];