Ported by hand from PR #209 by @qingjingshenghuo (its one-line data/config.json was not taken): - server/match/gamedata.js bossPoolShareOf (used by GameData.bossPoolShare and by finalAssault.bossPoolHp for a plain game-data object): solo × `solo` (1); co-op with `perPlayer` true × `coop` (1) × the players alive at the boss round's start (bots and AI 托管 seats count, eliminated / departed seats do not; at most aliveFull 4; a count left out = a full team). The fixed pool stays restorable through config: bossHpScale perPlayer false + solo 0.25 (and its optional aliveScaling). - tools/build-data.mjs: the global bossHpScale carries the rule (perPlayer true, solo 1); the modes' entries keep only bloodPointKey / unaffectedByEnemyScale. data/config.json regenerated offline — JSON compare: only bossHpScale (global and the 9 mode entries) changed. - The problem #209 documented: a 胄 drone death is 2 % of the pool and 限伤 cancels a hit of ceil ≥ 300000, so the hidden 胄 终极 pool at 3 / 4 players (21.6M / 28.8M) would cancel every drone (432000 / 576000). The drone link is a share of the pool, no hit: Battle.loseHp takes noHitLimit and the link passes the limit [ASSUMED: the official client checks every damage modifier and PRTS calls it 真实伤害, but which max HP it reads is undocumented]; a part's 传递 and every hit stay under the limit. Golden (regenerated; why: the pool size): - fields: boss-boss_1..7-pair/-solo and hidden-boss_8..10-pair/-solo (all 20 boss / hidden scenarios) — a pair field's pool × 2 (two players), a solo template's × 4 (solo × 1, was × 0.25); boss-boss_1-pair, boss-boss_1-solo, boss-boss_3-pair, boss-boss_3-solo, boss-boss_5-solo, boss-boss_7-pair and hidden-boss_9-solo now end at the 200 s cap instead of clearing; the two 联防 scenarios are unchanged. - matches: solo-FUNNY-2, solo-NORMAL-1, solo-HARD-1, solo-HARD-2 now lose the Final Assault (solo leaders have 4× the HP: team LP 0 with 93088–176395 of the pool left); solo-FUNNY-1, solo-NORMAL-2, solo-HARD-9-boosted (its Hidden Core too), coop2-NORMAL-3, coop4-FUNNY-6, coop2-ABYSS-10-boosted, coop2-NORMAL-70-diy still win with more leader damage (pool × players alive; solo-FUNNY-1 / solo-HARD-9-boosted end with 6 / 1 team LP less). Unchanged: coop2-NORMAL-8-serverrun and coop2-NORMAL-14-standins (one player left at R14: × 1 as before) and the matches that end before R14; roster / bonds / standins / diy unchanged. Tests: test/match/boss-hp-scaling.test.js (from PR #209, adapted — every leader and difficulty × 1–4 players and solo; R14 / R15 leave out two departed players; AI 托管 and bots count, an eliminated player does not; config restores the fixed pool, the opposite of the PR's test; the plain-object fallback agrees; only the leader's HP scales); test/content/enemies_bosses.test.js (hidden 胄 终极 at 3 / 4 players: the drone share lands, a hit of the same size is cancelled — fails without the change). Updated on purpose: finalAssault, balance, bosshp, connection, docs-consistency (the §20.9 record points to §25.13.4; the data carries perPlayer true), sim/playtest6_limits (the drone share lands past the line), match/playtest6-bosspool (the 5 % knob halved to keep the 2-player pool's size: that test is about the pool's arithmetic). Docs: PLAYING §7, DATA, META, BALANCE, SIM, design engine.md / network.md, the §20.9 / §20.10 records, research 00 / 01 / 08, the code comments, DESIGN §25.13.4 and the §25.10 table.
103 lines
4.9 KiB
JavaScript
103 lines
4.9 KiB
JavaScript
// The Final Assault / Hidden Core leader pool = bloodPoint[difficulty] × the players alive when the fight starts (solo
|
||
// × 1) — the owner's decision of 2026-10-06, adopting PR #209 by @qingjingshenghuo (these tests are ported from it);
|
||
// it replaces the fixed pool of 「保持固定血量」 (DESIGN §20.9 / §20.10), which config bossHpScale still restores
|
||
// (DESIGN §25.13.4, server/match/gamedata.js bossPoolShareOf).
|
||
import { test } from 'node:test';
|
||
import assert from 'node:assert/strict';
|
||
import { makeMatch, DATA } from './harness.js';
|
||
import { GameData } from '../../server/match/gamedata.js';
|
||
import { bossPoolHp, SharedBossPool } from '../../server/match/finalAssault.js';
|
||
import { makeBattle } from '../helpers/battleHarness.js';
|
||
|
||
const DIFFS = ['FUNNY', 'NORMAL', 'HARD', 'ABYSS'];
|
||
|
||
test('every leader and difficulty: bloodPoint × the players alive (co-op), × 1 solo', () => {
|
||
for (const difficulty of DIFFS) {
|
||
const gd = new GameData(DATA, `mode_multi_${difficulty.toLowerCase()}`);
|
||
const solo = new GameData(DATA, `mode_single_${difficulty.toLowerCase()}`);
|
||
for (const id of Object.keys(DATA.bosses)) {
|
||
const base = DATA.bosses[id].bloodPoint[difficulty];
|
||
for (const n of [1, 2, 3, 4]) assert.equal(bossPoolHp(gd, id, n), base * n, `${id} ${difficulty} ×${n}`);
|
||
assert.equal(bossPoolHp(solo, id, 1), base, `${id} ${difficulty} solo`);
|
||
}
|
||
}
|
||
});
|
||
|
||
for (const hidden of [false, true]) {
|
||
test(`R${hidden ? 15 : 14}: the round's pool leaves out two departed players`, () => {
|
||
const h = makeMatch({ humans: 4, difficulty: 'HARD', fake: true, instant: false }).start();
|
||
h.toPrep(1);
|
||
const m = h.m;
|
||
m.onLeave('p_2');
|
||
m.onLeave('p_3');
|
||
assert.equal(m.alivePlayers().length, 2);
|
||
assert.equal(h.ps('p_2').alive, false);
|
||
m.round = hidden ? 15 : 14;
|
||
m.teamLp = 50;
|
||
m.bossId = 'boss_1';
|
||
m.hiddenBossId = 'boss_9';
|
||
m._planBossWaves();
|
||
m.startFinalAssault(hidden);
|
||
const id = hidden ? m.hiddenBossId : m.bossId;
|
||
assert.equal(m.bossPool.maxHp, DATA.bosses[id].bloodPoint.HARD * 2);
|
||
m.dispose();
|
||
});
|
||
}
|
||
|
||
test('disconnected players (AI 托管) and bots count; an eliminated player does not', () => {
|
||
const h = makeMatch({ humans: 3, bots: 1, fake: true, instant: false }).start();
|
||
h.toPrep(1);
|
||
h.m.onDisconnect('p_1');
|
||
h.ps('p_2').eliminate(1);
|
||
h.m.round = 14;
|
||
h.m._planBossWaves();
|
||
h.m.startFinalAssault(false);
|
||
assert.equal(h.m.alivePlayers().length, 3);
|
||
assert.equal(h.m.bossPool.maxHp, h.m.gd.boss(h.m.bossId).bloodPoint.NORMAL * 3);
|
||
h.m.dispose();
|
||
});
|
||
|
||
test('config restores the fixed pool of 0.1.x (perPlayer false, solo 0.25) — GameData and the plain-object fallback agree', () => {
|
||
const data = structuredClone(DATA);
|
||
data.config.bossHpScale = { ...data.config.bossHpScale, perPlayer: false, solo: 0.25 };
|
||
for (const modeId of ['mode_single_abyss', 'mode_multi_abyss']) {
|
||
const gd = new GameData(data, modeId);
|
||
const base = data.bosses.boss_8.bloodPoint.ABYSS;
|
||
const expected = gd.isSolo ? base * 0.25 : base;
|
||
for (const n of [1, 2, 3, 4]) {
|
||
assert.equal(gd.bossPoolHp('boss_8', n), expected, `${modeId} ×${n}`);
|
||
assert.equal(bossPoolHp(gd, 'boss_8', n), expected);
|
||
// a caller's game-data object without bossPoolShare reads the same config through bossPoolShareOf
|
||
const plain = { boss: (id) => gd.boss(id), difficulty: gd.difficulty, mode: gd.mode, config: gd.config, isSolo: gd.isSolo };
|
||
assert.equal(bossPoolHp(plain, 'boss_8', n), expected);
|
||
}
|
||
}
|
||
// and the per-player rule through the same fallback
|
||
const gd = new GameData(DATA, 'mode_multi_abyss');
|
||
const plain = { boss: (id) => gd.boss(id), difficulty: gd.difficulty, mode: gd.mode, config: gd.config, isSolo: false };
|
||
assert.equal(bossPoolHp(plain, 'boss_8', 3), DATA.bosses.boss_8.bloodPoint.ABYSS * 3);
|
||
});
|
||
|
||
test('only the leader\'s pool scales: escorts and the Hidden Core\'s parts keep their stats', () => {
|
||
for (const kind of ['boss', 'hidden']) {
|
||
const bossKey = kind === 'boss' ? 'enemy_9013_acstmk' : 'enemy_9013_acstmk_2';
|
||
const snapshot = (n) => {
|
||
const h = makeBattle({
|
||
kind, content: 'none', sharedBoss: new SharedBossPool(7200000 * n), autoFinish: false,
|
||
enemies: [{ key: bossKey, tag: 'boss', pos: [3, 10] }, { key: 'enemy_1427_lrnazg', pos: [2, 10] }, { key: 'enemy_9014_acstma', pos: [4, 10] }],
|
||
});
|
||
h.step();
|
||
return [bossKey, 'enemy_1427_lrnazg', 'enemy_9014_acstma'].map((key) => {
|
||
const e = h.enemy(key);
|
||
assert.ok(e, `spawned ${key}`);
|
||
return { hp: e.s.maxHp, atk: e.s.atk, def: e.s.def };
|
||
});
|
||
};
|
||
const one = snapshot(1), four = snapshot(4);
|
||
assert.equal(four[0].hp, one[0].hp * 4, `${kind}: the leader shows the pool`);
|
||
assert.equal(four[0].atk, one[0].atk);
|
||
assert.equal(four[0].def, one[0].def);
|
||
assert.deepEqual(four.slice(1), one.slice(1), `${kind}: escort and part unchanged`);
|
||
}
|
||
});
|