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.
48 lines
2.7 KiB
JavaScript
48 lines
2.7 KiB
JavaScript
// server/sim/content/kits/ops/chess_char_4_08-rosesa.js — 瑰盐 (char_4163_rosesa) 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 {
|
||
AURA, num, tbb, batFlat, keySet, whileDeployed, pulse, skillActive, applyModuleRange, withDefaults,
|
||
} from '../shared/tier4.js';
|
||
|
||
export default withDefaults({
|
||
// ===== 瑰盐 (ringhealer, hidden) S2 绝妙的长效药呀 — allies in range: 20 % of phys/arts damage → 5 s HP loss
|
||
chess_char_4_08_a: (bb, chess, def) => {
|
||
const t0 = tbb(def, 0);
|
||
const scale = num(bb['attack@damage_scale'], 0.8), fin = num(bb['attack@final_duration'], 5), iv = Math.max(0.1, num(bb['attack@interval'], 1));
|
||
return {
|
||
skill: { kind: 'duration', heal: true, mods: { batPct: batFlat(def, bb.base_attack_time) },
|
||
onStart({ battle, unit }) { battle.fx('saltWard', { x: unit.x, y: unit.y, id: unit.id }); } },
|
||
talents: [{ install(battle, unit) { // 最好的草药医生: own ATK −5 %, operators in range receive +15 % healing
|
||
battle.addBuff(unit, { key: 'rosesa:t1', mods: { atkPct: num(t0.atk, -0.05) }, persist: true, allowDead: true });
|
||
whileDeployed(battle, unit, AURA, () => {
|
||
for (const a of battle.alliesInGrid(unit)) if (a.kind === 'op') pulse(battle, a, `rosesa:heal:${unit.id}`, { healingTakenMul: num(t0.heal_scale, 1.15) });
|
||
});
|
||
} }],
|
||
install(battle, unit) {
|
||
const deferred = new WeakSet();
|
||
battle.on('hit', (c) => {
|
||
const t = c.target;
|
||
// "友方干员": operators only (summons/devices keep the full hit)
|
||
if (!skillActive(unit) || !unit.alive || t.side !== 'ally' || t.kind !== 'op' || (c.dmg.type !== 'phys' && c.dmg.type !== 'arts')) return;
|
||
if (!keySet(unit).has(t.tileR * COLS + t.tileC)) return;
|
||
c.dmg.mul *= scale;
|
||
deferred.add(c.dmg);
|
||
}, { owner: unit, priority: -5 });
|
||
battle.on('damaged', (c) => {
|
||
if (!deferred.has(c.dmg) || !(c.amount > 0) || !c.target.alive) return;
|
||
deferred.delete(c.dmg);
|
||
const total = (c.amount * (1 - scale)) / Math.max(1e-6, scale);
|
||
const per = total / Math.max(1, Math.round(fin / iv));
|
||
const src = c.source;
|
||
battle.addBuff(c.target, { key: 'rosesa:dot', refresh: 'independent', maxStacks: 1000, duration: fin + 1e-6, interval: iv,
|
||
onTick: ({ unit: tgt }) => battle.loseHp(tgt, per, { source: src && src.side === 'enemy' ? src : null }) });
|
||
}, { owner: unit });
|
||
// module (elite) RIN-X: 攻击范围扩大 (module range grid)
|
||
applyModuleRange(battle, unit, def);
|
||
},
|
||
};
|
||
},
|
||
});
|