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.
50 lines
2.6 KiB
JavaScript
50 lines
2.6 KiB
JavaScript
// server/sim/content/kits/ops/chess_char_2_04-grabds.js — 小满 (char_4122_grabds) kit, tier 2.
|
||
// Conventions of the tier-2 kits: ../shared/tier2.js; kit contract and rules: ../README.md.
|
||
|
||
import {
|
||
num, talentBb, moduleBb, traitBb, enemiesInGrid, enemyInRange, statBuff, spTimeBonus, instantKind,
|
||
} from '../shared/tier1.js';
|
||
|
||
export default {
|
||
// ---------------------------------------------------------------------------------------------------------------
|
||
// 2_04 小满 乡音沉沉: stops attacking and puts max_target enemies in range to sleep `sleep` s; afterwards ASPD
|
||
// +attack_speed and attacks max_target enemies. 好好听话: ASPD +attack_speed; vs 【野生动物】 (tag `infection`,
|
||
// "野生的被感染生物") the trait 停顿 lasts +sluggish_addition s. Elite module (DEC-X): +sp_recovery_per_sec SP/s with
|
||
// an enemy in range.
|
||
// S1 竹笛飞声 (alt, 2 charges): the next attack deals atk_scale × ATK arts and hits one more enemy (+1 target).
|
||
chess_char_2_04_a: (bb, chess, def) => {
|
||
const t = talentBb(chess, 0);
|
||
const tb = traitBb(chess);
|
||
const n = Math.max(1, Math.floor(num(bb.max_target, 1)));
|
||
const sleep = num(bb.sleep);
|
||
return {
|
||
trait: {
|
||
onHitStatus: null,
|
||
canAttack: (battle, u) => !(u.skill?.active && battle.time < (u.mem.grainQuietUntil ?? -1)),
|
||
afterHit(battle, u, target) {
|
||
if (!target || !target.alive || target.side !== 'enemy') return;
|
||
const beast = (target.def?.tags || []).includes('infection');
|
||
battle.applyStatus(target, 'sluggish', { duration: num(tb.sluggish, 0.8) + (beast ? num(t.sluggish_addition) : 0), source: u });
|
||
},
|
||
},
|
||
skill: {
|
||
kind: 'duration', mods: { aspd: num(bb.attack_speed) },
|
||
targeting: { maxTargets: n, rangeGrid: def?.skill?.rangeGrid ?? null },
|
||
onStart({ battle, unit }) {
|
||
unit.mem.grainQuietUntil = battle.time + sleep;
|
||
for (const e of enemiesInGrid(battle, unit, def?.skill?.rangeGrid ?? null, { n })) {
|
||
if (battle.applyStatus(e, 'sleep', { duration: sleep, source: unit })) battle.fx('sleep', { x: e.x, y: e.y, id: e.id });
|
||
}
|
||
},
|
||
},
|
||
skills: {
|
||
skchr_grabds_1: { kind: instantKind(def), attack: { atkScale: num(bb.atk_scale, 1), dmgType: 'arts' }, mods: { maxTargets: 1 } },
|
||
},
|
||
talents: [{ install(battle, unit) {
|
||
statBuff(battle, unit, 'talent:grabds', { aspd: num(t.attack_speed) });
|
||
spTimeBonus(battle, unit, num(moduleBb(chess).sp_recovery_per_sec), () => enemyInRange(battle, unit));
|
||
} }],
|
||
};
|
||
},
|
||
};
|