feedback5 R4: one file per operator kit — kits/tier1..6.js split into kits/ops/<chessId>-<codename>.js (129 kits), kits/shared/tier1..6.js (the helpers two or more kits of a tier use, and each tier's header notes) and kits/index.js (the registry, same keys in the same order); the tier files become re-export shims

Pure move: every line of a kit, of a helper and of the tier headers is copied verbatim (only the headers' first
line names the new file); a helper used by one kit moved into that kit's file. Glue only: the generated imports,
`export default { … }` around each registry entry, `export { … }` lists in shared/tier2..6.js, and tier4's
`(bb, chess, def)` default-argument wrapper as shared/tier4.js `withDefaults` (applied in each tier-4 kit file).
kits/index.js loads every kit file with a guarded dynamic import (browser-safe, no directory listing); tierN.js
re-export the tier registry (TIER_KITS) and their old named exports (tier1 helpers + tinmanKit, tier6
PITHST_ELEMENTS). The merged registry, every tier default and named export have the same keys, order, frozenness
and function sources as before. test/docs-consistency.test.js reads the moved code at its new paths.
Golden: GOLDEN_FULL=1 node --test test/golden.test.js unchanged.
This commit is contained in:
sganggs committed 2026-10-05 16:13:56 +08:00
1 parent 6b489b1776
commit 1169102d46
143 files changed
+12924 -11784

No files matched your search

@@ -0,0 +1,111 @@
// server/sim/content/kits/ops/chess_char_6_05-pasngr.js — 异客 (char_472_pasngr) kit, tier 6.
// Conventions of the tier-6 kits: ../shared/tier6.js; kit contract and rules: ../README.md.
import { absoluteRangeKeys, canTargetEnemy } from '../../../targeting.js';
import { CHAIN_RADIUS } from '../../../constants.js';
import { bodyDist, bodyInKeys } from '../../../body.js';
import { num, bv, tbb, live, ANY, enemiesIn, batOf, N4, aura } from '../shared/tier6.js';
// ------------------------------------------------------------------------------------------------------------------
// 异客 chess_char_6_05 (链术师) — S3 辉煌裂片; 机理分析; 孤卒
const STORM_RADIUS = 1.5; // [ASSUMED] storm zone radius (not in data)
function pasngr(bb, chess, def) {
const t0 = tbb(def, 0), t1 = tbb(def, 1), tb = def?.traitBb || {};
const skillGrid = def?.skill?.rangeGrid?.length ? def.skill.rangeGrid : null;
const strike = (battle, unit, first, scale) => {
const ch0 = unit.profile?.chain || { count: 4, falloff: 0.15, radius: CHAIN_RADIUS };
// elite module (电磁调节器) upgrades the skill's chain too: skill@chain.atk_scale / skill@sluggish
const ch = { ...ch0, falloff: tb['skill@chain.atk_scale'] != null ? 1 - num(tb['skill@chain.atk_scale']) : num(ch0.falloff, 0.15) };
const count = Math.max(1, Math.floor(num(bb['chain.max_target'], ch.count || 4)));
const slug = num(tb['skill@sluggish'], num(bb.sluggish, ch.sluggish ?? 0));
const hit = new Set();
let prev = first;
for (let i = 0; i < count && prev; i++) {
hit.add(prev.id);
battle.fx('lightning', { x: prev.x, y: prev.y, id: prev.id, src: unit.id });
battle.dealDamage(unit, prev, { amount: unit.s.atk * scale * Math.pow(1 - num(ch.falloff, 0.15), i), type: 'arts', isSkill: true, isAttack: true, tags: ['skill', 'storm'] });
if (slug > 0 && prev.alive) battle.applyStatus(prev, 'sluggish', { duration: slug, source: unit });
let best = null, bd = Infinity;
for (const x of battle.foesInRadius(prev.x, prev.y, ch.radius || CHAIN_RADIUS)) {
if (hit.has(x.id) || !canTargetEnemy(unit, x, ANY)) continue;
const d = bodyDist(x, prev.x, prev.y);
if (d < bd - 1e-9) { bd = d; best = x; }
}
prev = best;
}
};
// the chain of her profile (trait / module: bounce count, falloff, 停顿) with skill overrides
const chainOf = (unit, o) => ({ ...(unit.profile?.chain || { count: 4, falloff: 0.15, radius: CHAIN_RADIUS, sluggish: 0.5 }), ...o });
const skills = {
// S1 电能之触: next attack at atk_scale × ATK, bouncing over max_target enemies with a sluggish-s 停顿 (the module's
// skill@pasngr_s_1.chain.atk_scale sets its falloff)
skchr_pasngr_1: {
kind: 'instant',
attack: { atkScale: bv(bb, 'atk_scale', 1) },
onStart({ unit, skill }) {
const o = { count: Math.max(1, Math.floor(bv(bb, 'max_target', 4))), sluggish: bv(bb, 'sluggish', 0.5) };
if (tb['skill@pasngr_s_1.chain.atk_scale'] != null) o.falloff = 1 - num(tb['skill@pasngr_s_1.chain.atk_scale']);
skill.spec.attack.chain = chainOf(unit, o);
},
},
// S2 聚焦指令: range +1, ATK +atk, base attack time ×0.7/×0.6 (akdata: 乘算负数), bounces raised to attack@max_target
skchr_pasngr_2: {
kind: 'duration',
mods: { atkPct: num(bb.atk), batPct: batOf(bb.base_attack_time, def, true) },
targeting: { rangeExtend: num(bb.ability_range_forward_extend) },
attack: {},
onStart({ unit, skill }) { skill.spec.attack.chain = chainOf(unit, { count: Math.max(1, Math.floor(num(bb['attack@max_target'], 5))) }); },
},
};
return {
skills,
skill: {
kind: 'charges',
onStart({ battle, unit }) {
const keys = skillGrid ? absoluteRangeKeys(skillGrid, unit.tileR, unit.tileC, unit.dir, unit.s.rangeExtend) : unit.rangeKeys;
const cands = enemiesIn(battle, unit, keys);
if (!cands.length) return;
const tgt = cands.reduce((a, b) => (b.hp > a.hp ? b : a));
const cx = tgt.x, cy = tgt.y;
const dur = num(bb.duration, 4), iv = Math.max(0.1, num(bb.interval, 0.5)), scale = num(bb.atk_scale, 1);
const n = Math.max(1, Math.round(dur / iv));
battle.fx('storm', { x: cx, y: cy, id: unit.id, duration: dur, r: STORM_RADIUS });
let k = 0;
const seq = unit.deploySeq;
const h = battle.every(iv, () => {
if (!live(unit) || unit.deploySeq !== seq) { h.cancel(); return; } // the storm ends when she leaves the field
if (++k >= n) h.cancel();
const zone = battle.foesInRadius(cx, cy, STORM_RADIUS).filter((e) => canTargetEnemy(unit, e, ANY));
const e = battle.rng.pick(zone);
if (e) strike(battle, unit, e, scale);
}, { owner: unit });
},
},
talents: [
{ install(battle, unit) { // 机理分析
const thr = num(t0.hp_ratio, 0.8), ds = bv(t0, 'damage_scale', 1), dur = bv(t0, 'duration', 3);
const key = `pasngr:enhance:${unit.id}`;
battle.on('hit', (ctx) => {
const t = ctx.target;
if (ctx.source !== unit || !t || t.side !== 'enemy' || ctx.dmg.type === 'element') return;
if (ctx.dmg.isAttack && t.hpRatio >= thr - 1e-9) battle.addBuff(t, { key, duration: dur, refresh: 'replace', source: unit });
if (t.findBuff(key)) ctx.dmg.mul *= ds;
}, { owner: unit });
} },
{ install(battle, unit) { // 孤卒: no enemy on the 4 surrounding tiles
const atk = num(t1.atk), spr = num(t1.sp_recovery_per_sec);
aura(battle, unit, 0.25, () => {
const near = new Set(absoluteRangeKeys(N4, unit.tileR, unit.tileC, 1, 0));
if (battle.enemies.some((e) => e.alive && !e.hidden && bodyInKeys(e, near))) return;
battle.addBuff(unit, { key: 'pasngr:lone', mods: { atkPct: atk, spRecoveryFlat: spr }, duration: 0.4, refresh: 'replace' });
});
} },
],
};
}
export default {
chess_char_6_05_a: pasngr,
};