feedback5: merge O9 — 自选 kits for 帕拉斯, 止颂 and 贝洛内 (with his 牵绊); golden: only diy moved
This commit is contained in:
commit
a2d2f6a12f
8 files changed
+2056
-96
No files matched your search
@@ -0,0 +1,377 @@
|
||||
// test/content/op_demetr.test.js — the 自选 operator kit of 贝洛内 (char_4037_demetr, 6★ 斗士; kit
|
||||
// server/sim/content/kits/ops/op-demetr.js) and his summon 牵绊 (token_10065_demetr_dmtpos), 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 or FGT-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_demetr.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 { BOND, MEANS_KEY, MEANS_SLUG_KEY, STREET_KEY, UNDEAD_KEY, RETURN_UNDYING } from '../../server/sim/content/kits/ops/op-demetr.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 DEMETR = 'char_4037_demetr';
|
||||
const FORMS = BACKUPS.units[DEMETR].forms;
|
||||
const SLOT = { 5: 'chess_char_5_diy1_a', 6: 'chess_char_6_diy1_a' };
|
||||
const FGTY = 'uniequip_002_demetr';
|
||||
const S1 = 'skchr_demetr_1', S2 = 'skchr_demetr_2', S3 = 'skchr_demetr_3';
|
||||
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);
|
||||
const talentOf = (u, i) => u.def.raw.talents.find((t) => t.index === i)?.bb ?? {};
|
||||
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_armor: dummy('enemy_armor', { def: 1000 }), enemy_fly: dummy('enemy_fly', { motion: 'FLY' }),
|
||||
enemy_elite: dummy('enemy_elite', { rank: 'ELITE' }), enemy_hit: dummy('enemy_hit', { atk: 3000, bat: 1 }),
|
||||
};
|
||||
const FORMS_ALL = [[5, false, null], [6, false, null], ...[5, 6].flatMap((t) => [null, FGTY].map((m) => [t, true, m]))];
|
||||
|
||||
/** A battle with 贝洛内 as uid 1 at (row, col) facing RIGHT, plus `others`. */
|
||||
function field({ tier = 5, elite = false, mod = null, skill = 2, row = 10, col = 5, others = [], seed = 5, rows = null } = {}) {
|
||||
const h = makeBattle({
|
||||
defs: { enemies: ENEMIES }, timeLimit: 600, autoFinish: false, seed, ...(rows ? { flat: { rows } } : {}),
|
||||
flags: { dpPerSec: 0, dpMax: 999 }, hooks: ['damaged', 'skillStart', 'skillEnd', 'statusApplied', 'deploy', 'death'], captureNoisy: true,
|
||||
units: [{ uid: 1, diy: { slot: SLOT[tier], charId: DEMETR, 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);
|
||||
const moves = (h, u) => h.hooksOf('deploy').filter((c) => c.unit === u && c.move);
|
||||
const bondOf = (h) => h.b.allyUnits.find((a) => a.kind === 'token' && a.defId === BOND && a.alive) ?? null;
|
||||
const noSp = (h, u) => h.b.addBuff(u, { key: 'test:noSp', flags: { noSp: true } }); // 阻回: the MANUAL skill stays off
|
||||
const meansOf = (e) => e.findBuff(MEANS_KEY)?.data?.stacks ?? 0;
|
||||
function done(h) {
|
||||
checkInvariants(h.b);
|
||||
assert.equal(h.b.errors.length, 0, JSON.stringify(h.b.errors[0]));
|
||||
}
|
||||
const label = ([tier, elite, mod]) => `T${tier} ${elite ? 'elite' : 'normal'} ${mod ?? 'none'}`;
|
||||
|
||||
test('贝洛内 in every 自选 form: his operator kit (all three skills authored), the form\'s stats + module attributes, 1-1, blocks 1, melee ground-only, 0.78 s, 叙拉古, no 特质', () => {
|
||||
assert.equal(OPERATOR_KITS[DEMETR], KITS[DEMETR]);
|
||||
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], [DEMETR, SLOT[tier], form.skills[skill].skillId, false, 'skills'], label(f));
|
||||
assert.deepEqual([u.base.maxHp, u.base.atk, u.base.def], [form.stats.maxHp + (m?.attr.maxHp ?? 0), form.stats.atk + (m?.attr.atk ?? 0), form.stats.def + (m?.attr.def ?? 0)], `${label(f)}: stats`);
|
||||
assert.deepEqual([u.base.blockCnt, u.profile.attack, u.profile.canHitFly, u.profile.sub, u.base.bat, u.dmgType], [1, 'melee', false, 'fighter', 0.78, 'phys'], `${label(f)}: 斗士`);
|
||||
assert.deepEqual(u.liveRangeGrid, form.rangeGrid, `${label(f)}: 1-1`);
|
||||
assert.deepEqual([u.def.bonds, u.def.raw.garrisonIds, u.def.raw.nationId], [['siracusaShip'], [], 'siracusa'], `${label(f)}: bonds / 特质`);
|
||||
assert.ok(!u.s.flags.liftoff && !u.s.flags.camou && !u.s.flags.stealth, `${label(f)}: ground enemies target him`);
|
||||
done(h);
|
||||
}
|
||||
}
|
||||
// E2 Lv1 2152 / 490 / 298, E2 Lv60 2466 / 566 / 336; FGT-Y +140 / +50 → +230 / +80
|
||||
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], [2152, 490, 2466, 566]);
|
||||
assert.deepEqual([modOf(5, FGTY).attr, modOf(6, FGTY).attr], [{ maxHp: 140, atk: 50 }, { maxHp: 230, atk: 80 }]);
|
||||
});
|
||||
|
||||
test('a 自选 pick: 贝洛内 is offered at tiers 5 and 6 and a roster with him passes validateDiyPicks', () => {
|
||||
const data = { chess: CHESS, backups: BACKUPS };
|
||||
assert.ok(KITTED_CHARS.includes(DEMETR));
|
||||
for (const t of [5, 6]) assert.ok(diyPool(t, { data, kitted: KITTED_CHARS }).includes(DEMETR), `tier ${t}`);
|
||||
assert.deepEqual(validateDiyPicks({ [SLOT[6]]: { charId: DEMETR, skillIndex: 2, uniEquipId: FGTY } }, { data, kitted: KITTED_CHARS }),
|
||||
{ ok: true, picks: { [SLOT[6]]: { charId: DEMETR, skillIndex: 2, uniEquipId: FGTY } } });
|
||||
});
|
||||
|
||||
test('FGT-Y “实用的工具”: ASPD +10 while his HP is above 50 % (stages 1 and 3); none without it', () => {
|
||||
for (const f of FORMS_ALL) {
|
||||
const [tier, elite, mod] = f;
|
||||
const { h, u } = field({ tier, elite, mod, skill: 0 });
|
||||
const on = elite && mod === FGTY;
|
||||
if (on) assert.deepEqual(u.def.raw.trait.bb, { attack_speed: 10, hp_ratio: 0.5 }, label(f));
|
||||
h.step();
|
||||
assert.equal(u.s.aspd, 100 + (on ? 10 : 0), `${label(f)}: full HP`);
|
||||
u.hp = u.s.maxHp * 0.5;
|
||||
h.step();
|
||||
assert.equal(u.s.aspd, 100, `${label(f)}: at 50 %`);
|
||||
u.hp = u.s.maxHp * 0.51;
|
||||
h.step();
|
||||
assert.equal(u.s.aspd, 100 + (on ? 10 : 0), `${label(f)}: above again`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('T1 家族手段: each attack hit puts one more 【手段】 stack on its target before its damage (DEF ×(1 − 7 % × n), FGT-Y stage 3: 8 %; at most 5) for 10 s; and his damage ×1 → ×1.28 (×1.42) linearly as the target falls from 100 % to 20 % HP', () => {
|
||||
for (const f of FORMS_ALL) {
|
||||
const [tier, elite, mod] = f;
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2 });
|
||||
noSp(h, u);
|
||||
const t = talentOf(u, 0);
|
||||
const y3 = elite && mod === FGTY && tier === 6;
|
||||
assert.deepEqual([t['attack@def'], t['attack@limited_stack_cnt'], t['attack@s2_limited_stack_cnt'], t['attack@def_dec_duration'], t.min_hp_ratio, t.max_hp_ratio, t.max_add_on_scale],
|
||||
[y3 ? -0.08 : -0.07, 5, 8, 10, 1, 0.2, y3 ? 0.42 : 0.28], `${label(f)}: the talent of the form`);
|
||||
const pct = -t['attack@def'];
|
||||
const e = h.spawn('enemy_armor', { pos: [10, 6] });
|
||||
const n0 = atkHits(h, u).length;
|
||||
h.run(8);
|
||||
const hits = atkHits(h, u).slice(n0);
|
||||
assert.ok(hits.length >= 7, `${label(f)}: ${hits.length} attacks`);
|
||||
hits.forEach((c, i) => {
|
||||
const k = Math.min(5, i + 1);
|
||||
approx(c.amount, Math.max(u.s.atk - 1000 * (1 - pct * k), u.s.atk * 0.05), `${label(f)}: attack ${i + 1} at ${k} stack(s)`);
|
||||
});
|
||||
assert.equal(meansOf(e), 5, `${label(f)}: 5 at most`);
|
||||
approx(e.s.def, 1000 * (1 - pct * 5), `${label(f)}: DEF ×${1 - pct * 5} (final multiplier)`);
|
||||
// the HP bonus: 60 % HP ⇒ halfway; 20 % HP and below ⇒ the most
|
||||
for (const [ratio, frac] of [[0.6, 0.5], [0.2, 1], [0.05, 1]]) {
|
||||
e.hp = e.s.maxHp * ratio;
|
||||
const m0 = atkHits(h, u).length;
|
||||
h.runUntil(() => atkHits(h, u).length > m0, 3);
|
||||
const c = atkHits(h, u)[m0];
|
||||
approx(c.amount, Math.max(u.s.atk - e.s.def, u.s.atk * 0.05) * (1 + t.max_add_on_scale * frac), `${label(f)}: at ${ratio * 100} % HP ×${1 + t.max_add_on_scale * frac}`);
|
||||
}
|
||||
// 10 s after the last hit it is gone
|
||||
h.b.retreat(u);
|
||||
h.run(9.5);
|
||||
assert.equal(meansOf(e), 5, `${label(f)}: still there after 9.5 s`);
|
||||
h.run(0.6);
|
||||
assert.equal(e.findBuff(MEANS_KEY), null, `${label(f)}: gone 10 s after his last hit`);
|
||||
approx(e.s.def, 1000, `${label(f)}: DEF back`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('T2 街头直觉: 80 % physical and arts dodge from every deployment, −2 % each second for 20 s, then 40 % for good', () => {
|
||||
for (const f of FORMS_ALL) {
|
||||
const [tier, elite, mod] = f;
|
||||
const { h, u } = field({ tier, elite, mod, skill: 0 });
|
||||
const t = talentOf(u, 1);
|
||||
assert.deepEqual([t.init_prob, t.dec_prob, t.trig_cnt], [0.8, 0.02, 20], label(f));
|
||||
approx(u.s.dodgePhys, 0.8, `${label(f)}: at the deployment`);
|
||||
assert.deepEqual(u.findBuff(STREET_KEY)?.mods, { dodgePhys: 0.8, dodgeArts: 0.8 }, `${label(f)}: one buff, both types`);
|
||||
approx(u.s.dodgeArts, 0.8, `${label(f)}: arts too`);
|
||||
h.run(1.02);
|
||||
approx(u.s.dodgePhys, 0.78, `${label(f)}: after 1 s`);
|
||||
h.run(9);
|
||||
approx(u.s.dodgePhys, 0.6, `${label(f)}: after 10 s`);
|
||||
h.run(10);
|
||||
approx(u.s.dodgePhys, 0.4, `${label(f)}: after 20 s`);
|
||||
h.run(30);
|
||||
approx(u.s.dodgeArts, 0.4, `${label(f)}: stays 40 %`);
|
||||
const e = h.spawn('enemy_dummy', { pos: [11, 8] });
|
||||
let dodged = 0;
|
||||
for (let i = 0; i < 400; i++) { u.hp = u.s.maxHp; if (h.b.dealDamage(e, u, { amount: 10, type: i % 2 ? 'phys' : 'arts' }) === 0) dodged++; }
|
||||
assert.ok(Math.abs(dodged / 400 - 0.4) < 0.07, `${label(f)}: ${dodged} / 400 dodged`);
|
||||
h.b.retreat(u);
|
||||
h.b.redeploy(u);
|
||||
h.step();
|
||||
approx(u.s.dodgePhys, 0.8, `${label(f)}: a new deployment starts again`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S1 家主的余裕 (AUTO, attack SP 4, data DEFAULT): the next attack strikes twice for 180 % / 210 % ATK — two 【手段】 stacks', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, FGTY]]) {
|
||||
const sk = skillOf(tier, elite, S1);
|
||||
const { h, u } = field({ tier, elite, mod, skill: 0 });
|
||||
assert.deepEqual([u.skill.rule, u.skill.spType, u.skill.spCost, sk.skillType, sk.bb.atk_scale], ['DEFAULT', 'attack', 4, 'AUTO', elite ? 2.1 : 1.8], `T${tier}`);
|
||||
const e = h.spawn('enemy_dummy', { pos: [10, 6] });
|
||||
assert.ok(h.runUntil(() => atkHits(h, u).some((c) => c.dmg.isSkill), 20), `T${tier}: cast`);
|
||||
const sk1 = atkHits(h, u).filter((c) => c.dmg.isSkill);
|
||||
assert.equal(sk1.length, 2, `T${tier}: two strikes`);
|
||||
assert.equal(atkHits(h, u).filter((c) => !c.dmg.isSkill).length, 4, `T${tier}: on the 5th attack`);
|
||||
// (×1.0000x: the target's HP is not quite full any more — 家族手段's HP bonus)
|
||||
for (const c of sk1) approx(c.amount, u.s.atk * sk.bb.atk_scale, `T${tier}: ${sk.bb.atk_scale * 100} %`, 1e-4);
|
||||
assert.equal(meansOf(e), 5, `T${tier}: 4 plain + 2 strikes ⇒ capped at 5`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S2 军师的手段 (MANUAL, data ACTIVE_RANGE on its 3-13): 15 / 18 s, range 3-13, ASPD +40 / +60, three targets at 155 % / 170 %; 【手段】 up to 8 with 停顿 at 8, back to 5 within 0.1 s after (or once he leaves)', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, FGTY]]) {
|
||||
const sk = skillOf(tier, elite, S2);
|
||||
const b = sk.bb;
|
||||
assert.deepEqual([sk.duration, b.attack_speed, b['attack@max_target'], b['attack@atk_scale'], sk.rangeId], [elite ? 18 : 15, elite ? 60 : 40, 3, elite ? 1.7 : 1.55, '3-13'], `T${tier}`);
|
||||
const { h, u } = field({ tier, elite, mod, skill: 1 });
|
||||
assert.deepEqual([u.skill.rule, sk.trigger.rawRule], ['ACTIVE_RANGE', 'DEFAULT'], `T${tier}: the owner's ACTIVE_RANGE rule`);
|
||||
assert.deepEqual(sk.trigger.customRangeGrid, sk.rangeGrid);
|
||||
u.skill.gainSp(999);
|
||||
const far = h.spawn('enemy_dummy', { pos: [10, 8] }); // [0, 3]: only in the 3-13
|
||||
assert.ok(h.runUntil(() => u.skill.active, 2), `T${tier}: cast with an enemy in the 3-13 only`);
|
||||
approx(u.skill.timeLeft, sk.duration, `T${tier}: ${sk.duration} s`, 0.05);
|
||||
assert.deepEqual([...u.liveRangeGrid].sort(), [...sk.rangeGrid].sort(), `T${tier}: 3-13 while it runs`);
|
||||
assert.equal(u.s.aspd, 100 + b.attack_speed + (mod ? 10 : 0), `T${tier}: ASPD`);
|
||||
const es = [far, h.spawn('enemy_dummy', { pos: [11, 6] }), h.spawn('enemy_dummy', { pos: [9, 7] }), h.spawn('enemy_dummy', { pos: [10, 7] })];
|
||||
const t0 = h.b.time;
|
||||
h.run(6);
|
||||
const per = new Map();
|
||||
for (const c of atkHits(h, u).filter((x) => x.t > t0)) {
|
||||
per.set(c.dmg.attackId, (per.get(c.dmg.attackId) ?? new Set()).add(c.target));
|
||||
const base = u.s.atk * b['attack@atk_scale'];
|
||||
approx(c.amount, base, `T${tier}: ${b['attack@atk_scale'] * 100} %`, 0.0001);
|
||||
}
|
||||
assert.ok(per.size >= 4 && [...per.values()].every((s) => s.size === 3), `T${tier}: three targets per attack`);
|
||||
const hitOnes = es.filter((e) => meansOf(e) > 0);
|
||||
assert.ok(hitOnes.some((e) => meansOf(e) === 8), `T${tier}: 8 stacks during S2`);
|
||||
for (const e of hitOnes) {
|
||||
assert.ok(meansOf(e) <= 8);
|
||||
assert.equal(!!e.findBuff(MEANS_SLUG_KEY), meansOf(e) === 8, `T${tier}: 停顿 exactly at 8`);
|
||||
if (meansOf(e) === 8) assert.ok(e.buffs.some((x) => x.status === 'sluggish'), `T${tier}: a 停顿 status`);
|
||||
}
|
||||
h.runUntil(() => !u.skill.active, 20);
|
||||
h.run(0.12);
|
||||
for (const e of hitOnes) {
|
||||
assert.equal(meansOf(e), Math.min(5, meansOf(e)), `T${tier}: back to 5`);
|
||||
assert.ok(meansOf(e) <= 5 && !e.findBuff(MEANS_SLUG_KEY), `T${tier}: no 停顿 after`);
|
||||
}
|
||||
assert.deepEqual(u.liveRangeGrid, formOf(tier, elite).rangeGrid, `T${tier}: 1-1 again`);
|
||||
done(h);
|
||||
}
|
||||
// he leaves the field during S2 ⇒ back to 5 at the next update
|
||||
const { h, u } = field({ tier: 6, elite: true, mod: FGTY, skill: 1 });
|
||||
u.skill.gainSp(999);
|
||||
const e = h.spawn('enemy_dummy', { pos: [10, 6] });
|
||||
h.runUntil(() => meansOf(e) === 8, 20);
|
||||
assert.ok(u.skill.active);
|
||||
h.b.retreat(u);
|
||||
h.run(0.12);
|
||||
assert.equal(meansOf(e), 5, 'he left: 5');
|
||||
done(h);
|
||||
});
|
||||
|
||||
test('S3 清算 (MANUAL, data CUSTOM_RANGE on x-2): 30 s, ATK +110 / 140 %, ASPD +30 / +40; he 【移动】s onto the first ground target of the x-2 (dodge back to 80 %), leaves 牵绊 on his tile; 35 / 40 % of his hits ×1.4 / 1.5', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, FGTY]]) {
|
||||
const sk = skillOf(tier, elite, S3);
|
||||
const b = sk.bb;
|
||||
assert.deepEqual([sk.duration, b['attack@demetr_s3[bonus].atk'], b['attack@demetr_s3[bonus].attack_speed'], b['attack@demetr_s3[bonus].prob'], b['attack@demetr_s3[bonus].prob_atk_scale'], sk.overrideTokenKey],
|
||||
[30, elite ? 1.4 : 1.1, elite ? 40 : 30, elite ? 0.4 : 0.35, elite ? 1.5 : 1.4, BOND], `T${tier}`);
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2, seed: 13 });
|
||||
assert.deepEqual([u.skill.rule, sk.trigger.rawRule, sk.trigger.customRangeGrid.length], ['CUSTOM_RANGE', 'CUSTOM_RANGE_SEARCH_ENEMY', 21], `T${tier}: x-2 (21 tiles)`);
|
||||
h.run(10);
|
||||
u.skill.gainSp(999);
|
||||
h.run(1);
|
||||
assert.equal(u.skill.activations, 0, `T${tier}: no enemy around, no cast`);
|
||||
assert.ok(u.s.dodgePhys < 0.8, 'his dodge decayed');
|
||||
const e = h.spawn('enemy_dummy', { pos: [11, 7] }); // [1, 2] of his x-2
|
||||
assert.ok(h.runUntil(() => u.skill.active, 1), `T${tier}: cast`);
|
||||
assert.deepEqual([u.tileR, u.tileC], [11, 7], `T${tier}: moved onto its tile`);
|
||||
assert.equal(moves(h, u).length, 1, `T${tier}: one 【移动】`);
|
||||
approx(u.s.dodgePhys, 0.8, `T${tier}: 街头直觉 restarts with the 【移动】`);
|
||||
approx(u.s.atk, u.base.atk * (1 + b['attack@demetr_s3[bonus].atk']), `T${tier}: ATK +${b['attack@demetr_s3[bonus].atk'] * 100} %`);
|
||||
assert.equal(u.s.aspd, 100 + b['attack@demetr_s3[bonus].attack_speed'] + (mod ? 10 : 0), `T${tier}: ASPD`);
|
||||
const bond = bondOf(h);
|
||||
assert.ok(bond, `T${tier}: 牵绊`);
|
||||
assert.deepEqual([bond.tileR, bond.tileC, bond.ownerUnit === u, bond.s.flags.invulnerable, bond.s.flags.untargetable, bond.s.flags.isolated, bond.profile.noAttack, bond.s.blockCnt],
|
||||
[10, 5, true, true, true, true, true, 0], `T${tier}: on his tile, 无敌 / untargetable / 孤立, no attack, blocks nothing`);
|
||||
assert.equal(h.b.isReservedTile(10, 5), true, `T${tier}: nobody else deploys there`);
|
||||
// the crits
|
||||
const t0 = h.b.time;
|
||||
u.skill.extend(200);
|
||||
h.run(150);
|
||||
const hits = atkHits(h, u).filter((c) => c.t > t0 && c.target === e);
|
||||
const atk = u.s.atk;
|
||||
const big = hits.filter((c) => Math.abs(c.amount - atk * b['attack@demetr_s3[bonus].prob_atk_scale'] * (c.dmg.mul ?? 1)) < 1e-3 * atk).length;
|
||||
const plain = hits.filter((c) => Math.abs(c.amount - atk * (c.dmg.mul ?? 1)) < 1e-3 * atk).length;
|
||||
assert.equal(big + plain, hits.length, `T${tier}: every hit is ×1 or ×${b['attack@demetr_s3[bonus].prob_atk_scale']}`);
|
||||
assert.ok(Math.abs(big / hits.length - b['attack@demetr_s3[bonus].prob']) < 0.06, `T${tier}: ${big} / ${hits.length} ≈ ${b['attack@demetr_s3[bonus].prob']}`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S3 清算 targets: ground enemies only, on a tile he may take (melee-buildable low ground, nobody but him / 牵绊) — else he 【移动】s in place once; another target 1 s after his last damage, at once when the elite he attacked falls; moving home retreats 牵绊 first', () => {
|
||||
// (a) a flyer and an enemy on a floor tile (build NONE): an in-place move, 牵绊 never placed
|
||||
{
|
||||
const rows = { 11: '##hrrrfrrrfrrrrrrrf##' }; // (11, 6) = floor
|
||||
const { h, u } = field({ tier: 6, elite: true, mod: FGTY, skill: 2, rows });
|
||||
assert.equal(h.b.grid.canStand(11, 6), false);
|
||||
h.spawn('enemy_fly', { pos: [10, 6] });
|
||||
const onFloor = h.spawn('enemy_dummy', { pos: [11, 6] });
|
||||
u.skill.gainSp(999);
|
||||
assert.ok(h.runUntil(() => u.skill.active, 1), 'cast (the flyer counts for CUSTOM_RANGE)');
|
||||
assert.deepEqual([u.tileR, u.tileC, moves(h, u).length, !!bondOf(h)], [10, 5, 1, false], 'an in-place 【移动】, no 牵绊');
|
||||
assert.ok(onFloor.alive);
|
||||
done(h);
|
||||
}
|
||||
// (b) the idle re-target, the elite re-target, home
|
||||
{
|
||||
const { h, u } = field({ tier: 6, elite: true, mod: FGTY, skill: 2 });
|
||||
const e1 = h.spawn('enemy_dummy', { pos: [11, 7] });
|
||||
u.skill.gainSp(999);
|
||||
assert.ok(h.runUntil(() => u.skill.active, 1));
|
||||
assert.deepEqual([u.tileR, u.tileC], [11, 7]);
|
||||
h.run(2);
|
||||
h.b.kill(e1, null);
|
||||
const last = Math.max(...atkHits(h, u).map((c) => c.t));
|
||||
const e2 = h.spawn('enemy_dummy', { pos: [9, 6] });
|
||||
assert.ok(h.runUntil(() => u.tileR === 9 && u.tileC === 6, 3), 'the next target');
|
||||
assert.ok(h.b.time >= last + 1 - 1e-6 && h.b.time <= last + 1 + 0.1, `1 s after his last damage (${h.b.time} vs ${last})`);
|
||||
assert.equal(moves(h, u).length, 2);
|
||||
assert.deepEqual([bondOf(h).tileR, bondOf(h).tileC], [10, 5], 'one 牵绊, still on his tile');
|
||||
assert.equal(h.b.allyUnits.filter((a) => a.kind === 'token' && a.alive).length, 1);
|
||||
// the elite he attacks falls ⇒ at once (the next tick), not 1 s later
|
||||
h.b.kill(e2, null);
|
||||
const el = h.spawn('enemy_elite', { pos: [9, 6] }); // on his tile
|
||||
h.runUntil(() => atkHits(h, u).some((c) => c.target === el), 2);
|
||||
const home = h.spawn('enemy_dummy', { pos: [10, 5] }); // on 牵绊's tile: his located tile
|
||||
h.b.kill(el, null);
|
||||
const tk = h.b.time;
|
||||
assert.ok(h.runUntil(() => u.tileR === 10 && u.tileC === 5, 0.2), 'back home on the next tick');
|
||||
assert.ok(h.b.time - tk < 0.05, 'at once');
|
||||
assert.equal(bondOf(h), null, '牵绊 retreated first (his located tile)');
|
||||
assert.ok(home.alive);
|
||||
// the end: a 【返回】 in place, the SP emptied, a short 不死
|
||||
h.runUntil(() => !u.skill.active, 40);
|
||||
assert.deepEqual([u.tileR, u.tileC], [10, 5]);
|
||||
assert.ok(u.skill.sp < 0.1, `SP emptied (${u.skill.sp})`);
|
||||
assert.equal(moves(h, u).length, 4, 'cast, idle, elite, return');
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S3 清算: a lethal hit while it runs ⇒ 不死 / untargetable / no block / 禁疗, the skill ends at once and he returns (a short 不死 after); away without 牵绊 at the end ⇒ forced retreat', () => {
|
||||
{
|
||||
const { h, u } = field({ tier: 5, elite: false, skill: 2 });
|
||||
const e = h.spawn('enemy_dummy', { pos: [11, 7] });
|
||||
u.skill.gainSp(999);
|
||||
assert.ok(h.runUntil(() => u.skill.active, 1));
|
||||
assert.deepEqual([u.tileR, u.tileC], [11, 7]);
|
||||
h.b.dealDamage(e, u, { amount: 1e7, type: 'true' });
|
||||
assert.ok(u.alive, 'not knocked out');
|
||||
assert.ok(u.hp >= 1 && u.hp <= 1.0001, 'held at 1 HP');
|
||||
assert.deepEqual([u.s.flags.untargetable, u.s.flags.noBlock, u.s.flags.healFree], [true, true, true], 'demetr_s3[undeadable]');
|
||||
h.b.dealDamage(e, u, { amount: 1e7, type: 'true' });
|
||||
assert.ok(u.alive, 'still 不死 until the skill ends');
|
||||
h.step();
|
||||
h.step();
|
||||
assert.ok(!u.skill.active, 'the skill ended');
|
||||
assert.deepEqual([u.tileR, u.tileC, !!bondOf(h), !!u.findBuff(UNDEAD_KEY)], [10, 5, false, false], 'returned home');
|
||||
assert.equal(h.hooksOf('skillEnd').find((c) => c.unit === u)?.reason, 'fatal');
|
||||
h.b.dealDamage(e, u, { amount: 1e7, type: 'true' });
|
||||
assert.ok(u.alive, `a short 不死 after the return (${RETURN_UNDYING} s)`);
|
||||
h.run(RETURN_UNDYING + 0.05);
|
||||
h.b.dealDamage(e, u, { amount: 1e7, type: 'true' });
|
||||
assert.ok(!u.alive, 'then a knock-out');
|
||||
done(h);
|
||||
}
|
||||
{
|
||||
const { h, u } = field({ tier: 6, elite: true, mod: FGTY, skill: 2 });
|
||||
h.spawn('enemy_dummy', { pos: [9, 6] });
|
||||
u.skill.gainSp(999);
|
||||
assert.ok(h.runUntil(() => u.skill.active, 1));
|
||||
h.b.retreat(bondOf(h), { reason: 'expired', permanent: true });
|
||||
h.runUntil(() => !u.skill.active, 40);
|
||||
assert.ok(!u.alive && u.removeReason === 'retreat', 'forced retreat');
|
||||
assert.ok(h.b.isDown(u), 'lies down and redeploys by the normal rule');
|
||||
done(h);
|
||||
}
|
||||
// 牵绊 belongs to S3: never under S1 / S2
|
||||
for (const skill of [0, 1]) {
|
||||
const { h, u } = field({ tier: 6, elite: true, mod: FGTY, skill });
|
||||
for (const pos of [[10, 6], [11, 7], [9, 6]]) h.spawn('enemy_dummy', { pos });
|
||||
u.skill.gainSp(999);
|
||||
h.run(30);
|
||||
assert.equal(h.b.allyUnits.filter((a) => a.kind === 'token').length, 0, `S${skill + 1}: no 牵绊`);
|
||||
assert.equal(moves(h, u).length, 0, `S${skill + 1}: no 【移动】`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,363 @@
|
||||
// test/content/op_lessng.test.js — the 自选 operator kit of 止颂 (char_4011_lessng, 6★ 无畏者; kit
|
||||
// server/sim/content/kits/ops/op-lessng.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, DRE-X
|
||||
// “沉锋之束” or DRE-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_lessng.test.js
|
||||
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { makeBattle, enemyRec, chessRec, checkInvariants } from '../helpers/battleHarness.js';
|
||||
import { KITTED_CHARS, OPERATOR_KITS, KITS } from '../../server/sim/content/kits/index.js';
|
||||
import { DUEL_KEY, OATH_KEY, PAIN_KEY, REBORN_KEY } from '../../server/sim/content/kits/ops/op-lessng.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 LESSNG = 'char_4011_lessng';
|
||||
const FORMS = BACKUPS.units[LESSNG].forms;
|
||||
const SLOT = { 5: 'chess_char_5_diy1_a', 6: 'chess_char_6_diy1_a' };
|
||||
const DREX = 'uniequip_002_lessng', DREY = 'uniequip_003_lessng';
|
||||
const S1 = 'skchr_lessng_1', S2 = 'skchr_lessng_2', S3 = 'skchr_lessng_3';
|
||||
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);
|
||||
const talentOf = (u, i) => u.def.raw.talents.find((t) => t.index === i)?.bb ?? {};
|
||||
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_walk: enemyRec({ key: 'enemy_walk', hp: 1e9, speed: 0.6, mass: 0 }) };
|
||||
const FORMS_ALL = [[5, false, null], [6, false, null], ...[5, 6].flatMap((t) => [null, DREX, DREY].map((m) => [t, true, m]))];
|
||||
/** A plain ally (no kit, no damage modifiers) for friendly-damage checks. */
|
||||
const PLAIN = chessRec({ id: 'test_plain_a', name: '测试', skill: null });
|
||||
|
||||
/** 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 = 5, others = [], seed = 5 } = {}) {
|
||||
const h = makeBattle({
|
||||
defs: { enemies: ENEMIES, chess: { test_plain_a: PLAIN } }, timeLimit: 600, autoFinish: false, seed,
|
||||
flags: { dpPerSec: 0, dpMax: 999 }, hooks: ['damaged', 'skillStart', 'skillEnd', 'statusApplied'], captureNoisy: true,
|
||||
units: [{ uid: 1, diy: { slot: SLOT[tier], charId: LESSNG, skillIndex: skill, uniEquipId: mod }, elite, row, col }, ...others],
|
||||
});
|
||||
h.step();
|
||||
return { h, u: h.unit(1) };
|
||||
}
|
||||
/** 止颂 on row 9 with a walker blocked by her. */
|
||||
function blocked(o = {}) {
|
||||
const r = field({ row: 9, ...o });
|
||||
const w = r.h.spawn('enemy_walk', { routeIndex: 0 });
|
||||
assert.ok(r.h.runUntil(() => w.blockedBy === r.u, 30), 'the walker reaches her');
|
||||
return { ...r, w };
|
||||
}
|
||||
const atkHits = (h, u) => h.hooksOf('damaged').filter((c) => c.source === u && c.dmg?.isAttack);
|
||||
const noSp = (h, u) => h.b.addBuff(u, { key: 'test:noSp', flags: { noSp: true } }); // 阻回: the MANUAL skill stays off
|
||||
function done(h) {
|
||||
checkInvariants(h.b);
|
||||
assert.equal(h.b.errors.length, 0, JSON.stringify(h.b.errors[0]));
|
||||
}
|
||||
const label = ([tier, elite, mod]) => `T${tier} ${elite ? 'elite' : 'normal'} ${mod ?? 'none'}`;
|
||||
|
||||
test('止颂 in every 自选 form: his operator kit (all three skills authored), the form\'s stats + module attributes, 1-1, blocks 1, melee ground-only, 1.5 s, 莱塔尼亚, no 特质', () => {
|
||||
assert.equal(OPERATOR_KITS[LESSNG], KITS[LESSNG]);
|
||||
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], [LESSNG, SLOT[tier], form.skills[skill].skillId, false, 'skills'], label(f));
|
||||
assert.deepEqual([u.base.maxHp, u.base.atk, u.base.def], [form.stats.maxHp + (m?.attr.maxHp ?? 0), form.stats.atk + (m?.attr.atk ?? 0), form.stats.def + (m?.attr.def ?? 0)], `${label(f)}: stats`);
|
||||
assert.deepEqual([u.base.blockCnt, u.profile.attack, u.profile.canHitFly, u.profile.sub, u.base.bat, u.dmgType], [1, 'melee', false, 'fearless', 1.5, 'phys'], `${label(f)}: 无畏者`);
|
||||
assert.deepEqual(u.liveRangeGrid, form.rangeGrid, `${label(f)}: 1-1`);
|
||||
assert.deepEqual([u.def.bonds, u.def.raw.garrisonIds, u.def.raw.nationId], [['emptyShip'], [], 'leithanien'], `${label(f)}: bonds / 特质`);
|
||||
assert.ok(!u.s.flags.liftoff && !u.s.flags.camou && !u.s.flags.stealth, `${label(f)}: ground enemies target him`);
|
||||
done(h);
|
||||
}
|
||||
}
|
||||
// E2 Lv1 2798 / 866 / 232, E2 Lv60 3384 / 984 / 262; DRE-X +230 / +17 / +17 → +400 / +30 / +30; DRE-Y +300 / +55 → +450 / +80
|
||||
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], [2798, 866, 3384, 984]);
|
||||
assert.deepEqual([modOf(5, DREX).attr, modOf(6, DREX).attr, modOf(5, DREY).attr, modOf(6, DREY).attr],
|
||||
[{ maxHp: 230, atk: 17, def: 17 }, { maxHp: 400, atk: 30, def: 30 }, { maxHp: 300, atk: 55 }, { maxHp: 450, atk: 80 }]);
|
||||
});
|
||||
|
||||
test('a 自选 pick: 止颂 is offered at tiers 5 and 6 and a roster with him passes validateDiyPicks', () => {
|
||||
const data = { chess: CHESS, backups: BACKUPS };
|
||||
assert.ok(KITTED_CHARS.includes(LESSNG));
|
||||
for (const t of [5, 6]) assert.ok(diyPool(t, { data, kitted: KITTED_CHARS }).includes(LESSNG), `tier ${t}`);
|
||||
assert.deepEqual(validateDiyPicks({ [SLOT[6]]: { charId: LESSNG, skillIndex: 1, uniEquipId: DREY } }, { data, kitted: KITTED_CHARS }),
|
||||
{ ok: true, picks: { [SLOT[6]]: { charId: LESSNG, skillIndex: 1, uniEquipId: DREY } } });
|
||||
});
|
||||
|
||||
test('T1 苦痛专注: while he blocks, physical / arts damage from anyone but an enemy he blocks — 无来源, allies, himself included — ×0.65 (DRE-Y stage 3: ×0.6); none while not blocking, none on true damage', () => {
|
||||
for (const f of FORMS_ALL) {
|
||||
const [tier, elite, mod] = f;
|
||||
const y3 = elite && mod === DREY && tier === 6;
|
||||
const cut = talentOf(field({ tier, elite, mod }).u, 0).damage_resistance;
|
||||
assert.equal(cut, y3 ? 0.4 : 0.35, `${label(f)}: the talent of the form`);
|
||||
const { h, u, w } = blocked({ tier, elite, mod, others: [{ uid: 2, chessId: 'test_plain_a', row: 11, col: 3 }] });
|
||||
const ally = h.unit(2);
|
||||
const other = h.spawn('enemy_dummy', { pos: [11, 8] });
|
||||
const hit = (src, d) => { u.hp = u.s.maxHp; return h.b.dealDamage(src, u, d); }; // (full HP: the return value is the HP removed)
|
||||
const arts = (src) => hit(src, { amount: 1000, type: 'arts' });
|
||||
approx(arts(other), 1000 * (1 - cut), `${label(f)}: an enemy he does not block`);
|
||||
approx(arts(w), 1000, `${label(f)}: the enemy he blocks`);
|
||||
approx(arts(null), 1000 * (1 - cut), `${label(f)}: 无来源`);
|
||||
approx(arts(ally), 1000 * (1 - cut), `${label(f)}: an ally`);
|
||||
approx(arts(u), 1000 * (1 - cut), `${label(f)}: himself`);
|
||||
approx(hit(other, { amount: 1000, type: 'true' }), 1000, `${label(f)}: true damage`);
|
||||
approx(hit(other, { amount: 2000, type: 'phys' }), (2000 - u.s.def) * (1 - cut), `${label(f)}: physical`);
|
||||
u.hp = u.s.maxHp;
|
||||
h.b.releaseBlocked(u);
|
||||
h.b.kill(w, null);
|
||||
h.step();
|
||||
assert.equal(u.blocking.length, 0);
|
||||
approx(arts(other), 1000, `${label(f)}: not while he blocks nobody`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('T2 痛楚砺刃: any damage aimed at him (a dodged one too) ⇒ ATK +12 % (DRE-X stage 3: +20 %) for 15 s, refreshed, never stacked', () => {
|
||||
for (const f of FORMS_ALL) {
|
||||
const [tier, elite, mod] = f;
|
||||
const { h, u } = field({ tier, elite, mod });
|
||||
const t = talentOf(u, 1);
|
||||
const x3 = elite && mod === DREX && tier === 6;
|
||||
assert.deepEqual([t.atk, t.add_atk_duration], [x3 ? 0.2 : 0.12, 15], `${label(f)}: the talent of the form`);
|
||||
const e = h.spawn('enemy_dummy', { pos: [11, 8] });
|
||||
assert.equal(u.findBuff(PAIN_KEY), null);
|
||||
h.b.addBuff(u, { key: 'test:dodge', mods: { dodgePhys: 1 } });
|
||||
assert.equal(h.b.dealDamage(e, u, { amount: 500, type: 'phys' }), 0, `${label(f)}: dodged`);
|
||||
assert.deepEqual(u.findBuff(PAIN_KEY)?.mods, { atkPct: t.atk }, `${label(f)}: still triggered`);
|
||||
approx(u.s.atk, u.base.atk * (1 + t.atk), `${label(f)}: ATK +${t.atk * 100} %`);
|
||||
h.b.removeBuff(u, 'test:dodge');
|
||||
h.run(10);
|
||||
h.b.dealDamage(e, u, { amount: 100, type: 'arts' });
|
||||
h.b.dealDamage(null, u, { amount: 100, type: 'true' });
|
||||
approx(u.findBuff(PAIN_KEY).timeLeft, 15, `${label(f)}: refreshed to 15 s`, 0.01);
|
||||
approx(u.s.atk, u.base.atk * (1 + t.atk), `${label(f)}: not stacked`);
|
||||
h.run(15.1);
|
||||
assert.equal(u.findBuff(PAIN_KEY), null, `${label(f)}: gone 15 s after the last hit`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S1 强力击·γ型 (AUTO, attack SP 3, data DEFAULT): the next attack at 205 % / 225 % ATK (× DRE-X 115 % on a blocked target)', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, DREX], [5, true, DREY]]) {
|
||||
const sk = skillOf(tier, elite, S1);
|
||||
const { h, u, w } = blocked({ tier, elite, mod, skill: 0 });
|
||||
assert.deepEqual([u.skill.rule, u.skill.spType, u.skill.spCost, sk.skillType, sk.bb.atk_scale], ['DEFAULT', 'attack', 3, 'AUTO', elite ? 2.25 : 2.05], `T${tier}`);
|
||||
const scale = mod === DREX ? modOf(tier, DREX).traitOverride.bb.atk_scale : 1;
|
||||
const t0 = h.b.time;
|
||||
assert.ok(h.runUntil(() => atkHits(h, u).some((c) => c.dmg.isSkill && c.t > t0), 20), `T${tier}: cast`);
|
||||
const hits = atkHits(h, u).filter((c) => c.t > t0 && c.target === w);
|
||||
const sk1 = hits.find((c) => c.dmg.isSkill);
|
||||
approx(sk1.amount, u.s.atk * sk.bb.atk_scale * scale, `T${tier}: ${sk.bb.atk_scale * 100} %`);
|
||||
for (const c of hits.filter((x) => !x.dmg.isSkill)) approx(c.amount, u.s.atk * scale, `T${tier}: plain attacks`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S2 虔修对决 (PASSIVE, 部署后): for 18 / 21 s from every deployment ATK +25 / 35 %, two strikes per attack and 苦痛专注 ×2; then single strikes', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, DREY], [6, true, DREX]]) {
|
||||
const sk = skillOf(tier, elite, S2);
|
||||
assert.deepEqual([sk.skillType, sk.spType, sk.duration, sk.bb.atk, sk.bb.talent_scale], ['PASSIVE', 'ON_DEPLOY', elite ? 21 : 18, elite ? 0.35 : 0.25, 2], `T${tier}`);
|
||||
const { h, u, w } = blocked({ tier, elite, mod, skill: 1 });
|
||||
const cut = talentOf(u, 0).damage_resistance;
|
||||
assert.ok(h.b.time < sk.duration, 'the walker arrived inside the window');
|
||||
assert.deepEqual(u.findBuff(DUEL_KEY)?.mods, { atkPct: sk.bb.atk }, `T${tier}: ATK +${sk.bb.atk * 100} %`);
|
||||
const other = h.spawn('enemy_dummy', { pos: [11, 8] });
|
||||
approx(h.b.dealDamage(other, u, { amount: 1000, type: 'arts' }), 1000 * (1 - cut * 2), `T${tier}: 苦痛专注 ×2`);
|
||||
const t0 = h.b.time;
|
||||
h.runUntil(() => !u.findBuff(DUEL_KEY), 30);
|
||||
approx(h.b.time, sk.duration, `T${tier}: the window ends ${sk.duration} s after the deployment`, 0.05);
|
||||
const inWin = new Map();
|
||||
for (const c of atkHits(h, u).filter((x) => x.t > t0)) inWin.set(c.dmg.attackId, (inWin.get(c.dmg.attackId) ?? 0) + 1);
|
||||
assert.ok(inWin.size >= 2 && [...inWin.values()].every((n) => n === 2), `T${tier}: two strikes per attack (${[...inWin.values()]})`);
|
||||
const t1 = h.b.time;
|
||||
h.run(5);
|
||||
const after = new Map();
|
||||
for (const c of atkHits(h, u).filter((x) => x.t > t1)) after.set(c.dmg.attackId, (after.get(c.dmg.attackId) ?? 0) + 1);
|
||||
assert.ok(after.size >= 2 && [...after.values()].every((n) => n === 1), `T${tier}: single strikes after`);
|
||||
approx(u.s.atk, u.base.atk * (1 + (u.findBuff(PAIN_KEY) ? talentOf(u, 1).atk : 0)), `T${tier}: ATK back`);
|
||||
approx(h.b.dealDamage(other, u, { amount: 1000, type: 'arts' }), 1000 * (1 - cut), `T${tier}: 苦痛专注 ×1`);
|
||||
// a redeploy restarts the window
|
||||
h.b.retreat(u);
|
||||
h.b.redeploy(u);
|
||||
h.step();
|
||||
approx(u.findBuff(DUEL_KEY)?.timeLeft ?? 0, sk.duration, `T${tier}: again for ${sk.duration} s`, 0.05);
|
||||
assert.equal(w.alive, true);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S3 苦修破誓 (MANUAL, data DEFAULT): 20 s, max HP +65 / 80 %, a blocked target at 160 % / 180 % ATK (× DRE-X), no 异常状态 while it runs; then all back', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, DREX], [5, true, DREY]]) {
|
||||
const sk = skillOf(tier, elite, S3);
|
||||
const b = sk.bb;
|
||||
assert.deepEqual([sk.duration, b.max_hp, b['lessng_s3[atk_scale].atk_scale'], b.magical_value, sk.skillType], [20, elite ? 0.8 : 0.65, elite ? 1.8 : 1.6, 600, 'MANUAL'], `T${tier}`);
|
||||
const { h, u, w } = blocked({ tier, elite, mod, skill: 2 });
|
||||
assert.equal(u.skill.rule, 'DEFAULT');
|
||||
const unb = h.spawn('enemy_dummy', { pos: [9, 5] }); // on his tile beside the walker: he blocks only one
|
||||
const hp0 = u.hp, max0 = u.s.maxHp;
|
||||
u.skill.gainSp(999);
|
||||
assert.ok(h.runUntil(() => u.skill.active, 3), `T${tier}: cast`);
|
||||
approx(u.skill.timeLeft, 20, `T${tier}: 20 s`, 0.05);
|
||||
approx(u.s.maxHp, max0 * (1 + b.max_hp), `T${tier}: max HP +${b.max_hp * 100} %`);
|
||||
approx(u.hp / u.s.maxHp, hp0 / max0, `T${tier}: ratio kept`);
|
||||
for (const st of ['stun', 'cold', 'freeze', 'sleep', 'silence', 'fear']) assert.equal(h.b.applyStatus(u, st, { duration: 3, source: w }), false, `T${tier}: immune to ${st}`);
|
||||
const scale = mod === DREX ? modOf(tier, DREX).traitOverride.bb.atk_scale : 1;
|
||||
const t0 = h.b.time;
|
||||
h.run(6);
|
||||
const hits = atkHits(h, u).filter((c) => c.t > t0);
|
||||
assert.ok(hits.length >= 3);
|
||||
for (const c of hits) {
|
||||
if (c.target === w) approx(c.amount, u.s.atk * b['lessng_s3[atk_scale].atk_scale'] * scale, `T${tier}: blocked ×${b['lessng_s3[atk_scale].atk_scale']}`);
|
||||
else approx(c.amount, unb.blockedBy ? u.s.atk * b['lessng_s3[atk_scale].atk_scale'] * scale : u.s.atk, `T${tier}: the other target`);
|
||||
}
|
||||
h.runUntil(() => !u.skill.active, 20);
|
||||
h.step();
|
||||
assert.equal(u.findBuff(OATH_KEY), null);
|
||||
approx(u.s.maxHp, max0, `T${tier}: max HP back`);
|
||||
assert.equal(h.b.applyStatus(u, 'stun', { duration: 0.5, source: w }), true, `T${tier}: stuns land again`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S3 苦修破誓 cast under a 异常状态: 600 arts to himself first (苦痛专注 applies while he blocks; may knock him out), every 异常状态 cleansed, then the HP; 沉默 does not hold the cast back, 晕眩 does (no attack)', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, DREX]]) {
|
||||
const cut = 0.35;
|
||||
// cold: he still attacks, the basic strategy casts; he blocks ⇒ 600 × 0.65
|
||||
{
|
||||
const { h, u, w } = blocked({ tier, elite, mod, skill: 2 });
|
||||
h.b.applyStatus(u, 'cold', { duration: 20, source: w });
|
||||
const hp0 = u.hp, max0 = u.s.maxHp;
|
||||
u.skill.gainSp(999);
|
||||
assert.ok(h.runUntil(() => u.skill.active, 5), `T${tier}: cast while cold`);
|
||||
const self = h.hooksOf('damaged').filter((c) => c.source === u && c.target === u);
|
||||
assert.equal(self.length, 1, `T${tier}: one self hit`);
|
||||
assert.deepEqual([self[0].type, Math.round(self[0].amount)], ['arts', Math.round(600 * (1 - cut))], `T${tier}: 600 arts ×0.65`);
|
||||
assert.ok(!u.buffs.some((x) => x.status === 'cold'), `T${tier}: cold cleansed`);
|
||||
approx(u.hp, (hp0 - 600 * (1 - cut)) / max0 * u.s.maxHp, `T${tier}: the HP buff after the damage (ratio of the hurt HP)`);
|
||||
assert.ok(u.findBuff(PAIN_KEY), `T${tier}: 痛楚砺刃 saw it`);
|
||||
done(h);
|
||||
}
|
||||
// 沉默: the engine's basic strategy refuses a silenced cast — this skill "可以无视异常状态开启"
|
||||
{
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2 });
|
||||
h.spawn('enemy_dummy', { pos: [10, 6] });
|
||||
h.b.applyStatus(u, 'silence', { duration: 20, source: null });
|
||||
u.skill.gainSp(999);
|
||||
assert.ok(h.runUntil(() => u.skill.active, 5), `T${tier}: cast while silenced`);
|
||||
assert.equal(h.hooksOf('skillStart').find((c) => c.unit === u)?.reason, 'abnormal');
|
||||
assert.equal(Math.round(h.hooksOf('damaged').find((c) => c.source === u && c.target === u)?.amount), 600, `T${tier}: 600 arts (he blocks nobody)`);
|
||||
assert.ok(!u.s.flags.silence, `T${tier}: silence cleansed`);
|
||||
done(h);
|
||||
}
|
||||
// 晕眩: no attack ⇒ no cast until it ends (then no abnormal state, no self damage)
|
||||
{
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2 });
|
||||
h.spawn('enemy_dummy', { pos: [10, 6] });
|
||||
h.b.applyStatus(u, 'stun', { duration: 3, source: null });
|
||||
u.skill.gainSp(999);
|
||||
h.run(2.5);
|
||||
assert.equal(u.skill.activations, 0, `T${tier}: not while stunned`);
|
||||
assert.ok(h.runUntil(() => u.skill.active, 3), `T${tier}: once the stun ends`);
|
||||
assert.equal(h.hooksOf('damaged').filter((c) => c.source === u && c.target === u).length, 0, `T${tier}: no self damage`);
|
||||
done(h);
|
||||
}
|
||||
// the self damage may knock him out (可致死)
|
||||
{
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2 });
|
||||
h.spawn('enemy_dummy', { pos: [10, 6] });
|
||||
h.b.applyStatus(u, 'cold', { duration: 20, source: null });
|
||||
u.hp = 300;
|
||||
u.skill.gainSp(999);
|
||||
assert.ok(h.runUntil(() => !u.alive, 5), `T${tier}: knocked out by his own 600`);
|
||||
assert.equal(u.findBuff(OATH_KEY), null);
|
||||
done(h);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('DRE-X “沉锋之束”: his attacks ×115 % on a target blocked by anyone (another operator\'s too), ×1 on an unblocked one — stages 1 and 3; none without it', () => {
|
||||
for (const f of FORMS_ALL) {
|
||||
const [tier, elite, mod] = f;
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2, others: [{ uid: 2, chessId: 'chess_char_1_02_a', row: 10, col: 6 }] });
|
||||
noSp(h, u);
|
||||
const yak = h.unit(2);
|
||||
const e = h.spawn('enemy_dummy', { pos: [10, 6] }); // blocked by 角峰, on his front tile
|
||||
h.step();
|
||||
assert.equal(e.blockedBy, yak);
|
||||
const x = elite && mod === DREX;
|
||||
if (x) assert.equal(u.def.raw.trait.bb.atk_scale, 1.15, label(f));
|
||||
h.run(6);
|
||||
const hits = atkHits(h, u).filter((c) => c.target === e);
|
||||
assert.ok(hits.length >= 3, label(f));
|
||||
for (const c of hits) approx(c.amount, u.s.atk * (x ? 1.15 : 1), `${label(f)}: ×${x ? 1.15 : 1}`);
|
||||
h.b.releaseBlocked(yak);
|
||||
h.b.retreat(yak);
|
||||
h.step();
|
||||
assert.ok(!e.blockedBy);
|
||||
const t0 = h.b.time;
|
||||
h.run(4);
|
||||
for (const c of atkHits(h, u).filter((y) => y.t > t0)) approx(c.amount, u.s.atk, `${label(f)}: unblocked ×1`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('DRE-Y “苦修者的抗压训练”: the first lethal hit of a deployment ⇒ max HP ×0.4, ASPD +30, full HP (once; again after a redeploy; not while a 不死 holds him); stage 3: 12 % of DEF ignored on the enemy he blocks', () => {
|
||||
for (const tier of [5, 6]) {
|
||||
const { h, u } = field({ tier, elite: true, mod: DREY });
|
||||
const tb = u.def.raw.trait.bb;
|
||||
assert.deepEqual([tb.attack_speed, tb.max_hp, tb.hp_ratio, tb.value], [30, 0.4, 1, 0.6], `T${tier}: trait bb`);
|
||||
const e = h.spawn('enemy_dummy', { pos: [11, 8] });
|
||||
const max0 = u.s.maxHp, aspd0 = u.s.aspd;
|
||||
h.b.dealDamage(e, u, { amount: 1e7, type: 'true' });
|
||||
assert.ok(u.alive, `T${tier}: not knocked out`);
|
||||
approx(u.s.maxHp, max0 * 0.4, `T${tier}: max HP ×0.4`);
|
||||
approx(u.hp, u.s.maxHp, `T${tier}: full HP of the new max`);
|
||||
assert.equal(u.s.aspd, aspd0 + 30, `T${tier}: ASPD +30`);
|
||||
assert.ok(u.findBuff(REBORN_KEY));
|
||||
h.b.dealDamage(e, u, { amount: 1e7, type: 'true' });
|
||||
assert.ok(!u.alive, `T${tier}: once per deployment`);
|
||||
h.b.redeploy(u);
|
||||
h.step();
|
||||
approx(u.s.maxHp, max0, `T${tier}: a new deployment: max HP back`);
|
||||
h.b.dealDamage(e, u, { amount: 1e7, type: 'true' });
|
||||
assert.ok(u.alive, `T${tier}: again after the redeploy`);
|
||||
done(h);
|
||||
// a running 不死 (坚固维式重锤's window) holds him instead: the module is not used
|
||||
const r = field({ tier, elite: true, mod: DREY });
|
||||
r.u.mem.undyingAt = `${r.u.deploySeq}:0`;
|
||||
r.u.mem.undyingUntil = r.h.b.time + 5;
|
||||
const hammer = r.h.b.on('fatal', (c) => { if (c.unit === r.u && !c.prevented) c.prevented = true; }, { priority: -99 });
|
||||
const f = r.h.spawn('enemy_dummy', { pos: [11, 8] });
|
||||
r.h.b.dealDamage(f, r.u, { amount: 1e7, type: 'true' });
|
||||
assert.ok(r.u.alive && r.u.hp < 2 && !r.u.findBuff(REBORN_KEY), `T${tier}: held by the 不死, the module untouched`);
|
||||
r.h.b.off(hammer);
|
||||
r.u.mem.undyingUntil = 0;
|
||||
r.h.b.dealDamage(f, r.u, { amount: 1e7, type: 'true' });
|
||||
assert.ok(r.u.alive && r.u.findBuff(REBORN_KEY), `T${tier}: the module afterwards`);
|
||||
done(r.h);
|
||||
}
|
||||
// stage 3's hidden part: 无视目标12%的防御力 on the enemy he blocks (none at stage 1, none on an unblocked enemy)
|
||||
for (const tier of [5, 6]) {
|
||||
const ENEMY_DEF = 1000;
|
||||
const h = makeBattle({
|
||||
defs: { enemies: { enemy_walk: enemyRec({ key: 'enemy_walk', hp: 1e9, speed: 0.6, mass: 0, def: ENEMY_DEF }), enemy_dummy: dummy('enemy_dummy', { def: ENEMY_DEF }) } },
|
||||
timeLimit: 600, autoFinish: false, seed: 5, flags: { dpPerSec: 0 }, hooks: ['damaged'], captureNoisy: true,
|
||||
units: [{ uid: 1, diy: { slot: SLOT[tier], charId: LESSNG, skillIndex: 2, uniEquipId: DREY }, elite: true, row: 9, col: 5 }],
|
||||
});
|
||||
h.step();
|
||||
const u = h.unit(1);
|
||||
noSp(h, u);
|
||||
const w = h.spawn('enemy_walk', { routeIndex: 0 });
|
||||
assert.ok(h.runUntil(() => w.blockedBy === u, 30));
|
||||
const t0 = h.b.time;
|
||||
h.run(6);
|
||||
const pen = tier === 6 ? 0.12 : 0;
|
||||
const hits = atkHits(h, u).filter((c) => c.t > t0 && c.target === w);
|
||||
assert.ok(hits.length >= 3);
|
||||
for (const c of hits) approx(c.amount, Math.max(u.s.atk - ENEMY_DEF * (1 - pen), u.s.atk * 0.05), `T${tier}: DEF ×${1 - pen}`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,324 @@
|
||||
// test/content/op_pallas.test.js — the 自选 operator kit of 帕拉斯 (char_485_pallas, 6★ 教官; kit
|
||||
// server/sim/content/kits/ops/op-pallas.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, INS-X
|
||||
// “故乡的山岩” or INS-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_pallas.test.js
|
||||
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { makeBattle, enemyRec, chessRec, checkInvariants } from '../helpers/battleHarness.js';
|
||||
import { KITTED_CHARS, OPERATOR_KITS, KITS } from '../../server/sim/content/kits/index.js';
|
||||
import { PEAK_KEY, holderKey } from '../../server/sim/content/kits/ops/op-pallas.js';
|
||||
import { diyPool, validateDiyPicks, diyRecord } from '../../shared/diy.js';
|
||||
import { positionClass } from '../../server/match/board.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 PALLAS = 'char_485_pallas';
|
||||
const FORMS = BACKUPS.units[PALLAS].forms;
|
||||
const SLOT = { 5: 'chess_char_5_diy1_a', 6: 'chess_char_6_diy1_a' };
|
||||
const INSX = 'uniequip_002_pallas', INSY = 'uniequip_003_pallas';
|
||||
const S1 = 'skchr_pallas_1', S2 = 'skchr_pallas_2', S3 = 'skchr_pallas_3';
|
||||
/** The unit form of a slot (tier, normal / elite). */
|
||||
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);
|
||||
/** A talent of the composed record the unit fights with (module changes applied). */
|
||||
const talentOf = (u, i) => u.def.raw.talents.find((t) => t.index === i)?.bb ?? {};
|
||||
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_walk: enemyRec({ key: 'enemy_walk', hp: 1e9, speed: 0.6, mass: 0 }) };
|
||||
/** A 米诺斯 operator of no kit (帕拉斯 is the only one of the data): a plain melee record with nationId minos. */
|
||||
const MINOS_OP = { ...chessRec({ id: 'test_minos_a', name: '米诺斯测试', stats: { maxHp: 2000, atk: 500, def: 200, blockCnt: 1 }, skill: null }), nationId: 'minos' };
|
||||
/** Every 自选 form: [tier, elite, module]. */
|
||||
const FORMS_ALL = [[5, false, null], [6, false, null], ...[5, 6].flatMap((t) => [null, INSX, INSY].map((m) => [t, true, m]))];
|
||||
|
||||
/** A battle with 帕拉斯 as uid 1 at (row, col) facing RIGHT, plus `others`. */
|
||||
function field({ tier = 5, elite = false, mod = null, skill = 2, row = 10, col = 5, others = [], seed = 5, rows = null } = {}) {
|
||||
const h = makeBattle({
|
||||
defs: { enemies: ENEMIES, chess: { test_minos_a: MINOS_OP } }, timeLimit: 600, autoFinish: false, seed,
|
||||
...(rows ? { stageId: undefined, flat: { rows } } : {}),
|
||||
flags: { dpPerSec: 0, dpMax: 999 }, hooks: ['damaged', 'heal', 'skillStart', 'skillEnd', 'statusApplied'], captureNoisy: true,
|
||||
units: [{ uid: 1, diy: { slot: SLOT[tier], charId: PALLAS, 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]));
|
||||
}
|
||||
const label = ([tier, elite, mod]) => `T${tier} ${elite ? 'elite' : 'normal'} ${mod ?? 'none'}`;
|
||||
/** The instructor scale of a form (trait bb atk_scale; INS-X's override). */
|
||||
const traitScale = (tier, elite, mod) => (elite && mod ? modOf(tier, mod).traitOverride.bb.atk_scale : formOf(tier, elite).trait.bb.atk_scale);
|
||||
|
||||
test('帕拉斯 in every 自选 form: her operator kit (all three skills authored), the form\'s stats + module attributes, 2-2, blocks 2, melee ground-only, 教官 ×1.2 (INS-X ×1.3), 米诺斯, no 特质', () => {
|
||||
assert.equal(OPERATOR_KITS[PALLAS], KITS[PALLAS]);
|
||||
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], [PALLAS, SLOT[tier], form.skills[skill].skillId, false, 'skills'], label(f));
|
||||
assert.deepEqual([u.base.maxHp, u.base.atk, u.base.def, u.base.aspd],
|
||||
[form.stats.maxHp + (m?.attr.maxHp ?? 0), form.stats.atk + (m?.attr.atk ?? 0), form.stats.def + (m?.attr.def ?? 0), form.stats.aspd + (m?.attr.aspd ?? 0)], `${label(f)}: stats`);
|
||||
assert.deepEqual([u.s.blockCnt, u.profile.attack, u.profile.canHitFly, u.profile.sub, u.base.bat, u.dmgType], [2, 'melee', false, 'instructor', 1.05, 'phys'], `${label(f)}: 教官`);
|
||||
approx(u.profile.unblockedScale, traitScale(tier, elite, mod), `${label(f)}: 教官 scale`);
|
||||
assert.deepEqual(u.liveRangeGrid, form.rangeGrid, `${label(f)}: 2-2`);
|
||||
assert.deepEqual([u.def.bonds, u.def.raw.garrisonIds, u.def.raw.nationId], [['emptyShip'], [], 'minos'], `${label(f)}: bonds / 特质 / nation`);
|
||||
assert.ok(!u.s.flags.liftoff && !u.s.flags.camou && !u.s.flags.stealth, `${label(f)}: ground enemies target her`);
|
||||
done(h);
|
||||
}
|
||||
}
|
||||
// the numbers of the forms (zh_CN): E2 Lv1 1413 / 577 / 382, E2 Lv60 1778 / 650 / 430; INS-X +150 HP +55 ATK → +210 / +83,
|
||||
// trait 130 %; INS-Y +40 ATK +3 ASPD → +60 / +5
|
||||
assert.deepEqual([FORMS['2/1/4/0'].stats.maxHp, FORMS['2/1/4/0'].stats.atk, FORMS['2/1/4/0'].stats.def, FORMS['2/60/7/1'].stats.maxHp, FORMS['2/60/7/1'].stats.atk], [1413, 577, 382, 1778, 650]);
|
||||
assert.deepEqual([modOf(5, INSX).attr, modOf(6, INSX).attr, modOf(5, INSY).attr, modOf(6, INSY).attr], [{ maxHp: 150, atk: 55 }, { maxHp: 210, atk: 83 }, { atk: 40, aspd: 3 }, { atk: 60, aspd: 5 }]);
|
||||
assert.deepEqual([formOf(5, false).trait.bb.atk_scale, modOf(5, INSX).traitOverride.bb.atk_scale, modOf(6, INSY).traitOverride.bb.atk_scale], [1.2, 1.3, 1.2]);
|
||||
});
|
||||
|
||||
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(PALLAS));
|
||||
for (const t of [5, 6]) assert.ok(diyPool(t, { data, kitted: KITTED_CHARS }).includes(PALLAS), `tier ${t}`);
|
||||
assert.deepEqual(validateDiyPicks({ [SLOT[5]]: { charId: PALLAS, skillIndex: 2, uniEquipId: INSY } }, { data, kitted: KITTED_CHARS }),
|
||||
{ ok: true, picks: { [SLOT[5]]: { charId: PALLAS, skillIndex: 2, uniEquipId: INSY } } });
|
||||
});
|
||||
|
||||
test('trait 教官: her attack ×1.2 (INS-X ×1.3) on an enemy she does not block, ×1 on the one she blocks; flyers are out of her reach', () => {
|
||||
for (const f of [[5, false, null], [5, true, INSX], [6, true, INSX], [6, true, INSY]]) {
|
||||
const [tier, elite, mod] = f;
|
||||
const scale = traitScale(tier, elite, mod);
|
||||
const noSp = (h, u) => h.b.addBuff(u, { key: 'test:noSp', flags: { noSp: true } }); // (阻回: S3 stays off)
|
||||
{
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2 });
|
||||
noSp(h, u);
|
||||
const e = h.spawn('enemy_dummy', { pos: [10, 7] });
|
||||
const fly = h.spawn('enemy_fly', { pos: [10, 6] });
|
||||
h.run(6);
|
||||
const hits = atkHits(h, u);
|
||||
assert.ok(hits.length >= 3, `${label(f)}: she attacks (${hits.length})`);
|
||||
for (const c of hits) {
|
||||
assert.equal(c.target, e, `${label(f)}: only the ground dummy`);
|
||||
approx(c.amount, u.s.atk * scale, `${label(f)}: unblocked ×${scale}`);
|
||||
assert.equal(c.type, 'phys');
|
||||
}
|
||||
assert.ok(!h.hooksOf('damaged').some((c) => c.target === fly), `${label(f)}: no anti-air`);
|
||||
done(h);
|
||||
}
|
||||
{
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2, row: 9 });
|
||||
noSp(h, u);
|
||||
const w = h.spawn('enemy_walk', { routeIndex: 0 });
|
||||
assert.ok(h.runUntil(() => w.blockedBy === u, 30), `${label(f)}: the walker reaches her`);
|
||||
const t0 = h.b.time;
|
||||
h.run(6);
|
||||
const hits = atkHits(h, u).filter((c) => c.t > t0);
|
||||
assert.ok(hits.length >= 3, `${label(f)}: she attacks the enemy she blocks`);
|
||||
for (const c of hits) approx(c.amount, u.s.atk, `${label(f)}: blocked ×1`);
|
||||
done(h);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('T1 英雄的诞生: while she is deployed, every 米诺斯 operator (her too) ATK +25 % above 80 % HP (INS-X stage 3: above 50 %, +30 %) — one 精力充沛, not for others, gone when she leaves', () => {
|
||||
const others = [{ uid: 2, chessId: 'test_minos_a', row: 11, col: 3 }, { uid: 3, chessId: 'chess_char_1_02_a', row: 12, col: 7 }];
|
||||
for (const f of FORMS_ALL) {
|
||||
const [tier, elite, mod] = f;
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2, others });
|
||||
h.step();
|
||||
const minos = h.unit(2), yak = h.unit(3);
|
||||
const t = talentOf(u, 0);
|
||||
const x3 = elite && mod === INSX && tier === 6;
|
||||
assert.deepEqual([t['peak_performance.hp_ratio'], t['peak_performance.atk']], x3 ? [0.5, 0.3] : [0.8, 0.25], `${label(f)}: the talent of the form`);
|
||||
const v = t['peak_performance.atk'], thr = t['peak_performance.hp_ratio'];
|
||||
for (const a of [u, minos]) {
|
||||
assert.deepEqual(a.findBuff(PEAK_KEY)?.mods, { atkPct: v }, `${label(f)}: ${a.name}`);
|
||||
approx(a.s.atk, a.base.atk * (1 + v), `${label(f)}: ${a.name} ATK`);
|
||||
}
|
||||
assert.equal(yak.findBuff(PEAK_KEY), null, `${label(f)}: 角峰 (谢拉格) gets nothing`);
|
||||
// the HP condition, re-read every tick: strictly above hp_ratio
|
||||
minos.hp = minos.s.maxHp * thr;
|
||||
h.step();
|
||||
assert.equal(minos.findBuff(PEAK_KEY), null, `${label(f)}: at ${thr * 100} % HP`);
|
||||
minos.hp = minos.s.maxHp * 0.6;
|
||||
h.step();
|
||||
assert.equal(!!minos.findBuff(PEAK_KEY), x3, `${label(f)}: at 60 % HP`);
|
||||
minos.hp = minos.s.maxHp;
|
||||
h.step();
|
||||
assert.ok(minos.findBuff(PEAK_KEY), `${label(f)}: back above`);
|
||||
h.b.retreat(u);
|
||||
h.step();
|
||||
assert.equal(minos.findBuff(PEAK_KEY), null, `${label(f)}: gone once she leaves the field`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('T2 女神的振奋: every damage instance she deals heals her and the ally on the tile in front 40 HP (INS-Y stage 3: 60, and every 米诺斯 operator — her too — 40 more), through 禁疗, not a 不成为治疗目标 ally, not the one behind', () => {
|
||||
for (const f of FORMS_ALL) {
|
||||
const [tier, elite, mod] = f;
|
||||
const others = [{ uid: 2, chessId: 'chess_char_1_02_a', row: 10, col: 6 }, { uid: 3, chessId: 'test_minos_a', row: 10, col: 4 }];
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2, others });
|
||||
const front = h.unit(2), behind = h.unit(3);
|
||||
const t = talentOf(u, 1);
|
||||
const y3 = elite && mod === INSY && tier === 6;
|
||||
assert.deepEqual([t.value, t['pallas_e_t_2.value']], y3 ? [60, 40] : [40, undefined], `${label(f)}: the talent of the form`);
|
||||
for (const a of [u, front, behind]) a.hp = a.s.maxHp * 0.5;
|
||||
h.b.addBuff(front, { key: 'test:healFree', flags: { healFree: true } }); // 禁疗: the heal ignores it
|
||||
h.spawn('enemy_dummy', { pos: [10, 7] });
|
||||
h.run(5);
|
||||
const out = h.hooksOf('damaged').filter((c) => c.source === u && c.target.side === 'enemy');
|
||||
assert.ok(out.length >= 3, `${label(f)}: ${out.length} damage instances`);
|
||||
const heals = (a, amount) => h.hooksOf('heal').filter((c) => c.source === u && c.target === a && Math.abs(c.amount - amount) < 1e-6).length;
|
||||
assert.equal(heals(u, t.value), out.length, `${label(f)}: herself ${t.value} per instance`);
|
||||
assert.equal(heals(front, t.value), out.length, `${label(f)}: the ally in front (禁疗 too)`);
|
||||
assert.equal(heals(behind, t.value), 0, `${label(f)}: not the ally behind`);
|
||||
const extra = (a) => h.hooksOf('heal').filter((c) => c.source === u && c.target === a && c.opts?.tags?.includes('module')).length;
|
||||
assert.deepEqual([extra(u), extra(behind), extra(front)], y3 ? [out.length, out.length, 0] : [0, 0, 0], `${label(f)}: the 米诺斯 extra (INS-Y stage 3): her and the 米诺斯 operator behind`);
|
||||
if (y3) assert.ok(h.hooksOf('heal').filter((c) => c.opts?.tags?.includes('module')).every((c) => Math.abs(c.amount - 40) < 1e-6), `${label(f)}: 40 each`);
|
||||
assert.ok(front.hp > front.s.maxHp * 0.5, `${label(f)}: the front ally gained HP`);
|
||||
// 不成为其他角色的治疗目标 (noHeal): not healed
|
||||
const n = h.hooksOf('heal').length;
|
||||
h.b.addBuff(front, { key: 'test:noHeal', flags: { noHeal: true } });
|
||||
const hp = front.hp;
|
||||
h.run(3);
|
||||
assert.equal(front.hp, hp, `${label(f)}: no heal reaches a noHeal ally`);
|
||||
assert.ok(h.hooksOf('heal').length > n, `${label(f)}: she still heals herself`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S1 胜利的连击 (AUTO, attack SP 3, data DEFAULT): the next attack strikes twice for 125 % / 145 % ATK, each ×the 教官 scale, and heals twice', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, INSX], [5, true, INSY]]) {
|
||||
const sk = skillOf(tier, elite, S1);
|
||||
const { h, u } = field({ tier, elite, mod, skill: 0 });
|
||||
assert.deepEqual([u.skill.rule, u.skill.spType, u.skill.spCost, sk.initSp, sk.skillType, sk.bb.atk_scale], ['DEFAULT', 'attack', 3, 0, 'AUTO', elite ? 1.45 : 1.25], `T${tier}`);
|
||||
h.spawn('enemy_dummy', { pos: [10, 7] });
|
||||
assert.ok(h.runUntil(() => u.skill.activations === 1 && atkHits(h, u).some((c) => c.dmg.isSkill), 20), `T${tier}: cast on her 4th attack`);
|
||||
const sk1 = atkHits(h, u).filter((c) => c.dmg.isSkill);
|
||||
const id = sk1[0].dmg.attackId;
|
||||
const strikes = sk1.filter((c) => c.dmg.attackId === id);
|
||||
assert.equal(strikes.length, 2, `T${tier}: two strikes`);
|
||||
for (const c of strikes) approx(c.amount, u.s.atk * sk.bb.atk_scale * traitScale(tier, elite, mod), `T${tier}: ${sk.bb.atk_scale * 100} % × 教官`);
|
||||
assert.equal(atkHits(h, u).filter((c) => c.dmg.attackId < id).length, 3, `T${tier}: after 3 plain attacks`);
|
||||
assert.equal(h.hooksOf('heal').filter((c) => c.source === u && c.target === u).length, atkHits(h, u).length, `T${tier}: one 女神的振奋 per strike`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S2 信念的长鞭 (MANUAL, data DEFAULT): 20 / 22 s, range 2-2 + 1 tile forward, ATK +35 / 50 %, each attack 60 / 70 % to stun 0.2 s; all back after', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, INSY]]) {
|
||||
const sk = skillOf(tier, elite, S2);
|
||||
const { h, u } = field({ tier, elite, mod, skill: 1, seed: 9 });
|
||||
// the data's DEFAULT: tools/build-data.mjs ATTACK_RANGE_CHANGE misses "攻击范围向前延伸一格" (reported, not worked around)
|
||||
assert.deepEqual([u.skill.rule, sk.trigger.rawRule, sk.duration, sk.bb.atk, sk.bb.ability_range_forward_extend, sk.bb['attack@buff_prob'], sk.bb['attack@stun']],
|
||||
['DEFAULT', 'DEFAULT', elite ? 22 : 20, elite ? 0.5 : 0.35, 1, elite ? 0.7 : 0.6, 0.2], `T${tier}`);
|
||||
const far = h.spawn('enemy_dummy', { pos: [10, 8] }); // 3 tiles ahead: only in the extended range
|
||||
u.skill.gainSp(999);
|
||||
h.run(2);
|
||||
assert.equal(u.skill.activations, 0, `T${tier}: nothing in her own 2-2: no cast (DEFAULT)`);
|
||||
const near = h.spawn('enemy_dummy', { pos: [10, 7] });
|
||||
assert.ok(h.runUntil(() => u.skill.active, 3), `T${tier}: cast on her attack`);
|
||||
approx(u.skill.timeLeft, sk.duration, `T${tier}: ${sk.duration} s`, 0.01);
|
||||
assert.deepEqual(u.liveRangeGrid, [[0, 0], [0, 1], [0, 2], [0, 3]], `T${tier}: one tile more forward`);
|
||||
const v = talentOf(u, 0)['peak_performance.atk'];
|
||||
approx(u.s.atk, u.base.atk * (1 + v + sk.bb.atk), `T${tier}: ATK +${sk.bb.atk * 100} %`);
|
||||
h.b.kill(near, null);
|
||||
const n0 = atkHits(h, u).length;
|
||||
u.skill.extend(300);
|
||||
h.run(150);
|
||||
const hits = atkHits(h, u).slice(n0);
|
||||
assert.ok(hits.length > 100 && hits.every((c) => c.target === far), `T${tier}: the far dummy is hit (${hits.length})`);
|
||||
const stuns = h.hooksOf('statusApplied').filter((c) => c.source === u && c.status === 'stun' && c.target === far);
|
||||
const r = stuns.length / hits.length;
|
||||
assert.ok(Math.abs(r - sk.bb['attack@buff_prob']) < 0.08, `T${tier}: ${stuns.length} / ${hits.length} stuns ≈ ${sk.bb['attack@buff_prob']}`);
|
||||
for (const c of stuns) approx(c.duration, 0.2, `T${tier}: stun 0.2 s`);
|
||||
h.runUntil(() => !u.skill.active, 200);
|
||||
h.step();
|
||||
assert.deepEqual(u.liveRangeGrid, formOf(tier, elite).rangeGrid, `T${tier}: back to 2-2`);
|
||||
approx(u.s.atk, u.base.atk * (1 + v), `T${tier}: ATK back`);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('S3 英勇的祝福 (MANUAL, data DEFAULT): 30 s, ATK +55 / 70 %, three targets; the operator on the low-ground tile in front holds 精力充沛 +35 / 40 % (> 80 % HP), DEF +20 / 25 %, block +1 — else she does, and it moves on deploy / retreat', () => {
|
||||
for (const [tier, elite, mod] of [[5, false, null], [6, true, INSX], [6, true, INSY]]) {
|
||||
const sk = skillOf(tier, elite, S3);
|
||||
const b = sk.bb;
|
||||
assert.deepEqual([sk.duration, b.atk, b['attack@max_target'], b['attack@peak_performance.atk'], b['attack@peak_performance.hp_ratio'], b['attack@def'], b['attack@block_cnt']],
|
||||
[30, elite ? 0.7 : 0.55, 3, elite ? 0.4 : 0.35, 0.8, elite ? 0.25 : 0.2, 1], `T${tier}`);
|
||||
const v1 = (u) => talentOf(u, 0)['peak_performance.atk'];
|
||||
// (a) 角峰 (an operator on a road tile) in front: it holds
|
||||
{
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2, others: [{ uid: 2, chessId: 'chess_char_1_02_a', row: 10, col: 6 }] });
|
||||
const yak = h.unit(2);
|
||||
assert.equal(u.skill.rule, 'DEFAULT', `T${tier}: data DEFAULT`);
|
||||
for (const pos of [[10, 5], [10, 6], [10, 7]]) h.spawn('enemy_dummy', { pos }); // three enemies on her 2-2
|
||||
u.skill.gainSp(999);
|
||||
assert.ok(h.runUntil(() => u.skill.active, 3), `T${tier}: cast`);
|
||||
h.step();
|
||||
approx(u.skill.timeLeft, 30, `T${tier}: 30 s`, 0.1);
|
||||
assert.deepEqual(yak.findBuff(holderKey(u))?.mods, { defPct: b['attack@def'], blockCnt: 1 }, `T${tier}: 角峰 holds`);
|
||||
assert.equal(yak.s.blockCnt, yak.base.blockCnt + 1, `T${tier}: 角峰 block +1`);
|
||||
approx(yak.s.def, yak.base.def * (1 + b['attack@def']), `T${tier}: 角峰 DEF`);
|
||||
assert.deepEqual(yak.findBuff(PEAK_KEY)?.mods, { atkPct: b['attack@peak_performance.atk'] }, `T${tier}: 角峰 精力充沛`);
|
||||
assert.equal(u.findBuff(holderKey(u)), null, `T${tier}: not her`);
|
||||
assert.equal(u.s.blockCnt, 2);
|
||||
approx(u.s.atk, u.base.atk * (1 + v1(u) + b.atk), `T${tier}: her ATK +${b.atk * 100} % (+ her own T1)`);
|
||||
yak.hp = yak.s.maxHp * 0.8;
|
||||
h.step();
|
||||
assert.equal(yak.findBuff(PEAK_KEY), null, `T${tier}: 角峰 at 80 % HP: no 精力充沛`);
|
||||
// three targets per attack
|
||||
const t0 = h.b.time;
|
||||
h.run(4);
|
||||
const per = new Map();
|
||||
for (const c of atkHits(h, u).filter((x) => x.t > t0)) per.set(c.dmg.attackId, (per.get(c.dmg.attackId) ?? new Set()).add(c.target));
|
||||
assert.ok(per.size >= 2 && [...per.values()].every((s) => s.size === 3), `T${tier}: three targets per attack`);
|
||||
// 角峰 leaves ⇒ she holds at once (同类取最高: her 精力充沛 is the higher of T1 and S3); a new operator in front takes it back
|
||||
h.b.retreat(yak);
|
||||
h.step();
|
||||
assert.deepEqual(u.findBuff(holderKey(u))?.mods, { defPct: b['attack@def'], blockCnt: 1 }, `T${tier}: passed to her`);
|
||||
assert.equal(u.s.blockCnt, 3, `T${tier}: her block +1`);
|
||||
assert.deepEqual(u.findBuff(PEAK_KEY)?.mods, { atkPct: Math.max(v1(u), b['attack@peak_performance.atk']) }, `T${tier}: one 精力充沛, the highest`);
|
||||
approx(u.s.atk, u.base.atk * (1 + b.atk + Math.max(v1(u), b['attack@peak_performance.atk'])), `T${tier}: her ATK`);
|
||||
h.b.redeploy(yak, { free: true });
|
||||
h.step();
|
||||
assert.ok(yak.findBuff(holderKey(u)) && !u.findBuff(holderKey(u)), `T${tier}: back to the redeployed 角峰`);
|
||||
h.runUntil(() => !u.skill.active, 40);
|
||||
h.step();
|
||||
assert.ok(!yak.findBuff(holderKey(u)) && !u.findBuff(holderKey(u)) && yak.s.blockCnt === yak.base.blockCnt, `T${tier}: gone at the end`);
|
||||
assert.deepEqual(u.findBuff(PEAK_KEY)?.mods, { atkPct: v1(u) }, `T${tier}: her T1 only`);
|
||||
done(h);
|
||||
}
|
||||
// (b) the tile in front is high ground (a ranged operator on it): she holds (the empty tile: (a) after the retreat)
|
||||
{
|
||||
const rows = { 10: '##hrrrhrrrfrrrrrrrf##' }; // (10,6) = 高台 'h'
|
||||
const { h, u } = field({ tier, elite, mod, skill: 2, rows, others: [{ uid: 2, chessId: 'chess_char_1_01_a', row: 10, col: 6 }] });
|
||||
const sniper = h.unit(2);
|
||||
assert.equal(h.b.grid.isLow(10, 6), false);
|
||||
h.spawn('enemy_dummy', { pos: [10, 7] });
|
||||
u.skill.gainSp(999);
|
||||
assert.ok(h.runUntil(() => u.skill.active, 3));
|
||||
h.step();
|
||||
assert.ok(u.findBuff(holderKey(u)) && !sniper.findBuff(holderKey(u)), `T${tier}: an operator on a 高台 in front does not hold it`);
|
||||
done(h);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('INS-Y 「可以额外部署在远程位」: the data carries it (hidden buildable_type 2); a placement rule of the prep, not of the battle — a 帕拉斯 piece stays on melee tiles (owner\'s decision of 2026-10-04, shared/highGround.js)', () => {
|
||||
for (const tier of [5, 6]) {
|
||||
const m = modOf(tier, INSY);
|
||||
assert.equal(m.traitOverride.moduleDesc, '可以额外部署在远程位');
|
||||
assert.deepEqual(m.talentChanges.find((t) => t.talentIndex === -1)?.bb, { buildable_type: 2 });
|
||||
const rec = diyRecord(SLOT[tier], { charId: PALLAS, skillIndex: 0, uniEquipId: INSY }, { elite: true, data: { chess: CHESS, backups: BACKUPS } });
|
||||
assert.equal(positionClass(rec, INSY), 'melee', `T${tier}: placement unchanged`);
|
||||
const { h, u } = field({ tier, elite: true, mod: INSY, skill: 2 });
|
||||
assert.equal(u.def.position, 'MELEE');
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user