feedback5 O18: 自选 kits for 阿, 傀影 (with his 镜中虚影) and 弑君者
Three owned-6★ 自选 picks get operator kits (kits/ops/op-haak.js, op-phatom.js, op-crosly.js; appended to OPERATOR_KIT_FILES): every skill, both talents, the trait and every module at stage 1 / 3 in every DIY form, from the data, PRTS (备注) and the client's battle logic (charpacks, skill / equip prefabs, buff templates). - 阿: 怪杰 drain (profession default), 混合药物射击 (one of four per attack, GEE-X stage 2+ "all four" roll), 药剂扩散 (healing received, GEE-Y stage 3 deploy heal on the ally ahead), S1 ASPD, S2 / S3 爆发剂 (15 hits of 500 fixed ATK on the ally of his range ahead, then the buff on both), GEE-X SP recovery while HP >= 80 %. - 傀影: S1 dodge + physical-only barrier, S2 stacked ATK used per damage instance, S3 burst (x-4, ground, radial 小力 push, one random status per cast); the twin's kit (its skill copy, killed when he leaves, back on its tile once its own redeploy time has run from its last deployment and he stands, 5 DP), 虚影精通, EXE-X (refund N/A), EXE-Y (lonely ATK, stage 3 ATK on both), ISW-A attributes only. - 弑君者: the smoke's 命中率 cut (x-4, S3 x-1, S2 x2; battle-wide hit handler), 弑君者威名 (fresh ground enemies x1.2, EXE-Y stage 3 x1.35 and stun x1.5), S1 ATK / dodge, S2 no attacks + taunt -1 + end blast, S3 隐匿 + block 0 + 2 s strikes with 6 s marks. Tests: test/content/op_haak.test.js (10), op_phatom.test.js (8), op_crosly.test.js (8). Golden: only diy moved — diy-094..diy-100 field the 78 new configurations (阿 24, 傀影 30, 弑君者 24; no summon is placed by the family), diy-101..diy-104 are the 预备干员 / prototype battles re-packed after them (new index, stage and seed). roster, bonds, fields, matches and standins are unchanged.
This commit is contained in:
1 parent
78251f499c
commit
b55d4f9d04
8 files changed
+1909
-99
No files matched your search
@@ -0,0 +1,302 @@
|
||||
// test/content/op_crosly.test.js — the 自选 operator kit of 弑君者 (char_1502_crosly, 6★ 处决者; kit
|
||||
// server/sim/content/kits/ops/op-crosly.js), fielded the production way (a DIY slot + its `diy` pick, simdata getDiy) in
|
||||
// every form: tiers 5 / 6, normal (E2 Lv1, skill rank 4, no module) and elite (E2 Lv60, rank 7) with no module, EXE-X 弑君刃
|
||||
// or EXE-Y 木炭画 at stage 1 (tier 5) / 3 (tier 6). Every number is read back from data/backups.json (the form of that slot
|
||||
// status); the fidelity checklist of kits/README.md item by item.
|
||||
// Run: node --test test/content/op_crosly.test.js
|
||||
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { makeBattle, enemyRec, checkInvariants } from '../helpers/battleHarness.js';
|
||||
import { KITTED_CHARS, OPERATOR_KITS, KITS } from '../../server/sim/content/kits/index.js';
|
||||
import { diyPool, validateDiyPicks } from '../../shared/diy.js';
|
||||
|
||||
const load = (f) => JSON.parse(readFileSync(new URL(`../../data/${f}.json`, import.meta.url), 'utf8'));
|
||||
const CHESS = load('chess');
|
||||
const BACKUPS = load('backups');
|
||||
const CROSLY = 'char_1502_crosly';
|
||||
const FORMS = BACKUPS.units[CROSLY].forms;
|
||||
const SLOT = { 5: 'chess_char_5_diy1_a', 6: 'chess_char_6_diy1_a' };
|
||||
const EX = 'uniequip_002_crosly', EY = 'uniequip_003_crosly';
|
||||
const S1 = 'skchr_crosly_1', S2 = 'skchr_crosly_2', S3 = 'skchr_crosly_3';
|
||||
const YAK = 'chess_char_1_02_a', TEXAS = 'chess_char_1_08_a';
|
||||
const formOf = (tier, elite) => FORMS[elite ? (tier === 5 ? '2/60/7/1' : '2/60/7/3') : '2/1/4/0'];
|
||||
const skillOf = (tier, elite, id) => formOf(tier, elite).skills.find((s) => s.skillId === id);
|
||||
const modOf = (tier, mod) => (mod ? formOf(tier, true).modules.find((m) => m.uniEquipId === mod) : null);
|
||||
/** The talents a form fights with: the module's changes composed (index 0 / 1, −1 = hidden). */
|
||||
const talentOf = (tier, elite, mod, i) => {
|
||||
const base = formOf(tier, elite).talents.find((t) => t.index === i)?.bb ?? {};
|
||||
const ch = (elite ? modOf(tier, mod)?.talentChanges ?? [] : []).find((t) => t.talentIndex === i)?.bb ?? {};
|
||||
return { ...base, ...ch };
|
||||
};
|
||||
const approx = (a, b, msg, eps = 1e-6) => assert.ok(Math.abs(a - b) <= eps * Math.max(1, Math.abs(b)), `${msg}: ${a} vs ${b}`);
|
||||
const dummy = (key, o = {}) => enemyRec({ key, hp: 1e9, speed: 0, mass: 0, ...o });
|
||||
const ENEMIES = {
|
||||
enemy_dummy: dummy('enemy_dummy'), enemy_fly: dummy('enemy_fly', { motion: 'FLY' }),
|
||||
enemy_hitter: dummy('enemy_hitter', { atk: 200, range: 1.5, bat: 0.5 }), enemy_caster: dummy('enemy_caster', { atk: 200, range: 1.5, bat: 0.5, dmgType: 'arts' }),
|
||||
enemy_flyhitter: dummy('enemy_flyhitter', { atk: 200, range: 1.5, bat: 0.5, motion: 'FLY' }),
|
||||
};
|
||||
/** Every 自选 form: [tier, elite, module]. */
|
||||
const FORMS_ALL = [[5, false, null], [6, false, null], ...[5, 6].flatMap((t) => [null, EX, EY].map((m) => [t, true, m]))];
|
||||
const label = ([tier, elite, mod]) => `T${tier} ${elite ? 'elite' : 'normal'} ${mod ?? 'none'}`;
|
||||
|
||||
/** A battle with 弑君者 as uid 1 at (row, col) facing RIGHT, plus `others`. */
|
||||
function field({ tier = 5, elite = false, mod = null, skill = 0, row = 10, col = 4, others = [], seed = 5 } = {}) {
|
||||
const h = makeBattle({
|
||||
defs: { enemies: ENEMIES }, timeLimit: 900, autoFinish: false, seed,
|
||||
flags: { dpPerSec: 0, dpMax: 999 }, hooks: ['damaged', 'skillStart', 'skillEnd', 'statusApplied', 'death'], captureNoisy: true,
|
||||
units: [{ uid: 1, diy: { slot: SLOT[tier], charId: CROSLY, skillIndex: skill, uniEquipId: mod }, elite, row, col }, ...others],
|
||||
});
|
||||
h.step();
|
||||
return { h, u: h.unit(1) };
|
||||
}
|
||||
function done(h) {
|
||||
checkInvariants(h.b);
|
||||
assert.equal(h.b.errors.length, 0, JSON.stringify(h.b.errors[0]));
|
||||
}
|
||||
/** Knock `u` out and bring it straight back on its tile (free). */
|
||||
function redeployNow(h, u) {
|
||||
h.b.kill(u, null);
|
||||
assert.ok(h.b.redeploy(u, { free: true }), `${u.name} redeployed`);
|
||||
}
|
||||
/**
|
||||
* Watch the 命中率 cut `hitter` suffers from now on: its attacks counted before (priority 295) and after (270) the smoke's
|
||||
* handler (280); allies are kept alive. Returns () => { n, rate }.
|
||||
*/
|
||||
function watch(h, hitter) {
|
||||
const seen = new Set(), passed = new Set();
|
||||
h.b.on('hit', (c) => { if (c.source === hitter && c.dmg.isAttack) seen.add(c.dmg.attackId); }, { priority: 295 });
|
||||
h.b.on('hit', (c) => { if (c.source === hitter && c.dmg.isAttack && !c.dmg.cancel) passed.add(c.dmg.attackId); }, { priority: 270 });
|
||||
h.b.on('fatal', (c) => { if (c.unit.side === 'ally') c.prevented = true; });
|
||||
return () => ({ n: seen.size, rate: seen.size ? 1 - passed.size / seen.size : 0 });
|
||||
}
|
||||
|
||||
test('弑君者 in every 自选 form: her operator kit (all three skills authored), the form\'s stats + module attributes, 1-1, melee ground-only, 22 s redeploy, 叙拉古, no 特质; each skill a timed deployment skill (被动 ON_DEPLOY), running from the deployment', () => {
|
||||
assert.equal(OPERATOR_KITS[CROSLY], KITS[CROSLY]);
|
||||
for (const f of FORMS_ALL) {
|
||||
const [tier, elite, mod] = f;
|
||||
for (const skill of [0, 1, 2]) {
|
||||
const { h, u } = field({ tier, elite, mod, skill });
|
||||
const form = formOf(tier, elite), m = elite ? modOf(tier, mod) : null, rec = form.skills[skill];
|
||||
assert.deepEqual([u.def.charId, u.def.diyFor, u.skill.id, !!u.kit.generic, u.kit.skillSource], [CROSLY, SLOT[tier], rec.skillId, false, 'skills'], label(f));
|
||||
assert.deepEqual([u.base.maxHp, u.base.atk, u.base.def, u.base.respawnTime, u.base.cost],
|
||||
[form.stats.maxHp + (m?.attr.maxHp ?? 0), form.stats.atk + (m?.attr.atk ?? 0), form.stats.def + (m?.attr.def ?? 0), 22, 12], `${label(f)}: stats`);
|
||||
assert.deepEqual([u.profile.attack, u.profile.dmgType, u.profile.canHitFly], ['melee', 'phys', false], `${label(f)}: 处决者`);
|
||||
assert.deepEqual(u.liveRangeGrid, form.rangeGrid, `${label(f)}: 1-1 (S3 too)`);
|
||||
assert.deepEqual([u.def.bonds, u.def.raw.garrisonIds], [['siracusaShip'], []], `${label(f)}: bonds / 特质`);
|
||||
assert.deepEqual([rec.skillType, rec.spType, u.skill.kind, u.skill.rule, u.skill.active, u.skill.activations], ['PASSIVE', 'ON_DEPLOY', 'duration', 'NEVER', true, 1], `${label(f)}: S${skill + 1} from the deployment`);
|
||||
approx(u.skill.timeLeft, [rec.duration, rec.bb.duration, rec.duration][skill], `${label(f)}: S${skill + 1} duration`, 0.01);
|
||||
assert.equal(u.s.blockCnt, skill === 2 ? 0 : 1, `${label(f)}: blocks ${skill === 2 ? 0 : 1}`);
|
||||
done(h);
|
||||
}
|
||||
}
|
||||
// the numbers (zh_CN): E2 Lv1 1322 / 425 / 273, E2 Lv60 1569 / 505 / 307; EXE-X +90 / +34 / +23 → +130 / +45 / +30,
|
||||
// EXE-Y +84 / +63 → +135 / +88 HP / ATK
|
||||
assert.deepEqual([FORMS['2/1/4/0'].stats.maxHp, FORMS['2/1/4/0'].stats.atk, FORMS['2/60/7/1'].stats.maxHp, FORMS['2/60/7/1'].stats.atk], [1322, 425, 1569, 505]);
|
||||
assert.deepEqual([modOf(5, EX).attr, modOf(6, EX).attr, modOf(5, EY).attr, modOf(6, EY).attr],
|
||||
[{ maxHp: 90, atk: 34, def: 23 }, { maxHp: 130, atk: 45, def: 30 }, { maxHp: 84, atk: 63 }, { maxHp: 135, atk: 88 }]);
|
||||
});
|
||||
|
||||
test('a 自选 pick: 弑君者 is offered at tiers 5 and 6 (she has a kit) and a roster with her passes validateDiyPicks', () => {
|
||||
const data = { chess: CHESS, backups: BACKUPS };
|
||||
assert.ok(KITTED_CHARS.includes(CROSLY));
|
||||
for (const t of [5, 6]) assert.ok(diyPool(t, { data, kitted: KITTED_CHARS }).includes(CROSLY), `tier ${t}`);
|
||||
assert.deepEqual(validateDiyPicks({ [SLOT[5]]: { charId: CROSLY, skillIndex: 2, uniEquipId: EY } }, { data, kitted: KITTED_CHARS }),
|
||||
{ ok: true, picks: { [SLOT[5]]: { charId: CROSLY, skillIndex: 2, uniEquipId: EY } } });
|
||||
});
|
||||
|
||||
test('S1 尘烟蔽目 (被动): for 10 s from each deployment ATK +65 % / +80 % and 30 % / 40 % physical and arts dodge', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, EX]]) {
|
||||
const sk = skillOf(tier, elite, S1);
|
||||
assert.deepEqual([sk.duration, sk.bb.atk, sk.bb.prob], [10, elite ? 0.8 : 0.65, elite ? 0.4 : 0.3]);
|
||||
const { h, u } = field({ tier, elite, mod, skill: 0 });
|
||||
approx(u.s.atk, u.base.atk * (1 + sk.bb.atk), 'ATK');
|
||||
assert.deepEqual([u.s.dodgePhys, u.s.dodgeArts], [sk.bb.prob, sk.bb.prob], 'dodge');
|
||||
h.run(10.1);
|
||||
assert.deepEqual([u.skill.active, u.s.atk, u.s.dodgePhys, u.s.dodgeArts], [false, u.base.atk, 0, 0], 'over');
|
||||
redeployNow(h, u);
|
||||
assert.ok(u.skill.active && u.skill.activations === 2, 'again at a redeployment');
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S2 硝烟震爆 (被动): for 8 s no attacks and taunt level −1; then 270 % / 350 % ATK physical to every ground enemy of the x-4 smoke (fresh ones ×T2); no blast when she is stunned as it ends', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, EY]]) {
|
||||
const sk = skillOf(tier, elite, S2), t1 = talentOf(tier, elite, mod, 1);
|
||||
assert.deepEqual([sk.bb.duration, sk.bb.taunt_level, sk.bb['attack@atk_scale_s2'], sk.bb.talent_scale], [8, -1, elite ? 3.5 : 2.7, 2]);
|
||||
const { h, u } = field({ tier, elite, mod, skill: 1 });
|
||||
assert.equal(u.s.taunt, -1, 'taunt level −1');
|
||||
const front = h.spawn('enemy_dummy', { pos: [10, 5] }), diag = h.spawn('enemy_dummy', { pos: [11, 3] });
|
||||
const marked = h.spawn('enemy_dummy', { pos: [9, 4] });
|
||||
const fly = h.spawn('enemy_fly', { pos: [9, 5] }), far = h.spawn('enemy_dummy', { pos: [10, 6] });
|
||||
h.step();
|
||||
h.b.dealDamage(marked, u, { amount: 1, type: 'phys', canDodge: false }); // it has damaged her
|
||||
h.run(7);
|
||||
assert.equal(h.hooksOf('damaged').filter((c) => c.source === u).length, 0, 'no attacks while it runs');
|
||||
assert.ok(h.runUntil(() => !u.skill.active, 2), 'over after 8 s');
|
||||
const blast = h.hooksOf('damaged').filter((c) => c.source === u && c.dmg?.tags?.includes('crosly:blast'));
|
||||
assert.deepEqual(blast.map((c) => c.target).sort((a, b) => a.id - b.id), [front, diag, marked].sort((a, b) => a.id - b.id), 'the ground enemies of her x-4');
|
||||
for (const c of blast) {
|
||||
approx(c.amount, u.s.atk * sk.bb['attack@atk_scale_s2'] * (c.target === marked ? 1 : t1.damage_scale), `${c.target === marked ? 'marked' : 'fresh'}: ${sk.bb['attack@atk_scale_s2'] * 100} %`);
|
||||
assert.deepEqual([c.type, c.dmg.isSkill], ['phys', true]);
|
||||
}
|
||||
assert.ok(!blast.some((c) => c.target === fly || c.target === far), 'flyer / outside untouched');
|
||||
assert.equal(u.s.taunt, 0, 'taunt back');
|
||||
// stunned as it ends: no blast
|
||||
redeployNow(h, u);
|
||||
h.run(7.5);
|
||||
h.b.applyStatus(u, 'stun', { duration: 2, force: true });
|
||||
const n0 = h.hooksOf('damaged').length;
|
||||
h.run(1);
|
||||
assert.ok(!u.skill.active, 'ended');
|
||||
assert.equal(h.hooksOf('damaged').slice(n0).filter((c) => c.dmg?.tags?.includes('crosly:blast')).length, 0, 'stunned: no blast');
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S3 烽烟行刑场 (被动, 16 s): 隐匿 and block count 0 (enemies neither target nor are blocked by her); a strike every 2 s on one unmarked ground enemy of the x-1 — 2 hits × 150 % / 190 % ATK and 晕眩 1.5 s — marking it 6 s; her range stays 1-1; all back after', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, EX]]) {
|
||||
const sk = skillOf(tier, elite, S3), t1 = talentOf(tier, elite, mod, 1);
|
||||
assert.deepEqual([sk.duration, sk.rangeId, sk.bb['attack@s3_cd'], sk.bb['attack@times'], sk.bb['attack@atk_scale_s3'], sk.bb['attack@stun'], sk.bb.mark_duration],
|
||||
[16, 'x-1', 2, 2, elite ? 1.9 : 1.5, 1.5, 6]);
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2 });
|
||||
assert.deepEqual([!!u.s.flags.stealth, u.s.blockCnt, u.liveRangeGrid], [true, 0, formOf(tier, elite).rangeGrid], '隐匿, block 0, 1-1');
|
||||
const a = h.spawn('enemy_dummy', { pos: [10, 5] }), b = h.spawn('enemy_dummy', { pos: [12, 4] }), c = h.spawn('enemy_dummy', { pos: [10, 6] });
|
||||
const fly = h.spawn('enemy_fly', { pos: [9, 4] }), far = h.spawn('enemy_dummy', { pos: [10, 7] });
|
||||
const hitter = h.spawn('enemy_hitter', { pos: [11, 4] });
|
||||
h.run(15.5);
|
||||
const hits = h.hooksOf('damaged').filter((x) => x.source === u && x.dmg?.isAttack);
|
||||
assert.equal(hits.length % 2, 0, 'two hits a strike');
|
||||
const strikes = [];
|
||||
for (const x of hits) if (!strikes.length || Math.abs(strikes[strikes.length - 1].t - x.t) > 1e-6) strikes.push({ t: x.t, target: x.target });
|
||||
assert.ok(strikes.length >= 7, `${strikes.length} strikes`);
|
||||
for (let i = 1; i < strikes.length; i++) approx(strikes[i].t - strikes[i - 1].t, 2, 'every 2 s', 0.02);
|
||||
assert.ok(hits.every((x) => [a, b, c, hitter].includes(x.target)), 'unmarked ground enemies of the x-1 only (no flyer, nothing 3 tiles away)');
|
||||
assert.ok(!hits.some((x) => x.target === fly || x.target === far));
|
||||
for (const x of hits) {
|
||||
assert.deepEqual([x.type, x.dmg.isSkill], ['phys', true]);
|
||||
approx(x.amount, u.s.atk * sk.bb['attack@atk_scale_s3'] * t1.damage_scale, `${sk.bb['attack@atk_scale_s3'] * 100} % ×T2 (fresh)`);
|
||||
}
|
||||
// the 6 s mark: never the same target twice within 6 s
|
||||
const last = new Map();
|
||||
for (const st of strikes) {
|
||||
if (last.has(st.target)) assert.ok(st.t - last.get(st.target) >= 6 - 1e-6, `marked 6 s (${st.target.defId})`);
|
||||
last.set(st.target, st.t);
|
||||
}
|
||||
const stuns = h.hooksOf('statusApplied').filter((x) => x.source === u && x.status === 'stun');
|
||||
assert.equal(stuns.length, strikes.length, 'one 晕眩 a strike');
|
||||
for (const x of stuns) approx(x.duration, sk.bb['attack@stun'], '1.5 s');
|
||||
assert.equal(h.hooksOf('damaged').filter((x) => x.source === hitter && x.target === u).length, 0, '隐匿: the hitter beside her never targets her');
|
||||
assert.equal(u.blocking.length, 0, 'blocks nothing');
|
||||
h.run(1);
|
||||
assert.deepEqual([u.skill.active, !!u.s.flags.stealth, u.s.blockCnt], [false, false, 1], 'all back after 16 s');
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('T1 吞咽苦厄: while her skill runs, the attacks of ground enemies in her smoke miss 20 % (EXE-X stage 3: 25 %; S2: ×2) — x-4, S3 x-1; none outside it, none for air units, none once the skill is over', () => {
|
||||
// S1, normal: a hitter in her x-4 (beside her) — 20 %; another two tiles ahead — 0 %
|
||||
{
|
||||
const t0 = talentOf(5, false, null, 0);
|
||||
assert.deepEqual([t0.damage_hitrate_physical, t0.damage_hitrate_magical], [-0.2, -0.2]);
|
||||
const { h, u } = field({ tier: 5, skill: 0, others: [{ uid: 2, chessId: YAK, row: 10, col: 7 }] });
|
||||
const inside = h.spawn('enemy_caster', { pos: [11, 4] }), outside = h.spawn('enemy_hitter', { pos: [10, 6] });
|
||||
u.skill.extend(400);
|
||||
const wIn = watch(h, inside), wOut = watch(h, outside);
|
||||
h.run(300);
|
||||
const rIn = wIn(), rOut = wOut();
|
||||
assert.ok(rIn.n > 300 && Math.abs(rIn.rate - 0.2) < 0.05, `arts attacker in the x-4: ${rIn.rate} of ${rIn.n}`);
|
||||
assert.ok(rOut.n > 300 && rOut.rate === 0, `two tiles ahead: ${rOut.rate} of ${rOut.n}`);
|
||||
u.skill.extend(-999);
|
||||
h.step(2);
|
||||
const wAfter = watch(h, inside);
|
||||
h.run(60);
|
||||
const after = wAfter();
|
||||
assert.ok(after.n > 60 && after.rate === 0, 'skill over: no smoke');
|
||||
done(h);
|
||||
}
|
||||
// S2 at EXE-X stage 3: 25 % × 2
|
||||
{
|
||||
const t0 = talentOf(6, true, EX, 0);
|
||||
assert.equal(t0.damage_hitrate_physical, -0.25);
|
||||
const { h, u } = field({ tier: 6, elite: true, mod: EX, skill: 1 });
|
||||
const hitter = h.spawn('enemy_hitter', { pos: [10, 5] });
|
||||
const fly = h.spawn('enemy_flyhitter', { pos: [9, 4] });
|
||||
u.skill.extend(400);
|
||||
const w = watch(h, hitter), wFly = watch(h, fly);
|
||||
h.run(300);
|
||||
const r = w(), rFly = wFly();
|
||||
assert.ok(r.n > 300 && Math.abs(r.rate - 0.5) < 0.05, `S2 ×2: ${r.rate} of ${r.n}`);
|
||||
assert.ok(rFly.n > 300 && rFly.rate === 0, `an air unit in the smoke: ${rFly.rate} of ${rFly.n}`);
|
||||
done(h);
|
||||
}
|
||||
// S3: the x-1 reaches two tiles ahead
|
||||
{
|
||||
const { h, u } = field({ tier: 5, skill: 2, others: [{ uid: 2, chessId: YAK, row: 10, col: 7 }] });
|
||||
const hitter = h.spawn('enemy_hitter', { pos: [10, 6] });
|
||||
u.skill.extend(400);
|
||||
const w = watch(h, hitter);
|
||||
h.run(300);
|
||||
const r = w();
|
||||
assert.ok(r.n > 150 && Math.abs(r.rate - 0.2) < 0.06, `S3 x-1: ${r.rate} of ${r.n}`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('T2 弑君者威名: physical damage she deals to a ground enemy that has not damaged her this deployment ×1.2 (EXE-Y stage 3: ×1.35, and her 晕眩 on it ×1.5); a 持续伤害 tick marks nothing; the marks go when she leaves the field', () => {
|
||||
for (const f of [[5, false, null], [6, true, EY], [5, true, EY]]) {
|
||||
const [tier, elite, mod] = f;
|
||||
const t1 = talentOf(tier, elite, mod, 1), hidden = talentOf(tier, elite, mod, -1);
|
||||
const y3 = elite && mod === EY && tier === 6;
|
||||
assert.deepEqual([t1.damage_scale, hidden.one_minus_status_resistance ?? 0], y3 ? [1.35, 0.5] : [1.2, 0], label(f));
|
||||
const { h, u } = field({ tier, elite, mod, skill: 0 });
|
||||
h.run(10.1); // S1 over: plain attacks
|
||||
const e = h.spawn('enemy_dummy', { pos: [10, 5] });
|
||||
const hitsOn = () => h.hooksOf('damaged').filter((c) => c.source === u && c.target === e && c.dmg?.isAttack);
|
||||
h.run(2);
|
||||
approx(hitsOn().slice(-1)[0].amount, u.s.atk * t1.damage_scale, `${label(f)}: fresh ×${t1.damage_scale}`);
|
||||
h.b.dealDamage(e, u, { amount: 5, type: 'true', canDodge: false, tags: ['dot'] });
|
||||
h.run(2);
|
||||
approx(hitsOn().slice(-1)[0].amount, u.s.atk * t1.damage_scale, `${label(f)}: a DoT tick marks nothing`);
|
||||
h.b.dealDamage(e, u, { amount: 5, type: 'phys', canDodge: false });
|
||||
h.run(2);
|
||||
approx(hitsOn().slice(-1)[0].amount, u.s.atk, `${label(f)}: it damaged her ⇒ ×1`);
|
||||
// EXE-Y stage 3: a stun of hers lasts ×1.5 on a fresh enemy only
|
||||
const fresh = h.spawn('enemy_dummy', { pos: [9, 5] });
|
||||
h.b.applyStatus(fresh, 'stun', { duration: 2, source: u });
|
||||
h.b.applyStatus(e, 'stun', { duration: 2, source: u });
|
||||
const st = h.hooksOf('statusApplied').filter((c) => c.source === u && c.status === 'stun').slice(-2);
|
||||
approx(st[0].duration, y3 ? 3 : 2, `${label(f)}: fresh ×${y3 ? 1.5 : 1}`);
|
||||
approx(st[1].duration, 2, `${label(f)}: marked ×1`);
|
||||
// her redeployment clears the marks
|
||||
redeployNow(h, u);
|
||||
h.run(10.1);
|
||||
h.run(2);
|
||||
approx(hitsOn().slice(-1)[0].amount, u.s.atk * t1.damage_scale, `${label(f)}: fresh again after a redeployment`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('EXE-X 弑君刃: the refund has no effect (no retreat in battle); EXE-Y 木炭画: ATK +10 % while no allied operator stands on the 4 tiles beside her (stages 1 and 3)', () => {
|
||||
{
|
||||
const { h, u } = field({ tier: 6, elite: true, mod: EX, skill: 0 });
|
||||
assert.deepEqual(u.def.traitBb, { withdraw_cost_recover_ratio: 0.8 });
|
||||
h.b.players[0].dp = 3;
|
||||
h.b.retreat(u);
|
||||
h.step();
|
||||
assert.equal(h.b.players[0].dp, 3, 'no refund');
|
||||
done(h);
|
||||
}
|
||||
for (const f of [[5, true, EY], [6, true, EY], [6, true, EX]]) {
|
||||
const [tier, elite, mod] = f;
|
||||
const { h, u } = field({ tier, elite, mod, skill: 1, others: [{ uid: 2, chessId: TEXAS, row: 12, col: 7 }] });
|
||||
const texas = h.unit(2);
|
||||
assert.equal(!!u.findBuff('trait:crosly:lonely'), mod === EY, `${label(f)}: alone`);
|
||||
if (mod === EY) approx(u.s.atk, u.base.atk * 1.1, `${label(f)}: ATK +10 %`);
|
||||
assert.ok(h.b.relocate(texas, 10, 5));
|
||||
h.step();
|
||||
assert.equal(u.findBuff('trait:crosly:lonely'), null, `${label(f)}: an operator beside her`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,293 @@
|
||||
// test/content/op_haak.test.js — the 自选 operator kit of 阿 (char_225_haak, 6★ 怪杰; kit
|
||||
// server/sim/content/kits/ops/op-haak.js), fielded the production way (a DIY slot + its `diy` pick, simdata getDiy) in
|
||||
// every form: tiers 5 / 6, normal (E2 Lv1, skill rank 4, no module) and elite (E2 Lv60, rank 7) with no module, GEE-X
|
||||
// 什锦果味医用箱 or GEE-Y 毒医残章 at stage 1 (tier 5) / 3 (tier 6). Every number is read back from data/backups.json (the
|
||||
// form of that slot status); the fidelity checklist of kits/README.md item by item.
|
||||
// Run: node --test test/content/op_haak.test.js
|
||||
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { makeBattle, enemyRec, checkInvariants } from '../helpers/battleHarness.js';
|
||||
import { KITTED_CHARS, OPERATOR_KITS, KITS } from '../../server/sim/content/kits/index.js';
|
||||
import { diyPool, validateDiyPicks } from '../../shared/diy.js';
|
||||
|
||||
const load = (f) => JSON.parse(readFileSync(new URL(`../../data/${f}.json`, import.meta.url), 'utf8'));
|
||||
const CHESS = load('chess');
|
||||
const BACKUPS = load('backups');
|
||||
const HAAK = 'char_225_haak';
|
||||
const FORMS = BACKUPS.units[HAAK].forms;
|
||||
const SLOT = { 5: 'chess_char_5_diy1_a', 6: 'chess_char_6_diy1_a' };
|
||||
const GX = 'uniequip_002_haak', GY = 'uniequip_003_haak';
|
||||
const S1 = 'skchr_haak_1', S2 = 'skchr_haak_2', S3 = 'skchr_haak_3';
|
||||
const YAK = 'chess_char_1_02_a', TEXAS = 'chess_char_1_08_a', LISKAM = 'chess_char_1_20_a';
|
||||
const formOf = (tier, elite) => FORMS[elite ? (tier === 5 ? '2/60/7/1' : '2/60/7/3') : '2/1/4/0'];
|
||||
const skillOf = (tier, elite, id) => formOf(tier, elite).skills.find((s) => s.skillId === id);
|
||||
const modOf = (tier, mod) => (mod ? formOf(tier, true).modules.find((m) => m.uniEquipId === mod) : null);
|
||||
/** The talents a form fights with: the module's changes composed (index 0 / 1). */
|
||||
const talentOf = (tier, elite, mod, i) => {
|
||||
const base = formOf(tier, elite).talents.find((t) => t.index === i)?.bb ?? {};
|
||||
const ch = (elite ? modOf(tier, mod)?.talentChanges ?? [] : []).find((t) => t.talentIndex === i)?.bb ?? {};
|
||||
return { ...base, ...ch };
|
||||
};
|
||||
const approx = (a, b, msg, eps = 1e-6) => assert.ok(Math.abs(a - b) <= eps * Math.max(1, Math.abs(b)), `${msg}: ${a} vs ${b}`);
|
||||
const dummy = (key, o = {}) => enemyRec({ key, hp: 1e9, speed: 0, mass: 0, ...o });
|
||||
const ENEMIES = { enemy_dummy: dummy('enemy_dummy'), enemy_fly: dummy('enemy_fly', { motion: 'FLY' }) };
|
||||
/** Every 自选 form: [tier, elite, module]. */
|
||||
const FORMS_ALL = [[5, false, null], [6, false, null], ...[5, 6].flatMap((t) => [null, GX, GY].map((m) => [t, true, m]))];
|
||||
const label = ([tier, elite, mod]) => `T${tier} ${elite ? 'elite' : 'normal'} ${mod ?? 'none'}`;
|
||||
|
||||
/** A battle with 阿 as uid 1 at (row, col) facing RIGHT, plus `others`. */
|
||||
function field({ tier = 5, elite = false, mod = null, skill = 0, row = 10, col = 4, others = [], seed = 5 } = {}) {
|
||||
const h = makeBattle({
|
||||
defs: { enemies: ENEMIES }, timeLimit: 900, autoFinish: false, seed,
|
||||
flags: { dpPerSec: 0, dpMax: 999 }, hooks: ['damaged', 'skillStart', 'skillEnd', 'statusApplied', 'heal', 'spGain'], captureNoisy: true,
|
||||
units: [{ uid: 1, diy: { slot: SLOT[tier], charId: HAAK, skillIndex: skill, uniEquipId: mod }, elite, row, col }, ...others],
|
||||
});
|
||||
h.step();
|
||||
return { h, u: h.unit(1) };
|
||||
}
|
||||
const atkHits = (h, u) => h.hooksOf('damaged').filter((c) => c.source === u && c.dmg?.isAttack);
|
||||
function done(h) {
|
||||
checkInvariants(h.b);
|
||||
assert.equal(h.b.errors.length, 0, JSON.stringify(h.b.errors[0]));
|
||||
}
|
||||
/** Keep him from casting (no SP). */
|
||||
function noSkill(h, u) {
|
||||
u.skill.charges = 0; u.skill.sp = 0;
|
||||
h.b.addBuff(u, { key: 'test:noSp', flags: { noSp: true } });
|
||||
}
|
||||
|
||||
test('阿 in every 自选 form: his operator kit (all three skills authored), the form\'s stats + module attributes, 3-3, blocks 1, ranged physical arrows that hit air units, the 怪杰 drain, 炎, no 特质, the data triggers', () => {
|
||||
assert.equal(OPERATOR_KITS[HAAK], KITS[HAAK]);
|
||||
for (const f of FORMS_ALL) {
|
||||
const [tier, elite, mod] = f;
|
||||
for (const skill of [0, 1, 2]) {
|
||||
const { h, u } = field({ tier, elite, mod, skill });
|
||||
const form = formOf(tier, elite), m = elite ? modOf(tier, mod) : null;
|
||||
assert.deepEqual([u.def.charId, u.def.diyFor, u.skill.id, !!u.kit.generic, u.kit.skillSource], [HAAK, SLOT[tier], form.skills[skill].skillId, false, 'skills'], label(f));
|
||||
assert.deepEqual([u.base.maxHp, u.base.atk, u.base.def, u.base.aspd, u.base.respawnTime],
|
||||
[form.stats.maxHp + (m?.attr.maxHp ?? 0), form.stats.atk + (m?.attr.atk ?? 0), form.stats.def, 100 + (m?.attr.aspd ?? 0), 70 + (m?.attr.respawnTime ?? 0)], `${label(f)}: stats`);
|
||||
assert.deepEqual([u.s.blockCnt, u.profile.attack, u.profile.dmgType, u.profile.canHitFly, u.profile.projectile, u.profile.hpDrain], [1, 'ranged', 'phys', true, 'arrow', 0.01], `${label(f)}: 怪杰`);
|
||||
assert.deepEqual(u.liveRangeGrid, form.rangeGrid, `${label(f)}: 3-3`);
|
||||
assert.equal(form.rangeId, '3-3');
|
||||
assert.deepEqual([u.def.bonds, u.def.raw.garrisonIds], [['yanShip'], []], `${label(f)}: bonds / 特质`);
|
||||
assert.ok(!u.s.flags.liftoff && !u.s.flags.camou && !u.s.flags.stealth, `${label(f)}: ground enemies target him`);
|
||||
assert.deepEqual([u.skill.kind, u.skill.rule, form.skills[skill].trigger.rule], ['duration', 'DEFAULT', 'DEFAULT'], `${label(f)}: S${skill + 1} trigger (data)`);
|
||||
done(h);
|
||||
}
|
||||
}
|
||||
// the numbers of the forms (zh_CN): E2 Lv1 1627 / 583 / 121, E2 Lv60 1897 / 663 / 142; GEE-X +135 / +37 → +240 / +57 HP / ATK,
|
||||
// GEE-Y +43 / +3 → +75 / +5 ATK / ASPD and respawn −15
|
||||
assert.deepEqual([FORMS['2/1/4/0'].stats.maxHp, FORMS['2/1/4/0'].stats.atk, FORMS['2/60/7/1'].stats.maxHp, FORMS['2/60/7/1'].stats.atk], [1627, 583, 1897, 663]);
|
||||
assert.deepEqual([modOf(5, GX).attr, modOf(6, GX).attr, modOf(5, GY).attr, modOf(6, GY).attr],
|
||||
[{ maxHp: 135, atk: 37 }, { maxHp: 240, atk: 57 }, { atk: 43, aspd: 3, respawnTime: -15 }, { atk: 75, aspd: 5, respawnTime: -15 }]);
|
||||
});
|
||||
|
||||
test('a 自选 pick: 阿 is offered at tiers 5 and 6 (he has a kit) and a roster with him passes validateDiyPicks', () => {
|
||||
const data = { chess: CHESS, backups: BACKUPS };
|
||||
assert.ok(KITTED_CHARS.includes(HAAK));
|
||||
for (const t of [5, 6]) assert.ok(diyPool(t, { data, kitted: KITTED_CHARS }).includes(HAAK), `tier ${t}`);
|
||||
assert.deepEqual(validateDiyPicks({ [SLOT[6]]: { charId: HAAK, skillIndex: 2, uniEquipId: GY } }, { data, kitted: KITTED_CHARS }),
|
||||
{ ok: true, picks: { [SLOT[6]]: { charId: HAAK, skillIndex: 2, uniEquipId: GY } } });
|
||||
});
|
||||
|
||||
test('trait 怪杰: 1 % of his max HP lost every second (a 流失, never below 1 HP); he shoots an air unit in his range', () => {
|
||||
for (const f of [[5, false, null], [6, true, GX]]) {
|
||||
const { h, u } = field({ tier: f[0], elite: f[1], mod: f[2], skill: 0 });
|
||||
noSkill(h, u);
|
||||
assert.deepEqual(u.def.traitBb, { hp_ratio: 0.01 }, label(f));
|
||||
h.run(3.05);
|
||||
approx(u.hp, u.s.maxHp * (1 - 0.03), `${label(f)}: three ticks of 1 %`, 1e-6);
|
||||
u.hp = 5;
|
||||
h.run(10);
|
||||
assert.equal(u.hp, 1, `${label(f)}: not lethal — 1 HP kept`);
|
||||
assert.ok(u.alive);
|
||||
u.hp = u.s.maxHp;
|
||||
const fly = h.spawn('enemy_fly', { pos: [10, 6] });
|
||||
h.run(3);
|
||||
assert.ok(atkHits(h, u).some((c) => c.target === fly && c.type === 'phys'), `${label(f)}: physical arrows at the flyer`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('GEE-X “什锦果味医用箱” (stages 1 and 3): SP recovery +0.25/s while his HP ratio is at least 80 %, none below; no such bonus without it', () => {
|
||||
for (const f of FORMS_ALL) {
|
||||
const [tier, elite, mod] = f;
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2 });
|
||||
const gx = elite && mod === GX;
|
||||
if (gx) {
|
||||
assert.equal(modOf(tier, GX).traitOverride.moduleDesc, '生命值高于80%时,技力自然回复速度+0.25/秒');
|
||||
assert.deepEqual(modOf(tier, GX).talentChanges.find((t) => t.talentIndex === -1).bb, { sp_recovery_per_sec: 0.25 });
|
||||
}
|
||||
h.step();
|
||||
assert.equal(u.s.spRecovery, gx ? 1.25 : 1, `${label(f)}: full HP`);
|
||||
const sp0 = u.skill.sp;
|
||||
h.run(2);
|
||||
approx(u.skill.sp - sp0, 2 * (gx ? 1.25 : 1), `${label(f)}: SP over 2 s`, 0.02);
|
||||
u.hp = u.s.maxHp * 0.79;
|
||||
h.step();
|
||||
assert.equal(u.s.spRecovery, 1, `${label(f)}: below 80 %`);
|
||||
u.hp = u.s.maxHp * 0.8;
|
||||
h.step();
|
||||
assert.equal(u.s.spRecovery, gx ? 1.25 : 1, `${label(f)}: at 80 %`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('T1 混合药物射击: every attack on an enemy rolls one of four with equal weight — heal 15 % max HP (×T2), that attack ×1.5, 停顿 1.4 s, 晕眩 1 s; GEE-X stage 3: 20 % / ×1.65 / 1.6 s / 1.2 s and 30 % all four at once', () => {
|
||||
for (const f of [[5, false, null], [6, true, null], [5, true, GX], [6, true, GX], [6, true, GY]]) {
|
||||
const [tier, elite, mod] = f;
|
||||
const t0 = talentOf(tier, elite, mod, 0), t1 = talentOf(tier, elite, mod, 1);
|
||||
const x3 = elite && mod === GX && tier === 6;
|
||||
assert.deepEqual([t0.hp_ratio, t0.atk_scale, t0.sluggish, t0.stun, t0.prob ?? 0], x3 ? [0.2, 1.65, 1.6, 1.2, 0.3] : [0.15, 1.5, 1.4, 1, 0], label(f));
|
||||
const { h, u } = field({ tier, elite, mod, skill: 0, seed: 7 });
|
||||
noSkill(h, u);
|
||||
const e = h.spawn('enemy_dummy', { pos: [10, 6] });
|
||||
h.run(400);
|
||||
const hits = atkHits(h, u).filter((c) => c.target === e);
|
||||
const n = hits.length;
|
||||
assert.ok(n > 250, `${label(f)}: ${n} attacks`);
|
||||
const atk = u.s.atk;
|
||||
const boosted = hits.filter((c) => Math.abs(c.amount - atk * t0.atk_scale) < 1e-6);
|
||||
assert.equal(boosted.length + hits.filter((c) => Math.abs(c.amount - atk) < 1e-6).length, n, `${label(f)}: ×1 or ×${t0.atk_scale}`);
|
||||
const st = h.hooksOf('statusApplied').filter((c) => c.source === u && c.target === e);
|
||||
const slug = st.filter((c) => c.status === 'sluggish'), stun = st.filter((c) => c.status === 'stun');
|
||||
for (const c of slug) approx(c.duration, t0.sluggish, `${label(f)}: 停顿`);
|
||||
for (const c of stun) approx(c.duration, t0.stun, `${label(f)}: 晕眩`);
|
||||
const heals = h.hooksOf('heal').filter((c) => c.source === u && c.target === u && !c.opts?.regen);
|
||||
for (const c of heals.slice(0, 5)) approx(c.amount, u.s.maxHp * t0.hp_ratio * t1.heal_scale, `${label(f)}: heal ${t0.hp_ratio * 100} % × ${t1.heal_scale}`, 1e-6);
|
||||
const share = x3 ? 0.3 + 0.7 / 4 : 0.25;
|
||||
for (const [what, list] of [['×atk', boosted], ['停顿', slug], ['晕眩', stun], ['heal', heals]]) {
|
||||
assert.ok(Math.abs(list.length / n - share) < 0.07, `${label(f)}: ${what} ${list.length} / ${n} ≈ ${share}`);
|
||||
}
|
||||
// all four at once: only GEE-X stage 3 — the boosted attacks that also stun, slow and heal in the same tick
|
||||
const at = (list) => new Set(list.map((c) => c.t.toFixed(4)));
|
||||
const sS = at(slug), sT = at(stun), sH = at(heals);
|
||||
const four = boosted.filter((c) => sS.has(c.t.toFixed(4)) && sT.has(c.t.toFixed(4)) && sH.has(c.t.toFixed(4))).length;
|
||||
if (x3) assert.ok(Math.abs(four / n - 0.3) < 0.07, `${label(f)}: all four ${four} / ${n} ≈ 30 %`);
|
||||
else assert.equal(four, 0, `${label(f)}: never two at once`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('T2 药剂扩散: healing he receives ×1.2 (GEE-Y stage 3: ×1.25); GEE-Y stage 3 heals one ally of his range at each deployment for 150 % ATK — the straight line ahead first, never a 禁疗 one', () => {
|
||||
const others = [{ uid: 2, chessId: YAK, row: 10, col: 6 }, { uid: 3, chessId: TEXAS, row: 11, col: 4 }, { uid: 4, chessId: LISKAM, row: 10, col: 5 }];
|
||||
for (const f of FORMS_ALL) {
|
||||
const [tier, elite, mod] = f;
|
||||
const t1 = talentOf(tier, elite, mod, 1);
|
||||
const y3 = elite && mod === GY && tier === 6;
|
||||
assert.deepEqual([t1.heal_scale, t1['healinrange.heal_scale'] ?? 0], y3 ? [1.25, 1.5] : [1.2, 0], label(f));
|
||||
const { h, u } = field({ tier, elite, mod, skill: 0, others });
|
||||
assert.equal(u.s.healingTakenMul, t1.heal_scale, `${label(f)}: ×${t1.heal_scale}`);
|
||||
const yak = h.unit(2), texas = h.unit(3), liskam = h.unit(4);
|
||||
// 雷蛇 on the line ahead is 禁疗 here: 角峰, two tiles ahead on the same line, beats 德克萨斯 beside him (nearer)
|
||||
h.b.addBuff(liskam, { key: 'test:noHeal', flags: { noHeal: true } });
|
||||
for (const a of [yak, texas, liskam]) a.hp = 100;
|
||||
h.b.kill(u, null);
|
||||
const n0 = h.hooksOf('heal').length;
|
||||
assert.ok(h.b.redeploy(u, { free: true }), 'redeployed');
|
||||
const heals = h.hooksOf('heal').slice(n0).filter((c) => c.source === u && c.target !== u);
|
||||
if (y3) {
|
||||
assert.deepEqual(heals.map((c) => c.target.uid), [2], `${label(f)}: 角峰, ahead on his line`);
|
||||
approx(heals[0].amount, u.s.atk * 1.5, `${label(f)}: 150 % ATK`);
|
||||
} else assert.equal(heals.length, 0, `${label(f)}: no deploy heal`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S1 快速射击 (MANUAL, data DEFAULT): ASPD +50 / +70 for 23 / 26 s, then back', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, GY]]) {
|
||||
const sk = skillOf(tier, elite, S1);
|
||||
assert.deepEqual([sk.duration, sk.spCost, sk.initSp, sk.bb.attack_speed], [elite ? 26 : 23, 30, elite ? 17 : 16, elite ? 70 : 50]);
|
||||
const { h, u } = field({ tier, elite, mod, skill: 0 });
|
||||
const aspd0 = u.s.aspd;
|
||||
u.skill.gainSp(999);
|
||||
h.run(2);
|
||||
assert.equal(u.skill.activations, 0, 'no enemy, no cast');
|
||||
h.spawn('enemy_dummy', { pos: [10, 6] });
|
||||
assert.ok(h.runUntil(() => u.skill.active, 3), 'cast with an enemy in his range');
|
||||
approx(u.skill.timeLeft, sk.duration, 'duration', 0.02);
|
||||
assert.equal(u.s.aspd, aspd0 + sk.bb.attack_speed, 'ASPD');
|
||||
h.runUntil(() => !u.skill.active, sk.duration + 1);
|
||||
assert.equal(u.s.aspd, aspd0, 'back');
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S2 爆发剂·γ型 (MANUAL, data DEFAULT, 30 s): 15 physical hits of 500 attack power on the ally of his range ahead (DEF applies, 5 % floor, 受击回复 SP), then max HP / DEF +40 % / +50 % on both for 30 s; the line ahead beats a nearer side ally', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, GX]]) {
|
||||
const sk = skillOf(tier, elite, S2);
|
||||
assert.deepEqual([sk.duration, sk.spCost, sk.bb.damage, sk.bb.max_hp, sk.bb.def], [30, elite ? 34 : 37, 500, elite ? 0.5 : 0.4, elite ? 0.5 : 0.4]);
|
||||
assert.match(sk.desc, /攻击15次/);
|
||||
// 雷蛇 three tiles ahead on his line (DEF 489: 25 per hit, 5 %), 德克萨斯 diagonal-adjacent (nearer)
|
||||
const others = [{ uid: 2, chessId: LISKAM, row: 10, col: 7 }, { uid: 3, chessId: TEXAS, row: 11, col: 5 }];
|
||||
const { h, u } = field({ tier, elite, mod, skill: 1, others });
|
||||
const liskam = h.unit(2), texas = h.unit(3);
|
||||
assert.equal(liskam.skill.spType, 'hurt');
|
||||
liskam.skill.sp = 0;
|
||||
const hp0 = liskam.hp, max0 = liskam.s.maxHp, def0 = liskam.s.def;
|
||||
u.skill.gainSp(999);
|
||||
h.spawn('enemy_dummy', { pos: [9, 6] });
|
||||
assert.ok(h.runUntil(() => u.skill.active, 3), 'cast');
|
||||
const shots = h.hooksOf('damaged').filter((c) => c.source === u && c.dmg?.tags?.includes('haak:stim'));
|
||||
assert.equal(shots.length, 15, '15 hits');
|
||||
assert.ok(shots.every((c) => c.target === liskam && c.type === 'phys' && c.dmg.isSkill), '雷蛇, physical skill damage');
|
||||
for (const c of shots) approx(c.amount, Math.max(500 - def0, 25), 'max(500 − DEF, 5 %)');
|
||||
// 受击回复: +1 SP per hit (雷蛇's own 战术防御 "受到攻击时…回复…1点技力" answers each hit too)
|
||||
assert.equal(h.hooksOf('spGain').filter((c) => c.unit === liskam && c.reason === 'hurt').length, 15, '受击回复: +1 SP per hit');
|
||||
assert.equal(h.hooksOf('damaged').filter((c) => c.source === u && c.target === texas).length, 0, '德克萨斯 untouched');
|
||||
const mods = { hpPct: sk.bb.max_hp, defPct: sk.bb.def };
|
||||
assert.deepEqual(u.findBuff('haak:s2:self')?.mods, mods, 'himself');
|
||||
assert.deepEqual(liskam.findBuff(`haak:s2:${u.id}`)?.mods, mods, 'the target');
|
||||
approx(liskam.findBuff(`haak:s2:${u.id}`).timeLeft, 30, 'for the skill duration', 0.02);
|
||||
approx(liskam.s.maxHp, max0 * (1 + sk.bb.max_hp), 'max HP');
|
||||
approx(liskam.hp, (hp0 - 15 * Math.max(500 - def0, 25)) * (1 + sk.bb.max_hp), 'the HP ratio kept');
|
||||
h.run(30.1);
|
||||
assert.ok(!u.findBuff('haak:s2:self') && !liskam.findBuff(`haak:s2:${u.id}`), 'gone after 30 s');
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('爆发剂 edge cases: a low-DEF ally can be knocked out by the volley (he still gets his part); with no ally in his range the cast does nothing', () => {
|
||||
{
|
||||
const { h, u } = field({ tier: 5, skill: 1, others: [{ uid: 2, chessId: TEXAS, row: 10, col: 5 }] });
|
||||
const texas = h.unit(2);
|
||||
u.skill.gainSp(999);
|
||||
h.spawn('enemy_dummy', { pos: [9, 6] });
|
||||
assert.ok(h.runUntil(() => u.skill.active, 3));
|
||||
const shots = h.hooksOf('damaged').filter((c) => c.source === u && c.target === texas);
|
||||
assert.ok(!texas.alive && shots.length < 15, `德克萨斯 (DEF 260) knocked out after ${shots.length} hits`);
|
||||
assert.ok(u.findBuff('haak:s2:self'), 'his own part');
|
||||
done(h);
|
||||
}
|
||||
{
|
||||
const { h, u } = field({ tier: 6, elite: true, skill: 2, others: [{ uid: 2, chessId: YAK, row: 10, col: 3 }] }); // behind him
|
||||
u.skill.gainSp(999);
|
||||
h.spawn('enemy_dummy', { pos: [10, 6] });
|
||||
assert.ok(h.runUntil(() => u.skill.active, 3), 'cast: the DEFAULT rule needs an enemy only');
|
||||
assert.equal(h.hooksOf('damaged').filter((c) => c.dmg?.tags?.includes('haak:stim')).length, 0, 'no volley');
|
||||
assert.equal(u.findBuff('haak:s3:self'), null, 'no buff');
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S3 爆发剂·榴莲味 (MANUAL, data DEFAULT, 20 s): the same volley, then ATK +30 % / +35 % and ASPD +30 / +35 on both for 20 s', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, GY]]) {
|
||||
const sk = skillOf(tier, elite, S3);
|
||||
assert.deepEqual([sk.duration, sk.spCost, sk.bb.damage, sk.bb.atk, sk.bb.attack_speed], [20, elite ? 41 : 44, 500, elite ? 0.35 : 0.3, elite ? 35 : 30]);
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2, others: [{ uid: 2, chessId: YAK, row: 9, col: 5 }] });
|
||||
const yak = h.unit(2);
|
||||
const atk0 = yak.s.atk, aspd0 = yak.s.aspd, myAtk = u.s.atk, myAspd = u.s.aspd;
|
||||
u.skill.gainSp(999);
|
||||
h.spawn('enemy_dummy', { pos: [10, 6] });
|
||||
assert.ok(h.runUntil(() => u.skill.active, 3), 'cast');
|
||||
assert.equal(h.hooksOf('damaged').filter((c) => c.source === u && c.target === yak && c.dmg?.tags?.includes('haak:stim')).length, 15, '角峰 (beside, ahead diagonal) takes the volley');
|
||||
approx(yak.s.atk, atk0 * (1 + sk.bb.atk), 'its ATK');
|
||||
assert.equal(yak.s.aspd, aspd0 + sk.bb.attack_speed, 'its ASPD');
|
||||
approx(u.s.atk, myAtk * (1 + sk.bb.atk), 'his ATK');
|
||||
assert.equal(u.s.aspd, myAspd + sk.bb.attack_speed, 'his ASPD');
|
||||
approx(u.findBuff('haak:s3:self').timeLeft, 20, '20 s', 0.02);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,284 @@
|
||||
// test/content/op_phatom.test.js — the 自选 operator kit of 傀影 (char_250_phatom, 6★ 处决者; kit
|
||||
// server/sim/content/kits/ops/op-phatom.js) and of his summon 镜中虚影 (token_10007_phatom_twin), fielded the production way
|
||||
// (a DIY slot + its `diy` pick, simdata getDiy; the twin as a placed token piece `{ kind: 'token', tokenId, ownerUid }`) in
|
||||
// every form: tiers 5 / 6, normal (E2 Lv1, skill rank 4, no module) and elite (E2 Lv60, rank 7) with no module, EXE-X
|
||||
// 克里斯汀小姐的毛毡, EXE-Y “如影随形” or ISW-A 傀影特限证章 at stage 1 (tier 5) / 3 (tier 6). Every number is read back from
|
||||
// data/backups.json (the form of that slot status, the token variant of that owner form); the fidelity checklist of
|
||||
// kits/README.md item by item.
|
||||
// Run: node --test test/content/op_phatom.test.js
|
||||
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { makeBattle, enemyRec, checkInvariants } from '../helpers/battleHarness.js';
|
||||
import { KITTED_CHARS, OPERATOR_KITS, KITS } from '../../server/sim/content/kits/index.js';
|
||||
import { diyPool, validateDiyPicks } from '../../shared/diy.js';
|
||||
import { TWIN } from '../../server/sim/content/kits/ops/op-phatom.js';
|
||||
|
||||
const load = (f) => JSON.parse(readFileSync(new URL(`../../data/${f}.json`, import.meta.url), 'utf8'));
|
||||
const CHESS = load('chess');
|
||||
const BACKUPS = load('backups');
|
||||
const PHATOM = 'char_250_phatom';
|
||||
const FORMS = BACKUPS.units[PHATOM].forms;
|
||||
const TOKEN = BACKUPS.tokens[TWIN];
|
||||
const SLOT = { 5: 'chess_char_5_diy1_a', 6: 'chess_char_6_diy1_a' };
|
||||
const EX = 'uniequip_002_phatom', EY = 'uniequip_003_phatom', IS = 'uniequip_004_phatom';
|
||||
const S1 = 'skchr_phatom_1', S2 = 'skchr_phatom_2', S3 = 'skchr_phatom_3';
|
||||
const TEXAS = 'chess_char_1_08_a';
|
||||
const statusKey = (tier, elite) => (elite ? (tier === 5 ? '2/60/7/1' : '2/60/7/3') : '2/1/4/0');
|
||||
const formOf = (tier, elite) => FORMS[statusKey(tier, elite)];
|
||||
const skillOf = (tier, elite, id) => formOf(tier, elite).skills.find((s) => s.skillId === id);
|
||||
const modOf = (tier, mod) => (mod ? formOf(tier, true).modules.find((m) => m.uniEquipId === mod) : null);
|
||||
/** The twin's variant of an owner form (+ its module part). */
|
||||
const twinOf = (tier, elite, mod) => {
|
||||
const v = TOKEN.variants[`${PHATOM}@${statusKey(tier, elite)}`];
|
||||
const bm = elite && mod ? v.byModule?.[mod] : null;
|
||||
return { stats: bm?.stats ?? v.stats, talents: bm?.talents ?? v.talents, skillOf: (i) => (i === 0 ? v.skill : v.bySkill[i].skill) };
|
||||
};
|
||||
const approx = (a, b, msg, eps = 1e-6) => assert.ok(Math.abs(a - b) <= eps * Math.max(1, Math.abs(b)), `${msg}: ${a} vs ${b}`);
|
||||
const dummy = (key, o = {}) => enemyRec({ key, hp: 1e9, speed: 0, mass: 0, ...o });
|
||||
const ENEMIES = {
|
||||
enemy_dummy: dummy('enemy_dummy'), enemy_fly: dummy('enemy_fly', { motion: 'FLY' }),
|
||||
enemy_heavy: dummy('enemy_heavy', { mass: 9 }), enemy_evade: dummy('enemy_evade'),
|
||||
};
|
||||
/** Every 自选 form: [tier, elite, module]. */
|
||||
const FORMS_ALL = [[5, false, null], [6, false, null], ...[5, 6].flatMap((t) => [null, EX, EY, IS].map((m) => [t, true, m]))];
|
||||
const label = ([tier, elite, mod]) => `T${tier} ${elite ? 'elite' : 'normal'} ${mod ?? 'none'}`;
|
||||
|
||||
/** A battle with 傀影 as uid 1 at (row, col) facing RIGHT, his twin piece (uid 2) at `twinAt` unless null, plus `others`. */
|
||||
function field({ tier = 5, elite = false, mod = null, skill = 0, row = 10, col = 4, twinAt = [12, 4], others = [], seed = 5, dp = 0 } = {}) {
|
||||
const units = [{ uid: 1, diy: { slot: SLOT[tier], charId: PHATOM, skillIndex: skill, uniEquipId: mod }, elite, row, col }];
|
||||
if (twinAt) units.push({ uid: 2, kind: 'token', tokenId: TWIN, ownerUid: 1, row: twinAt[0], col: twinAt[1] });
|
||||
const h = makeBattle({
|
||||
defs: { enemies: ENEMIES }, timeLimit: 900, autoFinish: false, seed,
|
||||
flags: { dpPerSec: 0, dpMax: 999 }, hooks: ['damaged', 'statusApplied', 'death', 'deploy', 'dodge'], captureNoisy: true,
|
||||
units: [...units, ...others],
|
||||
});
|
||||
h.step();
|
||||
h.b.players[0].dp = dp;
|
||||
return { h, u: h.unit(1), t: twinAt ? h.unit(2) : null };
|
||||
}
|
||||
function done(h) {
|
||||
checkInvariants(h.b);
|
||||
assert.equal(h.b.errors.length, 0, JSON.stringify(h.b.errors[0]));
|
||||
}
|
||||
/** Knock `u` out and bring it straight back on its tile (free). */
|
||||
function redeployNow(h, u) {
|
||||
h.b.kill(u, null);
|
||||
assert.ok(h.b.redeploy(u, { free: true }), `${u.name} redeployed`);
|
||||
}
|
||||
|
||||
test('傀影 in every 自选 form: his operator kit (all three skills authored), the form\'s stats + module attributes, 1-1, blocks 1, melee ground-only, 18 s redeploy, 维多利亚, no 特质; his placed 镜中虚影 deploys after him with the variant\'s stats and its copy of his skill', () => {
|
||||
assert.equal(OPERATOR_KITS[PHATOM], KITS[PHATOM]);
|
||||
for (const f of FORMS_ALL) {
|
||||
const [tier, elite, mod] = f;
|
||||
for (const skill of [0, 1, 2]) {
|
||||
const { h, u, t } = field({ tier, elite, mod, skill });
|
||||
const form = formOf(tier, elite), m = elite ? modOf(tier, mod) : null, tw = twinOf(tier, elite, mod);
|
||||
assert.deepEqual([u.def.charId, u.def.diyFor, u.skill.id, u.skill.kind, !!u.kit.generic, u.kit.skillSource], [PHATOM, SLOT[tier], form.skills[skill].skillId, 'passive', false, 'skills'], label(f));
|
||||
assert.deepEqual([u.base.maxHp, u.base.atk, u.base.def, u.base.aspd, u.base.respawnTime, u.base.cost],
|
||||
[form.stats.maxHp + (m?.attr.maxHp ?? 0), form.stats.atk + (m?.attr.atk ?? 0), form.stats.def + (m?.attr.def ?? 0), 100 + (m?.attr.aspd ?? 0), 18, 10], `${label(f)}: stats`);
|
||||
assert.deepEqual([u.s.blockCnt, u.profile.attack, u.profile.dmgType, u.profile.canHitFly], [1, 'melee', 'phys', false], `${label(f)}: 处决者`);
|
||||
assert.deepEqual(u.liveRangeGrid, form.rangeGrid, `${label(f)}: 1-1`);
|
||||
assert.deepEqual([u.def.bonds, u.def.raw.garrisonIds], [['victoriaShip'], []], `${label(f)}: bonds / 特质`);
|
||||
assert.ok(!u.s.flags.liftoff && !u.s.flags.camou && !u.s.flags.stealth, `${label(f)}: ground enemies target him`);
|
||||
// the twin
|
||||
assert.deepEqual([t.defId, t.ownerUnit === u, t.alive, t.deployed, t.deploySeq > u.deploySeq, !!t.kit.generic], [TWIN, true, true, true, true, false], `${label(f)}: twin deployed after him`);
|
||||
assert.deepEqual([t.base.maxHp, t.base.atk, t.base.def, t.base.respawnTime, t.base.cost], [tw.stats.maxHp, tw.stats.atk, tw.stats.def, 45, 5], `${label(f)}: twin stats`);
|
||||
assert.deepEqual([t.def.skill.id, t.skill.kind], [tw.skillOf(skill).skillId, 'passive'], `${label(f)}: twin skill copy`);
|
||||
assert.deepEqual([t.s.blockCnt, t.profile.attack, t.profile.canHitFly, t.liveRangeGrid], [1, 'melee', false, [[0, 0], [0, 1]]], `${label(f)}: twin executor`);
|
||||
done(h);
|
||||
}
|
||||
}
|
||||
// the numbers (zh_CN): 傀影 E2 Lv1 1283 / 435 / 270, E2 Lv60 1523 / 517 / 304; the twin 1126 / 429 / 226 → 1318 / 508 / 254,
|
||||
// EXE-Y stage 3 "属性进一步增强" 1418 / 568 / 294; modules
|
||||
assert.deepEqual([FORMS['2/1/4/0'].stats.maxHp, FORMS['2/1/4/0'].stats.atk, FORMS['2/60/7/1'].stats.maxHp, FORMS['2/60/7/1'].stats.atk], [1283, 435, 1523, 517]);
|
||||
assert.deepEqual([twinOf(5, false).stats.maxHp, twinOf(5, true).stats.atk, twinOf(6, true, EY).stats.maxHp, twinOf(6, true, EY).stats.atk, twinOf(5, true, EY).stats.atk], [1126, 508, 1418, 568, 508]);
|
||||
assert.deepEqual([modOf(5, EX).attr, modOf(6, EX).attr, modOf(5, EY).attr, modOf(6, EY).attr, modOf(5, IS).attr, modOf(6, IS).attr],
|
||||
[{ maxHp: 100, atk: 50 }, { maxHp: 140, atk: 73 }, { atk: 40, def: 24 }, { atk: 75, def: 30 }, { atk: 37, aspd: 5 }, { atk: 71, aspd: 7 }]);
|
||||
});
|
||||
|
||||
test('a 自选 pick: 傀影 is offered at tiers 5 and 6; a roster with EXE-X / EXE-Y passes validateDiyPicks, his 集成战略 module ISW-A is refused', () => {
|
||||
const data = { chess: CHESS, backups: BACKUPS };
|
||||
assert.ok(KITTED_CHARS.includes(PHATOM));
|
||||
for (const t of [5, 6]) assert.ok(diyPool(t, { data, kitted: KITTED_CHARS }).includes(PHATOM), `tier ${t}`);
|
||||
assert.deepEqual(validateDiyPicks({ [SLOT[6]]: { charId: PHATOM, skillIndex: 2, uniEquipId: EY } }, { data, kitted: KITTED_CHARS }),
|
||||
{ ok: true, picks: { [SLOT[6]]: { charId: PHATOM, skillIndex: 2, uniEquipId: EY } } });
|
||||
const bad = validateDiyPicks({ [SLOT[5]]: { charId: PHATOM, skillIndex: 0, uniEquipId: IS } }, { data, kitted: KITTED_CHARS });
|
||||
assert.equal(bad.error, 'BAD_TARGET');
|
||||
assert.match(bad.detail, /集成战略/);
|
||||
});
|
||||
|
||||
test('S1 暗夜魅影 (被动): at each deployment 30 % / 40 % physical dodge and a 屏障 of 35 % / 50 % max HP that absorbs physical damage only, both 10 s; the twin\'s copy on itself', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, EY]]) {
|
||||
const sk = skillOf(tier, elite, S1);
|
||||
assert.deepEqual([sk.skillType, sk.spType, sk.bb.prob, sk.bb.hp_ratio, sk.bb.duration], ['PASSIVE', 'ON_DEPLOY', elite ? 0.4 : 0.3, elite ? 0.5 : 0.35, 10]);
|
||||
const { h, u, t } = field({ tier, elite, mod, skill: 0 });
|
||||
for (const x of [u, t]) {
|
||||
const b = x === u ? sk.bb : twinOf(tier, elite, mod).skillOf(0).bb;
|
||||
approx(x.s.dodgePhys, b.prob, `${x.name}: physical dodge`);
|
||||
assert.equal(x.s.dodgeArts, 0, `${x.name}: no arts dodge`);
|
||||
const sh = x.buffs.find((y) => y.shield > 0);
|
||||
approx(sh.shield, x.s.maxHp * b.hp_ratio, `${x.name}: ${b.hp_ratio * 100} % max HP`);
|
||||
assert.equal(sh.shieldType, 'phys', `${x.name}: physical only`);
|
||||
}
|
||||
// arts damage passes the barrier, physical damage is absorbed
|
||||
const hp0 = u.hp;
|
||||
h.b.dealDamage(null, u, { amount: 100, type: 'arts', canDodge: false });
|
||||
approx(u.hp, hp0 - 100, 'arts passes');
|
||||
h.b.dealDamage(null, u, { amount: 100, type: 'phys', canDodge: false });
|
||||
approx(u.hp, hp0 - 100, 'physical absorbed');
|
||||
h.run(10.2);
|
||||
assert.ok(u.s.dodgePhys === 0 && !u.buffs.some((y) => y.shield > 0), 'gone after 10 s');
|
||||
redeployNow(h, u);
|
||||
approx(u.s.dodgePhys, sk.bb.prob, 'again at a redeployment');
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S2 血色乐章 (被动): at each deployment 8 / 9 stacks of ATK +13 % / +16 %; each damage instance he deals uses one (a dodged attack none); the twin\'s copy has its own', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, EX]]) {
|
||||
const sk = skillOf(tier, elite, S2);
|
||||
assert.deepEqual([sk.bb.times, sk.bb.atk], [elite ? 9 : 8, elite ? 0.16 : 0.13]);
|
||||
const { h, u, t } = field({ tier, elite, mod, skill: 1 });
|
||||
assert.equal(u.findBuff('phatom:skill').stacks, sk.bb.times);
|
||||
assert.equal(t.findBuff('phatom:twin:skill').stacks, sk.bb.times, 'the twin\'s own stacks');
|
||||
approx(u.s.atk, u.base.atk * (1 + sk.bb.times * sk.bb.atk + (u.findBuff('trait:phatom:lonely') ? 0.1 : 0)), 'ATK');
|
||||
// an enemy that dodges everything: no stack used
|
||||
const ev = h.spawn('enemy_evade', { pos: [10, 5] });
|
||||
h.b.addBuff(ev, { key: 'test:dodge', mods: { dodgePhys: 1 } });
|
||||
h.run(3);
|
||||
assert.ok(h.hooksOf('dodge').some((c) => c.source === u), 'dodged attacks');
|
||||
assert.equal(u.findBuff('phatom:skill').stacks, sk.bb.times, 'none used');
|
||||
h.b.removeBuff(ev, 'test:dodge');
|
||||
const fullAtk = u.s.atk;
|
||||
const n0 = h.hooksOf('damaged').filter((c) => c.source === u).length;
|
||||
h.run(0.95);
|
||||
const hits = h.hooksOf('damaged').filter((c) => c.source === u).slice(n0);
|
||||
assert.ok(hits.length >= 1, 'hits');
|
||||
assert.equal(u.findBuff('phatom:skill').stacks, sk.bb.times - hits.length, 'one per damage instance');
|
||||
approx(hits[0].amount, fullAtk, 'the first hit at full stacks (a 0-DEF target)');
|
||||
approx(u.s.atk, fullAtk - u.base.atk * sk.bb.atk * hits.length, 'ATK −atk per stack used');
|
||||
h.run(30);
|
||||
assert.equal(u.findBuff('phatom:skill'), null, 'all used');
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S3 夜幕突袭 (被动): at each deployment 210 % / 240 % ATK physical to every ground enemy of the x-4, a radial 小力 push and ONE status for all — 停顿 / 晕眩 / 束缚 2.5 / 3 s (each drawn over the casts); flyers and enemies outside untouched; the twin\'s copy at its deployment', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, EY]]) {
|
||||
const sk = skillOf(tier, elite, S3);
|
||||
assert.deepEqual([sk.rangeId, sk.bb.atk_scale, sk.bb.force, sk.bb.sluggish, sk.bb.root, sk.bb.stun], ['x-4', elite ? 2.4 : 2.1, 0, elite ? 3 : 2.5, elite ? 3 : 2.5, elite ? 3 : 2.5]);
|
||||
const drawn = new Set();
|
||||
for (const seed of [1, 2, 3, 4, 5, 6, 7, 8]) {
|
||||
const { h, u, t } = field({ tier, elite, mod, skill: 2, seed, twinAt: [11, 6] });
|
||||
const ahead = h.spawn('enemy_dummy', { pos: [10, 5] }), diag = h.spawn('enemy_dummy', { pos: [9, 3] });
|
||||
const heavy = h.spawn('enemy_heavy', { pos: [11, 4] });
|
||||
const fly = h.spawn('enemy_fly', { pos: [9, 4] }), far = h.spawn('enemy_dummy', { pos: [10, 6] });
|
||||
h.step(); // the enemy tile index
|
||||
const n0 = h.hooksOf('damaged').length, s0 = h.hooksOf('statusApplied').length;
|
||||
redeployNow(h, u);
|
||||
const hits = h.hooksOf('damaged').slice(n0).filter((c) => c.source === u && c.dmg?.tags?.includes('phatom:raid'));
|
||||
assert.deepEqual(hits.map((c) => c.target).sort((a, b) => a.id - b.id), [ahead, diag, heavy].sort((a, b) => a.id - b.id), `seed ${seed}: the ground enemies of his x-4`);
|
||||
for (const c of hits) {
|
||||
approx(c.amount, u.s.atk * sk.bb.atk_scale, `seed ${seed}: ${sk.bb.atk_scale * 100} % ATK`);
|
||||
assert.deepEqual([c.type, c.dmg.isSkill], ['phys', true]);
|
||||
}
|
||||
assert.ok(!hits.some((c) => c.target === fly || c.target === far), 'flyer / outside untouched');
|
||||
assert.ok(ahead.x > 5.5, `seed ${seed}: pushed away (radial, 小力)`);
|
||||
approx(heavy.y, 11, `seed ${seed}: 重量 9 — 小力 moves nothing`);
|
||||
const st = h.hooksOf('statusApplied').slice(s0).filter((c) => c.source === u);
|
||||
assert.equal(new Set(st.map((c) => c.status)).size, 1, `seed ${seed}: one status for the cast`);
|
||||
assert.equal(st.length, 3, `seed ${seed}: on each of the three`);
|
||||
for (const c of st) approx(c.duration, sk.bb[c.status === 'bind' ? 'root' : c.status], `seed ${seed}: ${c.status}`);
|
||||
drawn.add(st[0].status);
|
||||
// the twin's copy at its own deployment
|
||||
const tn0 = h.hooksOf('damaged').length;
|
||||
redeployNow(h, t);
|
||||
const th = h.hooksOf('damaged').slice(tn0).filter((c) => c.source === t && c.dmg?.tags?.includes('phatom:raid'));
|
||||
assert.ok(th.length >= 1 && th.every((c) => Math.abs(c.amount - t.s.atk * twinOf(tier, elite, mod).skillOf(2).bb.atk_scale) < 1e-6), `seed ${seed}: the twin's burst`);
|
||||
done(h);
|
||||
}
|
||||
assert.deepEqual([...drawn].sort(), ['bind', 'sluggish', 'stun'], 'all three statuses over the casts');
|
||||
}
|
||||
});
|
||||
|
||||
test('T1 镜中虚影 / T2 虚影精通: the twin is killed when he leaves the field and comes back on its tile 35 s (45 − 10; EXE-X stage 3: 45 − 16) after its LAST deployment, paying 5 DP, only while he stands', () => {
|
||||
for (const f of [[5, false, null], [5, true, EX], [6, true, EX]]) {
|
||||
const [tier, elite, mod] = f;
|
||||
const cut = twinOf(tier, elite, mod).talents.find((x) => x.bb.respawn_time != null).bb.respawn_time;
|
||||
assert.equal(cut, tier === 6 && mod === EX ? -16 : -10, label(f));
|
||||
const { h, u, t } = field({ tier, elite, mod, skill: 1, dp: 50 });
|
||||
const wait = 45 + cut;
|
||||
// knocked out while he stands: back `wait` s after its deployment at 0 s, 5 DP paid
|
||||
h.run(5);
|
||||
h.b.kill(t, null);
|
||||
assert.ok(!t.alive && !t.removed, `${label(f)}: the piece stays`);
|
||||
h.run(wait - 5 - 1);
|
||||
assert.ok(!t.alive, `${label(f)}: not before ${wait} s`);
|
||||
assert.ok(h.runUntil(() => t.alive, 1.5), `${label(f)}: back at ${wait} s`);
|
||||
assert.deepEqual([t.tileR, t.tileC, h.b.players[0].dp], [12, 4, 45], `${label(f)}: its tile, 5 DP`);
|
||||
const at = h.b.time;
|
||||
// he is knocked out: the twin is killed with him (KillTokens) and waits for him
|
||||
h.b.kill(u, null);
|
||||
u.respawnAt = Infinity; // he stays down until the test brings him back
|
||||
assert.ok(!t.alive, `${label(f)}: killed with him`);
|
||||
h.run(wait + 1);
|
||||
assert.ok(!t.alive && !u.alive, `${label(f)}: no return while he is down`);
|
||||
assert.ok(h.b.redeploy(u, { free: true }));
|
||||
assert.ok(h.runUntil(() => t.alive, 0.5), `${label(f)}: back with him once its own timer (from ${at.toFixed(1)} s) has run`);
|
||||
// no DP: it waits
|
||||
h.b.kill(t, null);
|
||||
h.b.players[0].dp = 0;
|
||||
h.run(wait + 1);
|
||||
assert.ok(!t.alive, `${label(f)}: no DP, no return`);
|
||||
h.b.players[0].dp = 5;
|
||||
assert.ok(h.runUntil(() => t.alive, 0.5), `${label(f)}: back with the DP`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('EXE-X / ISW-A: EXE-X\'s refund has no effect (no retreat in battle) — only its attributes and T2 at stage 3; ISW-A acts by its attributes only (集成战略-only trait and talent)', () => {
|
||||
{
|
||||
const { h, u } = field({ tier: 6, elite: true, mod: EX, skill: 0, dp: 7 });
|
||||
assert.deepEqual(u.def.traitBb, { withdraw_cost_recover_ratio: 0.8 });
|
||||
h.b.retreat(u);
|
||||
h.step();
|
||||
assert.equal(h.b.players[0].dp, 7, 'no refund');
|
||||
done(h);
|
||||
}
|
||||
{
|
||||
const { h, u, t } = field({ tier: 6, elite: true, mod: IS, skill: 1, dp: 50 });
|
||||
assert.match(modOf(6, IS).traitOverride.moduleDesc, /^在集成战略中/);
|
||||
assert.ok(modOf(6, IS).talentChanges.filter((x) => x.desc).every((x) => /在集成战略中/.test(x.desc)));
|
||||
assert.equal(u.findBuff('module:phatom:both'), null, 'no ATK while both stand');
|
||||
h.spawn('enemy_dummy', { pos: [10, 5] });
|
||||
h.run(5);
|
||||
h.b.kill(t, null);
|
||||
assert.ok(!h.runUntil(() => t.alive, 29), 'its attacks shorten no redeploy time');
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('EXE-Y “如影随形”: ATK +10 % while no allied operator stands on the 4 tiles beside him (the twin does not count); stage 3: ATK +10 % on him and the twin while both are on the field', () => {
|
||||
for (const f of [[5, true, EY], [6, true, EY], [6, true, null]]) {
|
||||
const [tier, elite, mod] = f;
|
||||
const ey = mod === EY, y3 = ey && tier === 6;
|
||||
const { h, u, t } = field({ tier, elite, mod, skill: 0, twinAt: [10, 5], others: [{ uid: 3, chessId: TEXAS, row: 12, col: 7 }] });
|
||||
const texas = h.unit(3);
|
||||
assert.equal(!!u.findBuff('trait:phatom:lonely'), ey, `${label(f)}: the twin beside him does not count`);
|
||||
if (ey) assert.deepEqual(u.findBuff('trait:phatom:lonely').mods, { atkPct: 0.1 });
|
||||
assert.equal(!!u.findBuff('module:phatom:both'), y3, `${label(f)}: both on the field`);
|
||||
assert.equal(!!t.findBuff('module:phatom:both'), y3, `${label(f)}: the twin too`);
|
||||
if (y3) assert.match(FORMS['2/60/7/3'].modules.find((m) => m.uniEquipId === EY).talentChanges[0].desc, /本体和虚影同时在场时,攻击力各\+10%/);
|
||||
// an operator beside him
|
||||
assert.ok(h.b.relocate(texas, 11, 4), 'moved beside him');
|
||||
h.step();
|
||||
assert.equal(u.findBuff('trait:phatom:lonely'), null, `${label(f)}: an operator beside`);
|
||||
// the twin down: the shared ATK goes
|
||||
h.b.kill(t, null);
|
||||
h.step();
|
||||
assert.equal(u.findBuff('module:phatom:both'), null, `${label(f)}: twin down`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user