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,60 @@
// server/sim/content/kits/ops/chess_char_2_09-humus.js — 休谟斯 (char_491_humus) kit, tier 2.
// Conventions of the tier-2 kits: ../shared/tier2.js; kit contract and rules: ../README.md.
import { num, talentBb } from '../shared/tier1.js';
export default {
// ---------------------------------------------------------------------------------------------------------------
// 2_09 休谟斯 高效处理: block +block_cnt; above peak_1.hp_ratio HP ATK +peak_1.atk (精力充沛), above peak_2.hp_ratio
// +peak_2.atk. 再回收: healing beyond max HP becomes a barrier, at most max_hp_ratio × max HP.
// S1 固废切割 (alt, attack SP): the next attack hits at atk_scale × ATK (every enemy it reaches) and heals her `value`
// HP once (a self heal: her trait bars only healing by others; overflow feeds 再回收).
chess_char_2_09_a: (bb, chess) => {
const t = talentBb(chess, 0);
const peaks = [];
for (const [k, v] of Object.entries(bb)) {
const m = k.match(/\[(peak_\d+)\]\.peak_performance\.(atk|hp_ratio)$/);
if (!m) continue;
let p = peaks.find((x) => x.id === m[1]);
if (!p) peaks.push((p = { id: m[1], atk: 0, hp: 1 }));
if (m[2] === 'atk') p.atk = num(v); else p.hp = num(v, 1);
}
peaks.sort((a, b) => b.hp - a.hp);
const key = 'humus:peak';
const peak = ({ battle, unit }) => {
const lvl = peaks.find((p) => unit.hpRatio > p.hp)?.atk ?? 0;
const cur = unit.findBuff(key);
if ((cur?.data?.v ?? 0) === lvl) return;
if (lvl > 0) battle.addBuff(unit, { key, mods: { atkPct: lvl }, data: { v: lvl }, visible: true, tags: ['skill'] });
else battle.removeBuff(unit, key);
};
return {
skill: {
kind: 'duration', mods: { blockCnt: num(bb.block_cnt) },
onStart: peak, onTick: peak,
onEnd({ battle, unit }) { battle.removeBuff(unit, key); },
},
skills: {
skchr_humus_1: {
kind: 'instant', attack: { atkScale: num(bb.atk_scale, 1) },
onAttack({ battle, unit }) {
if (num(bb.value) > 0 && unit.alive) battle.heal(unit, unit, num(bb.value), { self: true, tags: ['skill'] });
},
},
},
talents: [{ install(battle, unit) {
const ratio = num(t.max_hp_ratio);
if (!(ratio > 0)) return;
battle.on('heal', (ctx) => {
if (ctx.target !== unit || !(ctx.amount > 0)) return;
const over = ctx.amount - (unit.s.maxHp - unit.hp);
if (!(over > 0)) return;
const cur = unit.findBuff('humus:recycle');
const have = cur ? cur.shield : 0;
const val = Math.min(unit.s.maxHp * ratio, have + over);
if (val > have + 1e-6) battle.addBuff(unit, { key: 'humus:recycle', shield: val, source: unit, visible: true, tags: ['talent'] });
}, { owner: unit, priority: -50 });
} }],
};
},
};