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.
69 lines
3.6 KiB
JavaScript
69 lines
3.6 KiB
JavaScript
// server/sim/content/kits/ops/chess_char_2_10-rockr.js — 洛洛 (char_4040_rockr) kit, tier 2.
|
||
// Conventions of the tier-2 kits: ../shared/tier2.js; kit contract and rules: ../README.md.
|
||
|
||
import { canTargetEnemy } from '../../../targeting.js';
|
||
import { bodyInKeys } from '../../../body.js';
|
||
import { num, talentBb, up } from '../shared/tier1.js';
|
||
import { onDefaultSkill } from '../shared/tier2.js';
|
||
|
||
export default {
|
||
// ---------------------------------------------------------------------------------------------------------------
|
||
// 2_10 洛洛 自负此轭: ASPD +attack_speed; the drones lock on their target until it dies or the skill ends.
|
||
// 过载 (term ba.overdrive "技能进行到一半时触发额外效果"): the second half of the duration — ATK +atk and the funnel cap
|
||
// ×scale; when the skill ends she is stunned as long as the overload lasted. 立于磐石: ATK +atk per `interval` s on the
|
||
// field, up to max_stack_cnt stacks.
|
||
// S1 战术咏唱·γ型 (alt): ASPD +attack_speed; the target lock belongs to 自负此轭 only.
|
||
chess_char_2_10_a: (bb, chess) => {
|
||
const t = talentBb(chess, 0);
|
||
const s2 = onDefaultSkill(chess);
|
||
const endOverload = (battle, unit) => {
|
||
if (unit.mem.rockFunnel) { unit.profile.funnel = unit.mem.rockFunnel; unit.mem.rockFunnel = null; }
|
||
battle.removeBuff(unit, 'rockr:overload');
|
||
};
|
||
return {
|
||
skill: {
|
||
kind: 'duration', mods: { aspd: num(bb.attack_speed) },
|
||
onStart({ battle, unit, skill }) {
|
||
unit.mem.rockOverAt = battle.time + skill.duration / 2;
|
||
unit.mem.rockOver = false;
|
||
unit.mem.rockLock = null;
|
||
},
|
||
onTick({ battle, unit }) {
|
||
if (unit.mem.rockOver || battle.time + 1e-9 < unit.mem.rockOverAt) return;
|
||
unit.mem.rockOver = true;
|
||
const f = unit.profile.funnel;
|
||
if (f) { unit.mem.rockFunnel = f; unit.profile.funnel = { ...f, max: f.max * num(bb.scale, 1) }; }
|
||
battle.addBuff(unit, { key: 'rockr:overload', mods: { atkPct: num(bb.atk) }, visible: true, tags: ['skill'] });
|
||
battle.fx('overload', { x: unit.x, y: unit.y, id: unit.id });
|
||
},
|
||
onEnd({ battle, unit, reason }) {
|
||
const over = unit.mem.rockOver ? battle.time - unit.mem.rockOverAt : 0;
|
||
endOverload(battle, unit);
|
||
unit.mem.rockOver = false;
|
||
unit.mem.rockLock = null;
|
||
if (over > 0 && reason !== 'death' && unit.alive) battle.applyStatus(unit, 'stun', { duration: over, source: unit });
|
||
},
|
||
},
|
||
skills: { 'skcom_magic_rage[3]': { kind: 'duration', mods: { aspd: num(bb.attack_speed) } } },
|
||
talents: [{ install(battle, unit) {
|
||
if (s2) battle.on('beforeAttack', (ctx) => {
|
||
if (ctx.attacker !== unit || !unit.skill?.active) return;
|
||
const L = unit.mem.rockLock;
|
||
if (L && L.alive && bodyInKeys(L, unit.rangeKeySet) && canTargetEnemy(unit, L, ctx.profile || unit.profile)) ctx.targets = [L];
|
||
else unit.mem.rockLock = ctx.targets[0] ?? null;
|
||
}, { owner: unit });
|
||
const iv = num(t.interval), max = Math.floor(num(t.max_stack_cnt)), v = num(t.atk);
|
||
if (!(iv > 0) || !(max > 0) || !v) return;
|
||
battle.on('tick', () => {
|
||
if (!up(unit)) return;
|
||
const n = Math.min(max, Math.floor((battle.time - unit.deployedAt + 1e-9) / iv));
|
||
const cur = unit.findBuff('rockr:rock');
|
||
if ((cur ? cur.stacks : 0) === n) return;
|
||
if (n > 0) battle.addBuff(unit, { key: 'rockr:rock', mods: { atkPct: v }, stacks: n, maxStacks: max, tags: ['talent'] });
|
||
else battle.removeBuff(unit, 'rockr:rock');
|
||
}, { owner: unit });
|
||
} }],
|
||
};
|
||
},
|
||
};
|