feedback3: merge WH — ground operators are melee-position, 叙拉古 rolls on every normal hit, off bonds show as disabled, prep-end items merge next prep

This commit is contained in:
sganggs committed 2026-10-04 21:26:10 +08:00
commit 1005754bf3
28 files changed
+746 -98

No files matched your search

+11 -2
View File
@@ -412,7 +412,7 @@ test('突袭 #51: the most advanced enemy out of reach → the jump goes to the
checkInvariants(h.b);
});
test('不屈: knocked-out ground operator redeploys (p=1 at high L); tier 2 every operator +5 SP; inactive / elevated → no', () => {
test('不屈: knocked-out 地面干员 (melee position) redeploys (p=1 at high L); tier 2 every operator +5 SP; inactive / ranged → no', () => {
const bb = bondBb('indomShip');
const sk = { spCost: 50, initSp: 0 };
const defs = { chess: { i_g: op('i_g', ['indomShip']), i_o: chessRec({ id: 'i_o', bonds: [], skill: sk }) } };
@@ -441,12 +441,21 @@ test('不屈: knocked-out ground operator redeploys (p=1 at high L); tier 2 ever
close(o1.skill.sp, s1, 'tier 1: no SP');
checkInvariants(t1.b);
// 地面干员 = the melee position, whatever the tile: up on a 高台 it still counts; a ranged operator on a melee tile never
const hi = makeBattle({ defs, units: [{ chessId: 'i_g', row: 10, col: 2 }], bonds: { indomShip: bond(1, 300) } });
hi.step(2);
const hg = hi.unit('i_g');
assert.equal(hg.ground, false, 'elevated tile');
hi.b.dealDamage(null, hg, { amount: 1e9, type: 'true' });
assert.equal(hg.alive, false, 'not a ground operator');
assert.ok(hg.alive && hg.deployed, 'a melee operator on a 高台 is a 地面干员');
const rd = { chess: { i_r: ranged('i_r', ['indomShip']), i_o: chessRec({ id: 'i_o', bonds: [], skill: sk }) } };
const lo = makeBattle({ defs: rd, units: [{ chessId: 'i_r', row: 10, col: 4 }, { chessId: 'i_o', row: 12, col: 6 }], bonds: { indomShip: bond(2, 300, 3) } });
lo.step(2);
const lr = lo.unit('i_r'), lsp = lo.unit('i_o').skill.sp;
assert.equal(lr.ground, true, 'a melee (ground) tile');
lo.b.dealDamage(null, lr, { amount: 1e9, type: 'true' });
assert.equal(lr.alive, false, 'a ranged operator on a melee tile is not a 地面干员');
close(lo.unit('i_o').skill.sp, lsp, 'no tier 2 SP either');
});
test('协防干员: all operators take ×0.8 phys/arts; members deal ×1.2 (elite ×1.4)', () => {
+98
View File
@@ -0,0 +1,98 @@
// test/content/feedback3-ground-ops.test.js — 「地面干员」 is the melee position (地面位), not the tile (0.1.3; community
// report 「不屈盟约效果高台干员也错误的吃到了」). Game data words the deploy class this way (this mode's map card
// 「可以部署高台干员和地面干员的地面」, 「可将高台干员部署于其上」, 「所有地面干员阻挡数+2」); PRTS corrected 琴柳's 地面干员 to
// 地面位干员. The three effects worded 地面干员 — 不屈 (both lines), the 战栗维式重锤 proc and 休谟斯 回收利用 — read
// support isGroundOp = def.position MELEE: 歌蕾蒂娅 on a 高台 counts, a ranged operator on a melee tile does not.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { makeBattle, chessRec, enemyRec, checkInvariants } from '../helpers/battleHarness.js';
import { isGroundOp } from '../../server/sim/content/support/index.js';
const close = (a, b, msg, eps = 1e-6) => assert.ok(Math.abs(a - b) <= eps, `${msg}: ${a} ≠ ${b}`);
const RANGE5 = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4]];
const op = (id, o = {}) => chessRec({
id, profession: o.profession ?? 'WARRIOR', bonds: o.bonds ?? [], rangeGrid: RANGE5,
stats: { maxHp: 2000, atk: 500, def: 200, res: 10, aspd: 100, bat: 1, respawnTime: 20, spRecovery: 1, blockCnt: 2 },
skill: { spCost: 60, duration: 5, initSp: 0 },
});
const DUMMY = enemyRec({ key: 'e_d', hp: 1e7, speed: 0 });
function forceRng(h, v) { const orig = h.b.rng; h.b.rng = Object.assign(() => v, orig); }
// act2autochess_m01 (战场#01(下半)): (9,4) a melee tile on the road, (10,4) a 高台
const PROVENCE = 'chess_char_1_07_a'; // 普罗旺斯 狙击 RANGED, 不屈
const GLADIIA = 'chess_char_4_12_a'; // 歌蕾蒂娅 钩索师 MELEE (placement 'all': may stand on a 高台)
const CUORA = 'chess_char_3_16_a'; // 蛇屠箱: takes the tier-2 SP
const INDOM = { indomShip: { count: 3, active: true, tier: 2, layers: 210 } }; // p = min(1, 0.18 + 0.004 × 210) = 1
test('不屈 (real chess): 歌蕾蒂娅 knocked out on a 高台 is back at once with the tier-2 SP; 普罗旺斯 on a melee tile stays down', () => {
const run = (id, row, col) => {
const h = makeBattle({
stageId: 'act2autochess_m01', seed: 4, timeLimit: 60, autoFinish: false, bonds: INDOM,
units: [{ chessId: id, row, col, dir: 'RIGHT' }, { chessId: CUORA, row: 12, col: 6, dir: 'RIGHT' }],
});
h.step(2);
const u = h.unit(id), other = h.unit(CUORA);
const sp0 = other.skill.sp;
h.b.kill(u, null);
const back = u.alive && u.deployed;
const sp = other.skill.sp - sp0;
checkInvariants(h.b);
return { u, back, sp };
};
const g = run(GLADIIA, 10, 4);
assert.equal(g.u.ground, false, '歌蕾蒂娅 stands on the 高台');
assert.equal(g.u.def.position, 'MELEE');
assert.ok(isGroundOp(g.u), 'a 地面干员 up there');
assert.ok(g.back, '不屈 brings her back at once');
close(g.sp, 5, '不屈 tier 2: every operator on the field +5 SP');
const p = run(PROVENCE, 9, 4);
assert.equal(p.u.ground, true, '普罗旺斯 stands on a melee tile');
assert.ok(!isGroundOp(p.u), 'not a 地面干员');
assert.ok(!p.back, '不屈 does not bring a ranged operator back');
close(p.sp, 0, 'no tier-2 SP for her knock-out');
const g2 = run(GLADIIA, 9, 4);
assert.ok(g2.back && g2.sp === 5, '歌蕾蒂娅 on the ground: as before');
});
test('战栗维式重锤: the 战栗 proc takes a melee carrier on a 高台, never a ranged carrier on a melee tile', () => {
const ops = { t_m: op('t_m', { bonds: ['victoriaShip'] }), t_r: op('t_r', { bonds: ['victoriaShip'], profession: 'SNIPER' }) };
const tremble = (id, row, col) => {
const h = makeBattle({
defs: { chess: ops, enemies: { e_d: DUMMY } }, timeLimit: 999, autoFinish: false,
units: [{ chessId: id, row, col, items: ['chess_item_2_03_e_a'] }], enemies: [{ key: 'e_d', pos: [10, 5] }],
});
forceRng(h, 0.05); // under the 10 % chance
h.runUntil(() => h.hooksOf('attack').length >= 1, 5);
assert.ok(h.hooksOf('attack').length >= 1, `${id} attacked`);
const u = h.unit(id);
return { ground: u.ground, hit: !!h.b.enemies[0].findBuff('tremble') };
};
const m = tremble('t_m', 10, 2);
assert.equal(m.ground, false, 'the melee carrier on the 高台');
assert.ok(m.hit, '战栗 from a melee carrier on a 高台');
const r = tremble('t_r', 10, 4);
assert.equal(r.ground, true, 'the ranged carrier on a melee tile');
assert.ok(!r.hit, 'no 战栗 from a ranged carrier');
});
test('休谟斯 回收利用: a melee operator\'s skill end on a 高台 feeds a neighbour 3 SP; a ranged one\'s on a melee tile does not', () => {
const ops = { t_m: op('t_m'), t_r: op('t_r', { profession: 'SNIPER' }), t_n: op('t_n') };
const recycle = (id, row, col, nRow, nCol) => {
const h = makeBattle({
defs: { chess: ops, enemies: { e_d: DUMMY } }, bandId: 'band_humus', timeLimit: 999, autoFinish: false,
units: [{ chessId: id, row, col }, { chessId: 't_n', row: nRow, col: nCol }],
});
h.step(1);
const u = h.unit(id), n = h.unit('t_n');
const n0 = n.skill.sp;
u.skill.activate('test', { free: true });
u.skill.end('test');
return { ground: u.ground, gain: n.skill.sp - n0 };
};
const m = recycle('t_m', 10, 2, 10, 3);
assert.equal(m.ground, false);
close(m.gain, 3, 'melee on the 高台: neighbour +3');
const r = recycle('t_r', 10, 4, 11, 4);
assert.equal(r.ground, true);
close(r.gain, 0, 'ranged on a melee tile: nothing');
});
@@ -0,0 +1,93 @@
// test/content/feedback3-siracusa-rolls.test.js — 叙拉古 6's true-damage proc rolls on every 普通伤害 hit of a member
// (0.1.3; community report 「叙拉古盟约真伤概率数值没有正确递增成长」, GitHub #79 「咬了一整个技能也没出」). PRTS 盟约记录
// 叙拉古: "※仅在造成普通伤害时尝试…", "每次造成普通伤害时尝试触发"; PRTS 伤害分类: 普通伤害 = attack type NORMAL, the
// default (group damage too unless it is 溅射); 溅射 / 持续 (BUFF) / 附加 (ADDITION) are other types. With the battle rng
// forced to 0 every roll hits, so the procs count the hits that rolled (the PRD rule and the amounts are unchanged).
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { makeBattle, chessRec, enemyRec, checkInvariants } from '../helpers/battleHarness.js';
const L = 20;
const SIRA6 = { siracusaShip: { count: 6, active: true, tier: 2, layers: L } };
const dummy = (key) => enemyRec({ key, hp: 1e9, speed: 0, def: 0, res: 0 });
const ENEMIES = { e_dummy: dummy('e_dummy'), e_dummy2: dummy('e_dummy2') };
function forceRng(h, v) { const orig = h.b.rng; h.b.rng = Object.assign(() => v, orig); }
const isProc = (c) => !!(c.dmg && c.dmg.tags && c.dmg.tags.includes('bond:siracusa'));
const hasTag = (c, t) => !!(c.dmg && c.dmg.tags && c.dmg.tags.includes(t));
test('叙拉古 6: which damage rolls — attacks, skill hits, drone attacks yes; 溅射, 持续, 附加, item procs, element, 无来源 no', () => {
const h = makeBattle({
defs: { chess: { r0_a: chessRec({ id: 'r0_a', bonds: ['siracusaShip'], skill: null }) }, enemies: ENEMIES },
units: [{ chessId: 'r0_a', row: 10, col: 3 }], enemies: [{ key: 'e_dummy', pos: [12, 9] }], // out of her range
bonds: SIRA6, autoFinish: false, timeLimit: 300,
});
h.step(1);
const a = h.unit('r0_a'), e = h.enemies()[0];
assert.ok(a.s.flags.stealth, '隐匿 after the deployment');
forceRng(h, 0);
let procs = 0;
h.b.on('damaged', (c) => { if (isProc(c)) procs++; });
const rolls = (d) => { const n0 = procs; h.b.dealDamage(a, e, { amount: 1, ...d }); return procs - n0; };
const cases = [
['a normal attack', { type: 'phys', isAttack: true }, 1],
['a skill hit (剑雨-like)', { type: 'arts', isSkill: true, tags: ['skill'] }, 1],
['a drone attack (neither attack nor skill)', { type: 'arts', tags: ['droneAttack'] }, 1],
['a module / talent hit with no class', { type: 'arts', tags: ['talent'] }, 1],
['溅射', { type: 'phys', isAttack: true, isSplash: true }, 0],
['持续 (the S3 pulse, 缄默德克萨斯 S1)', { type: 'arts', isSkill: true, tags: ['skill', 'drone', 'dot'] }, 0],
['持续 (periodic)', { type: 'true', canDodge: false, tags: ['dot', 'periodic'] }, 0],
['附加 (拉普兰德 module, 忍冬 追凶)', { type: 'arts', tags: ['module', 'addition'] }, 0],
['an item proc', { type: 'true', canDodge: false, tags: ['item', 'item:pegasus'] }, 0],
['another bond\'s rider', { type: 'true', canDodge: false, tags: ['bond:kazimierz'] }, 0],
['element damage', { type: 'element', element: 'burn' }, 0],
['无来源 damage', { type: 'arts', canDodge: false, sourceless: true }, 0],
];
for (const [label, d, want] of cases) assert.equal(rolls(d), want, label);
checkInvariants(h.b);
});
test('叙拉古 6: 荒芜拉普兰德 S3 — every drone attack rolls, the per-second pulse (持续法术伤害) does not', () => {
const log = [];
const h = makeBattle({
defs: { enemies: ENEMIES }, seed: 7, timeLimit: 120, autoFinish: false, bonds: SIRA6,
units: [{ chessId: 'chess_char_6_18_a', row: 10, col: 3, carryState: { sp: 69 } }],
enemies: [{ key: 'e_dummy', pos: [12, 9] }],
setup(b) { b.on('damaged', (c) => log.push(c), { priority: -999 }); },
});
const u = h.unit('chess_char_6_18_a');
assert.ok(h.runUntil(() => u.skill.active, 10), 'S3 cast');
forceRng(h, 0);
const t0 = h.b.time, from = log.length;
h.run(10);
assert.ok(u.skill.active && u.s.flags.stealth, 'still in S3 and 隐匿');
const mine = log.slice(from).filter((c) => c.source === u);
const drones = mine.filter((c) => hasTag(c, 'droneAttack')).length;
const pulses = mine.filter((c) => hasTag(c, 'drone'));
const procs = mine.filter(isProc).length;
assert.ok(drones >= 5, `drone attacks ${drones}`);
assert.ok(pulses.length >= 5 && pulses.every((c) => hasTag(c, 'dot')), `pulses ${pulses.length}, 持续伤害`);
assert.equal(mine.filter((c) => c.dmg?.isAttack).length, 0, 'no attack of her own during S3');
assert.equal(procs, drones, `one roll per drone attack, none per pulse (t ${t0.toFixed(1)}–${h.b.time.toFixed(1)})`);
checkInvariants(h.b);
});
test('叙拉古 6: 德克萨斯 S2 剑雨 — both hits on every enemy around roll', () => {
const log = [];
const h = makeBattle({
defs: { enemies: ENEMIES }, seed: 3, timeLimit: 60, autoFinish: false, bonds: SIRA6,
units: [{ chessId: 'chess_char_1_08_a', row: 10, col: 3, carryState: { sp: 40 } }],
// inside the skill's diamond, outside her attack range (her tile and the one in front)
enemies: [{ key: 'e_dummy', pos: [10, 5] }, { key: 'e_dummy2', pos: [11, 4] }],
setup(b) { b.on('damaged', (c) => log.push({ c, t: b.time }), { priority: -999 }); },
});
forceRng(h, 0);
const u = h.unit('chess_char_1_08_a');
const rainHit = (x) => x.c.source === u && x.c.dmg?.isSkill && !isProc(x.c);
assert.ok(h.runUntil(() => log.some(rainHit), 5), '剑雨 cast');
const T = log.find(rainHit).t;
const mine = log.filter((x) => x.c.source === u && x.t === T).map((x) => x.c);
assert.equal(mine.filter((c) => c.dmg?.isSkill && !isProc(c)).length, 4, 'two hits on each of the two enemies');
assert.equal(mine.filter((c) => c.dmg?.isAttack).length, 0, 'no attack hit in that tick');
assert.equal(mine.filter(isProc).length, 4, 'every 剑雨 hit rolled (rng 0: each roll hits)');
checkInvariants(h.b);
});