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.
42 lines
2.2 KiB
JavaScript
42 lines
2.2 KiB
JavaScript
// server/sim/content/kits/ops/chess_char_4_15-reckpr.js — 录武官 (char_4196_reckpr) kit, tier 4 (hidden).
|
|
// Conventions of the tier-4 kits: ../shared/tier4.js; kit contract and rules: ../README.md.
|
|
|
|
import { COLS } from '../../../constants.js';
|
|
import { isHpLoss } from '../../../damage.js';
|
|
import { num, tbb, keySet, skillActive, installLowHpHealBonus, withDefaults } from '../shared/tier4.js';
|
|
|
|
export default withDefaults({
|
|
// ===== 录武官 (physician, hidden) S2 一点关窍 — +ATK; healed allies regain 80 HP per hit taken for 10 s; 学成于聚
|
|
chess_char_4_15_a: (bb, chess, def) => {
|
|
const t0 = tbb(def, 0);
|
|
const tb = def.traitBb || {};
|
|
return {
|
|
skill: {
|
|
kind: 'duration', heal: true,
|
|
mods: { atkPct: num(bb.atk) },
|
|
onStart({ battle, unit }) { battle.fx('knack', { x: unit.x, y: unit.y, id: unit.id }); },
|
|
onHit({ battle, unit, target }) {
|
|
if (target && target.alive && target.side === 'ally' && target.kind === 'op') battle.addBuff(target, { key: `reckpr:guard:${unit.id}`, duration: num(bb['attack@buff_duration'], 10), visible: true, source: unit });
|
|
},
|
|
},
|
|
talents: [{ install(battle, unit) { // 学成于聚: an operator in range casts ⇒ +1 SP and ASPD +16 for 8 s
|
|
battle.on('skillStart', (c) => {
|
|
const a = c.unit;
|
|
if (a === unit || a.side !== 'ally' || a.kind !== 'op' || !unit.alive || !unit.deployed || !keySet(unit).has(a.tileR * COLS + a.tileC)) return;
|
|
if (!battle.rng.chance(num(t0.prob, 1))) return;
|
|
if (!skillActive(unit)) unit.skill?.gainSp(num(t0.sp, 1), 'talent');
|
|
battle.addBuff(unit, { key: 'reckpr:t1', duration: num(t0.duration, 8), mods: { aspd: num(t0.attack_speed, 16) }, maxStacks: Math.max(1, num(t0.max_stack_cnt, 1)) });
|
|
}, { owner: unit });
|
|
} }],
|
|
install(battle, unit) {
|
|
battle.on('damaged', (c) => {
|
|
const t = c.target;
|
|
if (t.side !== 'ally' || !t.alive || !(c.amount > 0) || isHpLoss(c.dmg) || !t.findBuff(`reckpr:guard:${unit.id}`)) return;
|
|
battle.heal(unit, t, num(bb['attack@fixed_heal_value'], 80));
|
|
}, { owner: unit });
|
|
installLowHpHealBonus(battle, unit, tb);
|
|
},
|
|
};
|
|
},
|
|
});
|