feedback5: merge O11 — 自选 kits for 薇薇安娜, 怒潮凛冬 and 赫德雷; engine: enemy projectile shots carry isProjectile, targeting priority 'elite'; golden: only diy moved
This commit is contained in:
commit
7f704b396b
11 files changed
+2120
-126
No files matched your search
+5
-3
@@ -713,12 +713,14 @@ function enemyAttack(b, e) {
|
||||
for (const t of targets) {
|
||||
b._ev(['atk', e.id, t.id, deferred ? (e.profile.shot || 'none') : rangedShot ? 'enemy' : 'none']);
|
||||
if (deferred) continue;
|
||||
const hit = (tt) => {
|
||||
// a shot that flies as a projectile is 远程途径 (DamageInfo `isProjectile`; PRTS 作战机制 "有弹道的攻击固定为10,无弹道的攻击
|
||||
// 固定为01"): what only 近战途径 damage triggers skips it (薇薇安娜's 散华 护盾, kits/ops/op-vvana.js)
|
||||
const hit = (tt, isProjectile = false) => {
|
||||
if (!tt || !tt.alive || !e.alive && !rangedShot) return;
|
||||
b.dealDamage(e, tt, { amount: e.s.atk * (e.profile?.atkScale ?? 1), type, isAttack: true, attackId });
|
||||
b.dealDamage(e, tt, { amount: e.s.atk * (e.profile?.atkScale ?? 1), type, isAttack: true, attackId, isProjectile });
|
||||
};
|
||||
if (rangedShot && Math.hypot(t.x - e.x, t.y - e.y) > 0.75) {
|
||||
b.addProjectile({ from: e, target: t, speed: PROJECTILE_SPEEDS.enemy, visual: 'enemy', source: e, onHit: (c) => hit(c.target) });
|
||||
b.addProjectile({ from: e, target: t, speed: PROJECTILE_SPEEDS.enemy, visual: 'enemy', source: e, onHit: (c) => hit(c.target, true) });
|
||||
} else hit(t);
|
||||
}
|
||||
if (b._hooks.attack) b.emit('attack', { attacker: e, targets, isSkill: false });
|
||||
|
||||
@@ -118,6 +118,9 @@ export const OPERATOR_KIT_FILES = Object.freeze([
|
||||
'op-thorns.js',
|
||||
'op-chen3.js',
|
||||
'op-leizi2.js',
|
||||
'op-vvana.js',
|
||||
'op-headb2.js',
|
||||
'op-hodrer.js',
|
||||
]);
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,281 @@
|
||||
// server/sim/content/kits/ops/op-headb2.js — 怒潮凛冬 (char_1051_headb2) 自选 operator kit: 6★ 撼地者 (近卫), an owned-6★ pick
|
||||
// of the tier-5 and tier-6 自选 slots; every skill, both talents, the trait and the module at every form.
|
||||
// Kit contract and the 自选 rules: ../README.md ("How to add an operator (自选)").
|
||||
//
|
||||
// Forms (data/backups.json units.char_1051_headb2, the DIY slot statuses): normal = E2 Lv1, skills at rank 4, no module;
|
||||
// elite = E2 Lv60, rank 7, HAM-X at stage 1 (tier 5) or 3 (tier 6) when picked. Potential 0 [ASSUMED: no account].
|
||||
// Sources: character_table / skill_table / battle_equip_table (zh_CN, as built into backups.json; teamId `student`); PRTS
|
||||
// 怒潮凛冬 (备注 of 汹涌怒火, 绝不罢休 and 无可抵挡); gamedata_const ba.sluggish 停顿, ba.root 束缚; the client's battle data read
|
||||
// from the local install — charpack char_1051_headb2, battle/prefabs [uc]skills skchr_headb2_3 and [uc]equips headb2_equip_*,
|
||||
// buff_template_data headb2_* (named below) — and the battle skeleton's Skill_3 clip events.
|
||||
// - Trait (撼地者) "攻击使目标周围的其他敌人受到相当于攻击力50%的群体物理伤害": the profession splash (radius 1.0, 50 %, others only,
|
||||
// ground enemies — the trait bb).
|
||||
// - Module HAM-X 迟到的勋章: trait "溅射范围内有大于或等于3个敌人时,使当次攻击力提升至115%" (trait bb cnt / atk_scale_e;
|
||||
// headb2_e_002_trait: ON_CALCULATE_DAMAGE, CheckEnemyCountWhenAttackDoCast ≥ cnt — the enemies the attack, or S3's ability,
|
||||
// strikes — then AtkScaleUp): an attack whose target and splash victims (radius 1.0 around the target, ground) number at least
|
||||
// cnt deals ×atk_scale_e on each of its damage instances (an ATK scale: before DEF); an S3 hammer counts its own 1.5 range,
|
||||
// every 高台 splash its own x-5 (PRTS "每个溅射效果独立计算X模组特性加成"). Stage 3: 汹涌怒火 +40 % (below).
|
||||
// - T1 汹涌怒火 "特性溅射造成的物理伤害提升24%,且溅射到的每个高台对周围四格所有地面敌人造成相当于攻击力24%的物理伤害和0.5秒停顿"
|
||||
// (damage_scale; HAM-X stage 3 1.4 — attack@splash_atk_scale, attack@sluggish): the trait splash ×damage_scale
|
||||
// (headb2_t_1[damage_scale]: ON_OUTPUT_DAMAGE on the APPLY_TO_HAMMER_SUBCLASS_SPLASH_TARGET damage, PHYSICAL — PRTS "伤害倍率提升
|
||||
// 而非攻击倍率提升,且不对特性主目标生效": dmg.mul, splash victims only). 高台 splash (PRTS "独立于攻击的效果,其以该次攻击中心为中心,
|
||||
// 选择1.0半径内的地块触发溅射(重叠判定),伤害溅射范围为周围4格+本格x-5(格子判定),造成物理溅射伤害" / "伤害会被视为远程途径伤害…
|
||||
// 由此伤害击倒的敌人会被视为无来源击杀"; the charpack's highland AoE: radius 1.0, x-5, targetMotion ground, physical, `_attackType`
|
||||
// ranged, sluggish from the blackboard, `_intervalTime` 0.1, SP via headb2_s_2[sp]): after each attack, every 高台 (a HIGH
|
||||
// tile of the field rect: walls and forbidden blocks) whose square the circle of radius 1.0 around the target touches
|
||||
// triggers; 0.1 s later the ground enemies she could select on its x-5 take attack@splash_atk_scale × her ATK at the trigger
|
||||
// (physical 溅射伤害: no dodge; 无来源 credited to her, 远程途径 — DamageInfo isProjectile) and 停顿 attack@sluggish s.
|
||||
// - T2 万众巨潮 "技能期间所有场上干员攻击力和防御力+14%,【乌萨斯学生自治团】干员获得加成效果翻倍" (atk / def, scale_bonus; the aura's
|
||||
// validator: ally operators of every profession, herself included; headb2_skill_judge switches it with her skill's start /
|
||||
// finish; headb2_t_2[filter_tag]: CheckCharacterGroupTag `student` ⇒ ×scale_bonus, MULTIPLIER attributes): while a skill of
|
||||
// hers runs, every operator of the field (teammates' in a shared field — the kits' field-wide convention) ATK / DEF
|
||||
// +atk / +def, ×scale_bonus for the 【乌萨斯学生自治团】 (character_table teamId `student`) — given at the cast, renewed every
|
||||
// TIDE_IV s (operators deployed meanwhile) and taken back at the end; two sources keep the strongest.
|
||||
// - S1 誓不低头 (MANUAL, data DEFAULT, 30 s): ATK +atk, ASPD +attack_speed.
|
||||
// - S2 绝不罢休 (AUTO): "被动效果:每次有高台触发第一天赋的效果时,获得1点技力" (sp_per_highland; PRTS 备注 "根据单次天赋触发的高台
|
||||
// 数量提供相应的sp") — +sp per 高台 that triggers, none while a skill runs (AK). "自动开启:攻击范围扩大,攻击力+60%,防御力+40%" —
|
||||
// a self buff, so it fires at full SP (`trigger: 'SP_FULL'`, the owner's AUTO rule, kits/README.md checklist 5): the 2-5
|
||||
// range, ATK / DEF for 16 s; "第二次及以后使用时能力加成变为最初的两倍,且持续时间无限" (headb2_s_2[second].atk / .def): from
|
||||
// the second cast of a deployment [ASSUMED: counted per deployment, as 提丰's S2] the doubled values until she leaves (a
|
||||
// toggle the kit ends after `duration` s on its first cast, as op-typhon.js).
|
||||
// - S3 无可抵挡 (MANUAL, data CUSTOM_RANGE on its trigger grid; the ability headb2_s3: `_additionalTimes` 4, each hit on its
|
||||
// clip's attack event, not affected by ASPD — PRTS 备注 "锤击间隔1.8s…不受攻击速度影响"): ATK +atk_base; five hammers at the
|
||||
// Skill_3 clip's OnAttack events (HAMMER_FRAMES at 30 fps: 1.1 … 7.77 s after the cast) and the skill over with the clip
|
||||
// (SKILL3_FRAMES, 9.23 s); she makes no normal attack meanwhile. headb2_s_3: spell_times from −1, +1 at each hammer's spell
|
||||
// ⇒ hammer k at ATK +atk_base + atk_step × (k − 1). Each hammer is centred 1.0 ahead (备注 "每次锤击以正前方1.0距离位置为中心"):
|
||||
// an enemy on the tile ahead is its main target (her order; usually none), atk_scale × ATK physical; every other ground enemy
|
||||
// within HAMMER_SPLASH ("主攻击拥有1.5的溅射半径") takes the trait's splash share (`_splashAtkScaleKey` atk_scale_2 — × atk_scale
|
||||
// as well, the kits' 撼地者 convention, 佩佩 S1 [ASSUMED] — ×汹涌怒火) — skill damage, not a normal attack [ASSUMED]. Each hammer
|
||||
// runs 汹涌怒火's 高台 round at its centre with the skill's change "伤害效果提升至3.5倍,控制效果变为1秒束缚" (the skill's AoE:
|
||||
// splash_atk_scale_base × splash_atk_scale_bonus, headb2_s_3[unmovable] for `unmovable` s instead of 停顿, `_firstIntervalTime`
|
||||
// 0.1 then `_intervalTime` 0.125 per step) and the spread (备注 "第二次锤击起,所有本次锤击触发第一天赋的高台生效时将令相邻的未受
|
||||
// 影响的高台触发第一天赋(即扩散),最大扩散次数等同于当前已完成锤击次数;不论如何,一轮锤击中每个高台只会触发一次天赋效果" / "离场时,
|
||||
// 未完成的天赋效果扩散将立刻终止"): hammer k spreads up to k − 1 steps to the four tiles next to each affected 高台 [ASSUMED:
|
||||
// "相邻" = the 4 neighbours]. A hammer due while she cannot act is lost [ASSUMED].
|
||||
|
||||
import { num, talentBb, traitBb, skillRec, up, giveSp } from '../shared/tier1.js';
|
||||
import { COLS } from '../../../constants.js';
|
||||
import { sortEnemyTargets } from '../../../targeting.js';
|
||||
|
||||
const S1 = 'skchr_headb2_1';
|
||||
const S2 = 'skchr_headb2_2';
|
||||
const S3 = 'skchr_headb2_3';
|
||||
/** PRTS 汹涌怒火 备注: "选择1.0半径内的地块触发溅射(重叠判定)". */
|
||||
const HIGHLAND_PICK_RADIUS = 1.0;
|
||||
/** PRTS 汹涌怒火 备注: "伤害溅射范围为周围4格+本格x-5(格子判定)" (symmetric: no rotation). */
|
||||
const X5 = Object.freeze([[0, 0], [1, 0], [-1, 0], [0, 1], [0, -1]]);
|
||||
/** 汹涌怒火's 高台 AoE: `_intervalTime` 0.1 (PRTS "高台溅射效果从触发/被扩散到生效具有0.1秒内置延迟"); S3's own AoE: `_firstIntervalTime`
|
||||
* 0.1, then `_intervalTime` 0.125 per spread step. */
|
||||
const HIGHLAND_DELAY = 0.1, S3_SPREAD_STEP = 0.125;
|
||||
/** The battle skeleton's Skill_3 clip (30 fps): 277 frames, OnAttack at frames 33, 84, 133, 182 and 233 (PRTS "锤击间隔1.8s"). */
|
||||
const FPS = 30, SKILL3_FRAMES = 277, HAMMER_FRAMES = Object.freeze([33, 84, 133, 182, 233]);
|
||||
/** PRTS 无可抵挡 备注: "每次锤击以正前方1.0距离位置为中心" / "主攻击拥有1.5的溅射半径". */
|
||||
const HAMMER_REACH = 1.0, HAMMER_SPLASH = 1.5;
|
||||
/** 【乌萨斯学生自治团】: character_table teamId `student` (古米, 凛冬, 烈夏, 苦艾, 真理, 早露, 怒潮凛冬; as op-poca.js). */
|
||||
const STUDENTS = new Set(['char_196_sunbr', 'char_115_headbr', 'char_194_leto', 'char_405_absin', 'char_195_glassb',
|
||||
'char_197_poca', 'char_1051_headb2']);
|
||||
/** 万众巨潮: the renewal of the aura while a skill of hers runs. */
|
||||
const TIDE_IV = 0.25;
|
||||
const TIDE_KEY = 'talent:headb2:tide';
|
||||
const S2_KEY = 'skill:headb2:s2';
|
||||
const STEP_KEY = 'skill:headb2:step';
|
||||
const HAMMER_TAG = 'headb2Hammer';
|
||||
const HIGHLAND_TAG = 'headb2Highland';
|
||||
const GROUND = Object.freeze({ canHitFly: false });
|
||||
|
||||
const bbOf = (chess, id) => skillRec(chess, id)?.bb ?? {};
|
||||
const tagged = (d, tag) => !!d && Array.isArray(d.tags) && d.tags.includes(tag);
|
||||
const isOp = (a) => !!a && a.kind === 'op';
|
||||
|
||||
/** Tile keys of the 高台 (HIGH tiles of the field rect) whose square the circle of radius `r` around (x, y) touches. */
|
||||
function highlandsAround(battle, x, y, r = HIGHLAND_PICK_RADIUS) {
|
||||
const g = battle.grid, out = [];
|
||||
for (let row = Math.floor(y - r); row <= Math.ceil(y + r); row++) {
|
||||
for (let col = Math.floor(x - r); col <= Math.ceil(x + r); col++) {
|
||||
if (!g.inRect(row, col) || g.tile(row, col).height !== 'HIGH') continue;
|
||||
const dx = Math.max(Math.abs(x - col) - 0.5, 0), dy = Math.max(Math.abs(y - row) - 0.5, 0);
|
||||
if (dx * dx + dy * dy <= r * r + 1e-9) out.push(row * COLS + col);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
/** The 高台 next to tile key `k` (the spread of S3). */
|
||||
function highlandNeighbours(battle, k) {
|
||||
const r = Math.floor(k / COLS), c = k % COLS, g = battle.grid, out = [];
|
||||
for (const [dr, dc] of X5) {
|
||||
if (!dr && !dc) continue;
|
||||
const rr = r + dr, cc = c + dc;
|
||||
if (g.inRect(rr, cc) && g.tile(rr, cc).height === 'HIGH') out.push(rr * COLS + cc);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
export default {
|
||||
char_1051_headb2: (bb, chess) => {
|
||||
const t0 = talentBb(chess, 0), t1 = talentBb(chess, 1);
|
||||
const tb = traitBb(chess);
|
||||
const b1 = bbOf(chess, S1), b2 = bbOf(chess, S2), b3 = bbOf(chess, S3);
|
||||
const s2 = skillRec(chess, S2);
|
||||
const splashMul = num(t0.damage_scale, 1);
|
||||
const hxScale = num(tb.atk_scale_e, 1), hxCnt = num(tb.cnt, Infinity);
|
||||
const hamx = (n) => (hxScale !== 1 && n >= hxCnt ? hxScale : 1);
|
||||
const traitShare = num(tb['attack@atk_scale_2'], 0.5);
|
||||
|
||||
/** One 高台 taking effect: its x-5 ground enemies take the splash and 停顿 (束缚 during S3). */
|
||||
const highlandStrike = (battle, unit, k, atk, s3) => {
|
||||
const r = Math.floor(k / COLS), c = k % COLS;
|
||||
const keys = [];
|
||||
for (const [dr, dc] of X5) if (battle.grid.inRect(r + dr, c + dc)) keys.push((r + dr) * COLS + c + dc);
|
||||
const foes = battle.enemiesInKeys(keys, unit, GROUND);
|
||||
battle.fx('aoe', { x: c, y: r, radius: 1, id: unit.id, skill: 'headb2:highland' });
|
||||
if (!foes.length) return;
|
||||
const amount = atk * num(t0['attack@splash_atk_scale']) * (s3 ? num(b3.splash_atk_scale_bonus, 1) : 1) * hamx(foes.length);
|
||||
for (const e of foes) {
|
||||
if (!e.alive) continue;
|
||||
battle.dealDamage(unit, e, { amount, type: 'phys', isSplash: true, canDodge: false, sourceless: true, isProjectile: true, tags: [HIGHLAND_TAG] });
|
||||
if (!e.alive) continue;
|
||||
if (s3) battle.applyStatus(e, 'bind', { duration: num(b3.unmovable, 1), source: unit });
|
||||
else if (num(t0['attack@sluggish']) > 0) battle.applyStatus(e, 'sluggish', { duration: num(t0['attack@sluggish']), source: unit });
|
||||
}
|
||||
};
|
||||
/**
|
||||
* A round of 汹涌怒火's 高台 splashes centred on (x, y): every 高台 within 1.0 triggers now and takes effect
|
||||
* HIGHLAND_DELAY s later; with `depth` > 0 (S3) each one that takes effect makes the 高台 next to it that this round has
|
||||
* not touched yet trigger — S3_SPREAD_STEP s later —, up to `depth` steps. S2's passive: +sp per 高台 that triggers.
|
||||
*/
|
||||
const highlandRound = (battle, unit, x, y, depth = 0) => {
|
||||
const tiles = highlandsAround(battle, x, y);
|
||||
if (!tiles.length) return;
|
||||
const seq = unit.deploySeq, atk = unit.s.atk;
|
||||
const s3 = !!(unit.skill?.active && unit.skill.id === S3);
|
||||
const sp = unit.skill?.id === S2 ? num(b2.sp_per_highland) : 0;
|
||||
const seen = new Set(tiles);
|
||||
const trigger = (k, step) => {
|
||||
if (sp > 0) giveSp(unit, sp);
|
||||
battle.after(step > 0 && s3 ? S3_SPREAD_STEP : HIGHLAND_DELAY, () => {
|
||||
if (!(unit.alive && unit.deployed && unit.deploySeq === seq)) return; // 离场: the round stops
|
||||
highlandStrike(battle, unit, k, atk, s3);
|
||||
if (step >= depth) return;
|
||||
for (const nb of highlandNeighbours(battle, k)) if (!seen.has(nb)) { seen.add(nb); trigger(nb, step + 1); }
|
||||
}, { owner: unit });
|
||||
};
|
||||
for (const k of tiles) trigger(k, 0);
|
||||
};
|
||||
/** S3 hammer `k` (1-based): centred 1.0 ahead, a main target on the tile ahead if any, the 1.5 splash, the 高台 round. */
|
||||
const hammer = (battle, unit, k) => {
|
||||
const [fr, fc] = unit.fwd;
|
||||
const cx = unit.x + fc * HAMMER_REACH, cy = unit.y + fr * HAMMER_REACH;
|
||||
const tr = unit.tileR + fr, tc = unit.tileC + fc;
|
||||
let main = null;
|
||||
if (battle.grid.inRect(tr, tc)) {
|
||||
const cands = battle.enemiesInKeys([tr * COLS + tc], unit, unit.profile);
|
||||
sortEnemyTargets(battle, unit, cands, unit.profile?.priority ?? null);
|
||||
main = cands[0] ?? null;
|
||||
}
|
||||
const around = battle.foesInRadius(cx, cy, HAMMER_SPLASH, true).filter((e) => e !== main && !e.isFlying);
|
||||
const atk = unit.s.atk, scale = num(b3.atk_scale, 1) * hamx((main ? 1 : 0) + around.length);
|
||||
battle.fx('aoe', { x: cx, y: cy, radius: HAMMER_SPLASH, id: unit.id, skill: 'headb2:hammer' });
|
||||
if (main && main.alive) battle.dealDamage(unit, main, { amount: atk * scale, type: 'phys', isSkill: true, tags: ['skill', HAMMER_TAG] });
|
||||
for (const e of around) {
|
||||
if (!e.alive) continue;
|
||||
battle.dealDamage(unit, e, { amount: atk * scale * traitShare, type: 'phys', isSkill: true, isSplash: true, mul: splashMul, tags: ['skill', HAMMER_TAG] });
|
||||
}
|
||||
highlandRound(battle, unit, cx, cy, k - 1);
|
||||
};
|
||||
|
||||
return {
|
||||
skills: {
|
||||
[S1]: { kind: 'duration', mods: { atkPct: num(b1.atk), aspd: num(b1.attack_speed) } },
|
||||
[S2]: {
|
||||
kind: 'toggle',
|
||||
trigger: { rule: 'SP_FULL' },
|
||||
targeting: { rangeGrid: s2?.rangeGrid ?? null },
|
||||
onStart({ battle, unit, skill }) {
|
||||
const later = (unit.mem.headb2S2Casts ?? 0) >= 1;
|
||||
unit.mem.headb2S2Casts = (unit.mem.headb2S2Casts ?? 0) + 1;
|
||||
const atk = later ? num(b2['headb2_s_2[second].atk']) : num(b2.atk);
|
||||
const def = later ? num(b2['headb2_s_2[second].def']) : num(b2.def);
|
||||
battle.addBuff(unit, { key: S2_KEY, mods: { atkPct: atk, defPct: def }, tags: ['skill'] });
|
||||
skill.timeLeft = later ? Infinity : Math.max(0.01, skill.duration);
|
||||
},
|
||||
onTick({ skill, dt }) {
|
||||
if (!Number.isFinite(skill.timeLeft)) return;
|
||||
skill.timeLeft -= dt;
|
||||
if (skill.timeLeft <= 1e-9) skill.end('duration');
|
||||
},
|
||||
onEnd({ battle, unit }) { battle.removeBuff(unit, S2_KEY); },
|
||||
},
|
||||
[S3]: {
|
||||
kind: 'duration',
|
||||
duration: SKILL3_FRAMES / FPS,
|
||||
mods: { atkPct: num(b3.atk_base) },
|
||||
attack: { noAttack: true },
|
||||
onStart({ battle, unit, skill }) {
|
||||
const n0 = skill.activations, seq = unit.deploySeq, step = num(b3.atk_step);
|
||||
let done = 0;
|
||||
for (const f of HAMMER_FRAMES) {
|
||||
battle.after(f / FPS, () => {
|
||||
if (!(unit.alive && unit.deployed && unit.deploySeq === seq && skill.active && skill.activations === n0)) return;
|
||||
if (!unit.canAct) return; // a hammer due while she cannot act is lost [ASSUMED]
|
||||
hammer(battle, unit, done + 1);
|
||||
done++;
|
||||
if (step) battle.addBuff(unit, { key: STEP_KEY, mods: { atkPct: step * done }, tags: ['skill'] });
|
||||
}, { owner: unit });
|
||||
}
|
||||
},
|
||||
onEnd({ battle, unit }) { battle.removeBuff(unit, STEP_KEY); },
|
||||
},
|
||||
},
|
||||
talents: [
|
||||
{ install(battle, unit) { // 汹涌怒火: the trait splash ×damage_scale (the 高台 rounds: trait.afterHit and the hammers)
|
||||
if (splashMul === 1) return;
|
||||
battle.on('hit', (c) => {
|
||||
const d = c.dmg;
|
||||
if (c.source === unit && d.isAttack && d.isSplash && !tagged(d, HAMMER_TAG)) d.mul *= splashMul;
|
||||
}, { owner: unit });
|
||||
} },
|
||||
{ install(battle, unit) { // 万众巨潮: every operator of the field ATK / DEF + while a skill of hers runs (students ×)
|
||||
const a = num(t1.atk), d = num(t1.def), x = num(t1.scale_bonus, 1);
|
||||
if (!a && !d) return;
|
||||
const inSkill = () => !!(unit.skill && unit.skill.active && unit.skill.kind !== 'passive');
|
||||
const give = () => {
|
||||
if (!up(unit) || !inSkill()) return;
|
||||
for (const o of battle.alliesFor(unit)) {
|
||||
if (!isOp(o)) continue;
|
||||
const k = STUDENTS.has(o.def?.charId) ? x : 1;
|
||||
const cur = o.findBuff(TIDE_KEY);
|
||||
if (cur && cur.source !== unit && (cur.data?.v ?? 0) > a * k && cur.timeLeft > 0.05) continue;
|
||||
battle.addBuff(o, { key: TIDE_KEY, duration: TIDE_IV + 0.1, mods: { atkPct: a * k, defPct: d * k }, source: unit, data: { v: a * k }, tags: ['aura'] });
|
||||
}
|
||||
};
|
||||
battle.every(TIDE_IV, give, { owner: unit });
|
||||
battle.on('skillStart', (c) => { if (c.unit === unit) give(); }, { owner: unit });
|
||||
battle.on('skillEnd', (c) => {
|
||||
if (c.unit !== unit) return;
|
||||
for (const o of battle.allyUnits) { const b = o.findBuff(TIDE_KEY); if (b && b.source === unit) battle.removeBuff(o, b); }
|
||||
}, { owner: unit });
|
||||
} },
|
||||
],
|
||||
// 汹涌怒火's 高台 round after each attack, centred on its target
|
||||
trait: { afterHit: (battle, unit, target, hctx) => { if (unit.alive && unit.deployed) highlandRound(battle, unit, hctx.x, hctx.y); } },
|
||||
install(battle, unit) {
|
||||
// S2: the cast count of a deployment [ASSUMED per deployment]
|
||||
battle.on('deploy', (c) => { if (c.unit === unit) unit.mem.headb2S2Casts = 0; }, { owner: unit });
|
||||
// HAM-X: ≥ cnt ground enemies in the splash range of the attack's target ⇒ ×atk_scale_e on each of its instances
|
||||
if (hxScale === 1) return;
|
||||
battle.on('hit', (c) => {
|
||||
const d = c.dmg;
|
||||
if (c.source !== unit || !d.isAttack || !d.attackId || tagged(d, HAMMER_TAG)) return;
|
||||
const m = unit.mem;
|
||||
if (m.headb2HamxId !== d.attackId) {
|
||||
// the first instance of an attack is its target's (ai.js resolveHit: the main hit, then the splash)
|
||||
const t = c.target;
|
||||
m.headb2HamxId = d.attackId;
|
||||
m.headb2HamxMul = hamx(1 + battle.foesInRadius(t.x, t.y, unit.profile?.splashRadius || 1, true).filter((e) => e !== t && !e.isFlying).length);
|
||||
}
|
||||
d.amount *= m.headb2HamxMul ?? 1;
|
||||
}, { owner: unit, priority: 5 });
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,176 @@
|
||||
// server/sim/content/kits/ops/op-hodrer.js — 赫德雷 (char_4088_hodrer) 自选 operator kit: 6★ 重剑手 (近卫), an owned-6★ pick of
|
||||
// the tier-5 and tier-6 自选 slots; every skill, both talents, the trait and both modules at every form.
|
||||
// Kit contract and the 自选 rules: ../README.md ("How to add an operator (自选)").
|
||||
//
|
||||
// Forms (data/backups.json units.char_4088_hodrer, the DIY slot statuses): normal = E2 Lv1, skills at rank 4, no module;
|
||||
// elite = E2 Lv60, rank 7, the picked module at stage 1 (tier 5) or 3 (tier 6). Potential 0 [ASSUMED: no account].
|
||||
// Sources: character_table / skill_table / battle_equip_table (zh_CN, as built into backups.json); PRTS 赫德雷 (备注 of 及锋而试
|
||||
// and 死境硝烟); PRTS 卫戍协议/帮助 §技能操作 ("携带状态切换类技能的干员…每次部署后仅开启一次技能"); gamedata_const ba.protect 庇护,
|
||||
// ba.stun 晕眩, ba.root 束缚; PRTS 伤害分类 (无来源真实持续伤害); the client's battle data read from the local install —
|
||||
// charpack char_4088_hodrer, battle/prefabs [uc]skills skchr_hodrer_1/2/3 and [uc]equips hodrer_equip_*, buff_template_data
|
||||
// hodrer_* (named below).
|
||||
// - Trait (重剑手) "同时攻击阻挡的所有敌人": the profession (melee physical, ground only, block 2, 2.5 s).
|
||||
// - Module CRU-X 新的生活: trait "受到的治疗效果提升20%" (trait bb heal_scale; equip_heal_scale_up): healingTakenMul ×heal_scale —
|
||||
// his own S1 / S3 heals included. Stage 3: 余火之氅 28 % and 物理伤害 +10 % (below).
|
||||
// - Module CRU-Y 笔迹: trait "对被阻挡的敌人伤害提升至110%" (trait bb damage_scale; hodrer_e_003_tr: ON_OUTPUT_DAMAGE, CheckBlocked
|
||||
// by the buff's source — him): ×damage_scale (a damage multiplier) on every damage of his on an enemy HE blocks. Stage 3:
|
||||
// 及锋而试 130 % / 160 % and its first-hit stun (below).
|
||||
// - T1 及锋而试 "攻击敌人时攻击力提升至110%,若目标处于晕眩、束缚则改为提升至140%" (atk_scale_2 / atk_scale; hodrer_t_1:
|
||||
// ON_CALCULATE_DAMAGE, abnormal flags STUNNED / UNMOVABLE → AtkScaleUp): each damage instance of his attacks ×atk_scale_2, or
|
||||
// ×atk_scale on a target under a 晕眩 or 束缚 status (冻结 is neither) — an ATK scale, before DEF. PRTS 备注 "本天赋于每次攻击的
|
||||
// 附加效果后、计算伤害前判断并生效": the attack's riders come first, in the same `hit` step — S2's stun and S3's stun roll (the
|
||||
// attacks' `_activeBuffs`), then CRU-Y stage 3's "且对阻挡的敌人首次造成伤害时对其造成2.5秒晕眩效果" (hodrer_e_003_t, event
|
||||
// priority 2000 — before 及锋而试: an enemy he blocks without his mark gets it and stuns `stun` s; the marks are derived from
|
||||
// the module talent's buff, so they go when he leaves the field and a redeployed 赫德雷 stuns anew) — so a hit that stuns
|
||||
// counts as on a stunned target; a rider lands when the hit is then dodged [ASSUMED: the client applies them in the attack's
|
||||
// damage calculation].
|
||||
// - T2 余火之氅 "使自身与身后一格的友军获得18%的庇护" (damage_resistance, talent grid b-1: his tile and the one behind; CRU-X
|
||||
// stage 3 "28%…且造成的物理伤害提升10%" — hodrer_equip_1_3_p2 gives damage_resistance[inf] and hodrer_equip[damage_scale_up]
|
||||
// (ON_OUTPUT_DAMAGE PHYSICAL ×damage_scale) to the same targets, ally side, any motion, removed when they leave): 庇护
|
||||
// (ba.protect "受到的物理和法术伤害降低相应比例(同名效果取最高)") = phys / artsTakenMul 1 − value as one instance per ally
|
||||
// (applyStrongest) with physDealtMul ×damage_scale, renewed every PROTECT_IV s on the allies of the grid while he is deployed.
|
||||
// - S1 重锋不熄 (AUTO, hit SP: INCREASE_WHEN_ATTACK, data DEFAULT): the next attack (every enemy he blocks) at atk_scale × ATK;
|
||||
// hodrer_s[heal] (ON_ABILITY_SPELL_ON, HealViaMaxHpRatio) heals hp_ratio of his max HP once for that attack.
|
||||
// - S2 余烬重荷 (MANUAL, data DEFAULT): "被动效果:攻击力+16%" (atk; the skill's extra ability hodrer_s_2[passive]) while it is
|
||||
// his skill; "主动触发可以在下列状态和初始状态间切换" — a 状态切换类 skill, switched on once per deployment and kept (the official
|
||||
// auto-battle rule, `toggle`): attack interval +base_attack_time s (flat), block +block_cnt, every attack stuns its targets
|
||||
// attack@stun s.
|
||||
// - S3 死境硝烟 (MANUAL, data ACTIVE_RANGE on its running range, 70 / 70 s): max HP +max_hp, ATK +atk, 攻击距离
|
||||
// +ability_range_forward_extend; each attack heals attack@hp_ratio of his max HP (hodrer_s[heal], once per attack) and stuns
|
||||
// each target attack@stun s with attack@buff_prob. hodrer_s_3[damage] (triggerInterval 1 s, the first after 1 s): he loses
|
||||
// attack@value HP every second (FixedValueDamage that skips the damage events: a 流失 here [ASSUMED: it may knock him out —
|
||||
// no floor is named]); every damage he outputs on an enemy, and every damage an enemy deals him, marks that enemy if it is
|
||||
// not 无敌 (one hodrer_s_3[burn] per enemy and 赫德雷, PRTS 备注 "仅判定本次技能期间满足条件的非无敌敌方单位…不可叠加"): from
|
||||
// then on it takes attack@damage 无来源 true damage (NoSourceDamage PURE: damage.js periodicDamage, credited to him) every
|
||||
// second of its own (triggerInterval 1 s from its mark) until the skill ends (a derived buff of the skill's).
|
||||
|
||||
import { num, talentBb, talentGrid, moduleBb, traitBb, skillRec, statBuff, up, batMod, alliesInGridOf } from '../shared/tier1.js';
|
||||
import { periodicDamage } from '../../../damage.js';
|
||||
|
||||
const S1 = 'skchr_hodrer_1';
|
||||
const S2 = 'skchr_hodrer_2';
|
||||
const S3 = 'skchr_hodrer_3';
|
||||
/** 余火之氅's grid when the data carries none: his tile and the one behind him (range b-1). */
|
||||
const BEHIND = Object.freeze([Object.freeze([0, -1]), Object.freeze([0, 0])]);
|
||||
const PROTECT_IV = 0.25;
|
||||
const PROTECT_KEY = 'talent:hodrer:protect';
|
||||
const S2_PASSIVE_KEY = 'skill:hodrer:s2passive';
|
||||
/** hodrer_s_3[damage] / hodrer_s_3[burn]: triggerInterval 1 s, waitFirstTriggerInterval. */
|
||||
const SMOKE_IV = 1;
|
||||
/** The riders and 及锋而试 before the other `hit` handlers read the hit. */
|
||||
const T1_PRIORITY = 10;
|
||||
|
||||
const bbOf = (chess, id) => skillRec(chess, id)?.bb ?? {};
|
||||
/** Under a 晕眩 or 束缚 status (及锋而试: abnormal flags STUNNED / UNMOVABLE). */
|
||||
const held = (e) => e.buffs.some((b) => (b.status ?? b.key) === 'stun' || (b.status ?? b.key) === 'bind');
|
||||
/** The S3 burn of one 赫德雷 on an enemy (independentCharacterSource: one per source). */
|
||||
const smokeKey = (unit) => `skill:hodrer:smoke:${unit.id}`;
|
||||
|
||||
export default {
|
||||
char_4088_hodrer: (bb, chess) => {
|
||||
const t0 = talentBb(chess, 0), t1 = talentBb(chess, 1);
|
||||
const hidden = moduleBb(chess); // CRU-Y stage 3: stun (the first-hit stun on an enemy he blocks)
|
||||
const tb = traitBb(chess);
|
||||
const b1 = bbOf(chess, S1), b2 = bbOf(chess, S2), b3 = bbOf(chess, S3);
|
||||
const selfHeal = (battle, unit, ratio) => { if (ratio > 0) battle.heal(unit, unit, unit.s.maxHp * ratio, { self: true }); };
|
||||
/** S3: mark `e` (not 无敌) for this cast — its own 1 s burn until the skill ends. */
|
||||
const mark = (battle, unit, e) => {
|
||||
const marks = unit.mem.hodrerMarks;
|
||||
if (!marks || marks.has(e) || !e.alive || e.s.flags.invulnerable) return;
|
||||
marks.add(e);
|
||||
const dmg = num(b3['attack@damage']);
|
||||
battle.addBuff(e, {
|
||||
key: smokeKey(unit), interval: SMOKE_IV, source: unit, tags: ['skill'],
|
||||
onTick: ({ battle: b, unit: target }) => { if (dmg > 0) b.dealDamage(unit, target, periodicDamage(dmg)); },
|
||||
});
|
||||
};
|
||||
return {
|
||||
skills: {
|
||||
[S1]: {
|
||||
kind: 'instant',
|
||||
attack: { atkScale: num(b1.atk_scale, 1) },
|
||||
onAttack({ battle, unit }) { selfHeal(battle, unit, num(b1.hp_ratio)); },
|
||||
},
|
||||
[S2]: {
|
||||
kind: 'toggle',
|
||||
mods: { batPct: batMod(b2.base_attack_time, chess), blockCnt: num(b2.block_cnt) },
|
||||
},
|
||||
[S3]: {
|
||||
kind: 'duration',
|
||||
mods: { hpPct: num(b3.max_hp), atkPct: num(b3.atk) },
|
||||
targeting: { rangeExtend: num(b3.ability_range_forward_extend) },
|
||||
onStart({ battle, unit, skill }) {
|
||||
const n0 = skill.activations;
|
||||
unit.mem.hodrerMarks = new Set();
|
||||
unit.mem.hodrerSmoke = battle.every(SMOKE_IV, (b, sc) => {
|
||||
if (!skill.active || skill.activations !== n0 || !up(unit)) { sc.cancel(); return; }
|
||||
battle.loseHp(unit, num(b3['attack@value']), { source: unit, tags: ['hodrer:smoke'] });
|
||||
}, { owner: unit });
|
||||
},
|
||||
onAttack({ battle, unit }) { selfHeal(battle, unit, num(b3['attack@hp_ratio'])); },
|
||||
onEnd({ battle, unit }) {
|
||||
unit.mem.hodrerSmoke?.cancel();
|
||||
unit.mem.hodrerSmoke = null;
|
||||
for (const e of unit.mem.hodrerMarks ?? []) battle.removeBuff(e, smokeKey(unit));
|
||||
unit.mem.hodrerMarks = null;
|
||||
},
|
||||
},
|
||||
},
|
||||
talents: [
|
||||
{ install(battle, unit) { // 及锋而试 (+ the riders that precede it): ×atk_scale_2, ×atk_scale on a stunned / bound target
|
||||
const firstStun = num(hidden.stun);
|
||||
let stunnedOnce = new WeakSet(); // CRU-Y stage 3's marks, gone with his deployment
|
||||
battle.on('deploy', (c) => { if (c.unit === unit) stunnedOnce = new WeakSet(); }, { owner: unit });
|
||||
battle.on('hit', (c) => {
|
||||
const d = c.dmg, e = c.target;
|
||||
if (c.source !== unit || !d.isAttack || d.cancel || !e || e.side !== 'enemy') return;
|
||||
const sk = unit.skill;
|
||||
if (sk?.active && sk.id === S2) battle.applyStatus(e, 'stun', { duration: num(b2['attack@stun']), source: unit });
|
||||
if (sk?.active && sk.id === S3 && e.alive && battle.rng.chance(num(b3['attack@buff_prob']))) {
|
||||
battle.applyStatus(e, 'stun', { duration: num(b3['attack@stun']), source: unit });
|
||||
}
|
||||
if (firstStun > 0 && e.alive && e.blockedBy === unit && !stunnedOnce.has(e)) {
|
||||
stunnedOnce.add(e);
|
||||
battle.applyStatus(e, 'stun', { duration: firstStun, source: unit });
|
||||
}
|
||||
d.amount *= held(e) ? num(t0.atk_scale, 1) : num(t0.atk_scale_2, 1);
|
||||
}, { owner: unit, priority: T1_PRIORITY });
|
||||
} },
|
||||
{ install(battle, unit) { // 余火之氅: 庇护 (and CRU-X stage 3 物理伤害 +) on his tile and the one behind
|
||||
const dr = num(t1.damage_resistance), ds = num(t1.damage_scale, 1);
|
||||
const grid = talentGrid(chess, 1) ?? BEHIND;
|
||||
if (!(dr > 0) && ds === 1) return;
|
||||
const mods = (v) => ({ physTakenMul: 1 - v, artsTakenMul: 1 - v, ...(ds !== 1 ? { physDealtMul: ds } : {}) });
|
||||
const give = () => {
|
||||
if (!up(unit)) return;
|
||||
for (const a of alliesInGridOf(battle, unit, grid)) battle.applyStrongest(a, PROTECT_KEY, { duration: PROTECT_IV + 0.1, value: dr, mods, source: unit });
|
||||
};
|
||||
battle.every(PROTECT_IV, give, { owner: unit });
|
||||
battle.on('battleStart', give, { owner: unit });
|
||||
battle.on('deploy', (c) => { if (c.unit === unit && battle.started) give(); }, { owner: unit });
|
||||
} },
|
||||
],
|
||||
install(battle, unit) {
|
||||
// CRU-X: 受到的治疗效果提升20%
|
||||
statBuff(battle, unit, 'trait:hodrer:heal', { healingTakenMul: num(tb.heal_scale, 1) });
|
||||
// CRU-Y: 对被(自身)阻挡的敌人伤害提升至110%
|
||||
const vs = num(tb.damage_scale, 1);
|
||||
if (vs !== 1) {
|
||||
battle.on('hit', (c) => {
|
||||
if (c.source === unit && c.target && c.target.side === 'enemy' && c.target.blockedBy === unit) c.dmg.mul *= vs;
|
||||
}, { owner: unit });
|
||||
}
|
||||
// S2's passive part: 攻击力+16% while 余烬重荷 is his skill
|
||||
if (unit.skill?.id === S2) statBuff(battle, unit, S2_PASSIVE_KEY, { atkPct: num(b2.atk) });
|
||||
// S3: every damage either way between him and an enemy marks the enemy for the running cast
|
||||
if (unit.skill?.id === S3) {
|
||||
battle.on('hit', (c) => {
|
||||
if (!unit.mem.hodrerMarks) return;
|
||||
if (c.source === unit && c.target && c.target.side === 'enemy') mark(battle, unit, c.target);
|
||||
else if (c.target === unit && c.source && c.source.side === 'enemy') mark(battle, unit, c.source);
|
||||
}, { owner: unit });
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,283 @@
|
||||
// server/sim/content/kits/ops/op-vvana.js — 薇薇安娜 (char_4098_vvana) 自选 operator kit: 6★ 术战者 (近卫), an owned-6★ pick
|
||||
// of the tier-5 and tier-6 自选 slots; every skill, both talents, the trait and both modules at every form.
|
||||
// Kit contract and the 自选 rules: ../README.md ("How to add an operator (自选)").
|
||||
//
|
||||
// Forms (data/backups.json units.char_4098_vvana, the DIY slot statuses): normal = E2 Lv1, skills at rank 4, no module;
|
||||
// elite = E2 Lv60, rank 7, the picked module at stage 1 (tier 5) or 3 (tier 6). Potential 0 [ASSUMED: no account].
|
||||
// Sources: character_table / skill_table / battle_equip_table (zh_CN, as built into backups.json); PRTS 薇薇安娜 (备注 of
|
||||
// 散华, 光影迅捷剑 and “明灭”, the AFT-Δ trait note); gamedata_const ba.charged 蓄力, ba.shield 护盾, ba.steal 偷取,
|
||||
// ba.magicfragile 法术脆弱; PRTS 作战机制 (伤害流程, 远近途径 "有弹道的攻击固定为10,无弹道的攻击固定为01"); range_table 3-2; the
|
||||
// client's battle data read from the local install — charpack char_4098_vvana, battle/prefabs [uc]skills skchr_vvana_1/2/3
|
||||
// and [uc]equips vvana_equip_*, buff_template_data vvana_* (the templates are named below).
|
||||
// - Trait (术战者) "攻击造成法术伤害": the profession (melee arts, ground only, block 1, 1.25 s).
|
||||
// - Module AFT-D 目不能及之处: trait "攻击灼燃损伤爆发期间的目标时额外造成攻击力15%的元素伤害" (trait bb ep_damage_ratio; PRTS
|
||||
// "※于任意非本模组特性的伤害的输出伤害时触发"; vvana_e_002_trait: ON_OUTPUT_DAMAGE, not its own damage, the target in its FIRE
|
||||
// 爆发冷却 → ELEMENT damage ep_damage_ratio × ATK): every damage instance she outputs on an enemy holding the `burnBurst` lock
|
||||
// (docs/SIM.md §3) — at the output (the `hit` step, before the target's dodge / cancel) — adds ep_damage_ratio × ATK
|
||||
// 元素伤害. Stage 3: 燃烛施明's 灼燃损伤 (below).
|
||||
// - Module AFT-Y “最后一行”: trait "自身阻挡的敌人受到10%的法术脆弱效果" (trait bb damage_scale 1.1; vvana_equip_2_*: weak[magic]
|
||||
// to every blockee): the 法术脆弱 status (同名效果取最高) on each enemy she blocks, renewed every 0.2 s for 0.3 s (as 史尔特尔's
|
||||
// AFT-Y). Stage 3: 散华 25 %, 2 layers (below).
|
||||
// - T1 燃烛施明 "造成的法术伤害+8%,受到的物理和法术伤害-8%。攻击范围内存在精英或领袖敌人时,该效果提升至2倍" (damage_scale_m,
|
||||
// damage_resistance_pm, super_scale; vvana_t_1[self] / [aura] / [super]: an aura on the enemies of her current range —
|
||||
// targetMotion ALL, flyers too, no untargetable one — and on those she blocks; an ELITE / BOSS one swaps [self] for [super],
|
||||
// ×super_scale): artsDealtMul 1 + 0.08 f, phys / artsTakenMul 1 − 0.08 f, f = super_scale while such an enemy is there, else
|
||||
// 1 — re-read every tick and before every hit she deals or takes. AFT-D stage 3 "攻击附带相当于9%伤害的灼燃损伤"
|
||||
// (ep_damage_ratio_m; the templates' ON_AFTER_OUTPUT_DAMAGE on her non-continuous arts damage, ApplyElementDamageBasedOnDamageValue
|
||||
// FIRE): each arts damage instance of hers that removes HP carries ep × f × that damage as 灼燃损伤.
|
||||
// - T2 散华 "攻击精英或领袖敌人时,有18%概率获得一层仅抵挡近战攻击的护盾(最多1层)" (prob; AFT-Y stage 3: 25 %, max_stack_cnt 2;
|
||||
// S3: × talent_scale; vvana_t_2: ON_OUTPUT_DAMAGE on an ELITE_AND_BOSS target, Dice prob, CreateBuff vvana_t_2[block_melee] —
|
||||
// UNIQUE without max_stack_cnt, STACK up to it with — so a roll at the cap changes nothing, PRTS "※自身未存在本天赋的护盾时,每对
|
||||
// 符合条件的目标造成一次伤害判定一次本天赋"): one roll per damage instance she outputs on an elite / leader (any damage — the AFT-D
|
||||
// rider too — at the output, before the target's dodge / cancel). vvana_t_2[block_melee]: ON_TAKE_DAMAGE from an ENEMY source
|
||||
// with apply way MELEE → BlockDamage, one layer spent (ba.shield "每层护盾可以抵挡一次伤害"; PRTS "※仅来源于敌方单位的近战途径伤害
|
||||
// 可触发本天赋的护盾"): an enemy's damage that did not fly as a projectile (DamageInfo `isProjectile`, ai.js enemyAttack) is
|
||||
// negated whole in a late `hit` handler (cancel, as the enemies' 护盾 layers in content/enemies.js); 无来源 damage has no enemy
|
||||
// source. The enemy content's own projectiles (invisible / leaders / fly kits) are not marked and count as melee [ASSUMED].
|
||||
// - S1 光影迅捷剑 (AUTO, 2 charges, data DEFAULT — a "next attack" waits for her attack): the next attack at atk_scale × ATK,
|
||||
// S1_HITS hits (S1_Attack2, `_additionalTimes` 1). 蓄力 (ba.charged "回复至上限2倍时进入蓄力状态…任何时候开启均消耗全部技力"; PRTS
|
||||
// 备注 "未满足蓄力所需技力时…仅消耗技能最低所需技力" / "“蓄力”模式将在下一次技能结束时结束" / "“蓄力”模式期间…攻击范围变为3-2";
|
||||
// the skill's toggle at SP ratio 1 puts vvana_s_1[mode] — mode 1, range 3-2 — whose ON_SKILL_START clears the SP and
|
||||
// ON_SKILL_FINISH ends it; S1_Attack, `_additionalTimes` 2 on 3-2, needs its mark): with both charges stored her own range is
|
||||
// 3-2 (the DEFAULT trigger's initial range and the card follow it) until the next end of the skill; a cast then hits
|
||||
// S1_CHARGED_HITS times and spends every charge, a cast below that spends one charge.
|
||||
// - S2 烛燃影息 (MANUAL, data DEFAULT, 28 / 30 s; mode 2): ATK +atk, DEF +def, block +block_cnt, every attack hits all the
|
||||
// enemies she blocks; each attack picks Attack_Once / Attack_Twice (attack@prob_once / attack@prob_twice: one roll per
|
||||
// attack), the double hit at attack@atk_scale_twice × ATK carrying vvana_s_2[steal] (ON_BEFORE_TARGET_APPLY_MODIFIER of each
|
||||
// damage → vvana_steal_attack_speed: ba.steal "减少目标的基础属性作为自身加成,目标减少和自身加成的属性不超过指定上限(同类属性取最高)"):
|
||||
// each enemy it hits loses attack@steal_atk_speed ASPD (at most attack@steal_atk_speed_max per enemy, the largest of several
|
||||
// thieves) and she gains as much (at most the max in all) — "持续至技能结束或薇薇安娜离场"; a dodged hit steals too (the step
|
||||
// comes before the target's checks).
|
||||
// - S3 “明灭” (MANUAL, data DEFAULT, 15 s): attack interval +base_attack_time s (flat), ATK +atk, DEF +def, RES
|
||||
// +magic_resistance, S3_HITS hits per attack, 散华 × talent_scale, elite / leader enemies first (targeting priority 'elite',
|
||||
// after the enemies she blocks — the engine's order). "第二次及以后使用时,攻击距离+2,攻击变为三连击,持续时间延长至25秒" (PRTS
|
||||
// 备注 "每次部署薇薇安娜时,重新计算该技能的使用次数" / "首次技能结束后,本技能的技能范围永久扩大至3-2"; vvana_s_3[check]: a
|
||||
// skill triggered before ⇒ the enhance mark and duration_plus = enhance_duration, vvana_s_3: mode 4 instead of 3): from her
|
||||
// second cast of a deployment the skill runs enhance_duration s with S3_LATER_HITS hits on the 3-2 range (her own grid while
|
||||
// it runs: the card shows it). The trigger stays the data's DEFAULT on her own range for every cast — the later casts'
|
||||
// larger running range is no data range (reported, not changed: kits/README.md checklist 5).
|
||||
|
||||
import { num, talentBb, traitBb, skillRec, up, batMod } from '../shared/tier1.js';
|
||||
import { isElite, elementDmg, enemiesIn } from '../shared/tier6.js';
|
||||
import { hasHp } from '../../../damage.js';
|
||||
|
||||
const S1 = 'skchr_vvana_1';
|
||||
const S2 = 'skchr_vvana_2';
|
||||
const S3 = 'skchr_vvana_3';
|
||||
/** range_table 3-2: the 蓄力 range (PRTS S1 备注) and S3's range from its second cast (PRTS S3 备注). */
|
||||
const RANGE_3_2 = Object.freeze([[0, 0], [0, 1], [0, 2], [0, 3]].map((p) => Object.freeze(p)));
|
||||
/** S1 "并连续攻击两次" / 蓄力 "改为连续攻击三次"; S2 "二连击"; S3 "攻击变为二连击" / later "攻击变为三连击" — text only. */
|
||||
const S1_HITS = 2, S1_CHARGED_HITS = 3, S2_TWICE_HITS = 2, S3_HITS = 2, S3_LATER_HITS = 3;
|
||||
/** AFT-Y: the 法术脆弱 renewal (as 史尔特尔's AFT-Y, kits/ops/chess_char_5_07-surtr.js). */
|
||||
const FRAGILE_IV = 0.2, FRAGILE_DUR = 0.3;
|
||||
const AFTD_TAG = 'vvanaAftD';
|
||||
const CANDLE_KEY = 'talent:vvana:candle';
|
||||
const SHIELD_KEY = 'talent:vvana:shield';
|
||||
const LOOT_KEY = 'skill:vvana:loot';
|
||||
const STOLEN_KEY = 'skill:vvana:stolen';
|
||||
/** `hit` order: 燃烛施明 re-reads its factor first; the output effects (AFT-D, 散华's roll) come before the target-side
|
||||
* handlers (priority 0: the enemies' own 护盾, guards); 散华's 护盾 itself last (a guard that cancelled first spends none). */
|
||||
const CANDLE_PRIORITY = 100, OUTPUT_PRIORITY = 50, SHIELD_PRIORITY = -500;
|
||||
|
||||
const bbOf = (chess, id) => skillRec(chess, id)?.bb ?? {};
|
||||
const tagged = (d, tag) => !!d && Array.isArray(d.tags) && d.tags.includes(tag);
|
||||
/** Her own range grid (the form's 1-1), or the range she switches to. */
|
||||
function setGrid(battle, unit, grid) {
|
||||
if (!grid || unit.rangeGrid === grid) return;
|
||||
unit.rangeGrid = grid;
|
||||
battle.refreshRange(unit);
|
||||
}
|
||||
|
||||
// ---- S2 偷取: the losses of the enemies, one battle-wide table (同类属性取最高 over several thieves) ---------------------
|
||||
/** battle → Map(enemy → Map(thief id → ASPD stolen)). */
|
||||
const STOLEN = new WeakMap();
|
||||
const stolenOf = (battle) => { let m = STOLEN.get(battle); if (!m) STOLEN.set(battle, (m = new Map())); return m; };
|
||||
function applyLoss(battle, e, per) {
|
||||
let a = 0;
|
||||
for (const v of per.values()) a = Math.max(a, v);
|
||||
if (!(a > 0)) { battle.removeBuff(e, STOLEN_KEY); return; }
|
||||
battle.addBuff(e, { key: STOLEN_KEY, mods: { aspd: -a }, tags: ['steal'] });
|
||||
}
|
||||
function steal(battle, unit, e, n, cap) {
|
||||
if (!(n > 0) || !e || !e.alive || e.side !== 'enemy') return;
|
||||
const losses = stolenOf(battle);
|
||||
let per = losses.get(e);
|
||||
if (!per) losses.set(e, (per = new Map()));
|
||||
per.set(unit.id, Math.min(cap, (per.get(unit.id) ?? 0) + n));
|
||||
applyLoss(battle, e, per);
|
||||
(unit.mem.vvanaVictims ??= new Set()).add(e);
|
||||
unit.mem.vvanaLoot = Math.min(cap, (unit.mem.vvanaLoot ?? 0) + n);
|
||||
battle.addBuff(unit, { key: LOOT_KEY, mods: { aspd: unit.mem.vvanaLoot }, tags: ['skill'] });
|
||||
}
|
||||
/** "持续至技能结束或薇薇安娜离场": she gives everything back. */
|
||||
function returnLoot(battle, unit) {
|
||||
battle.removeBuff(unit, LOOT_KEY);
|
||||
unit.mem.vvanaLoot = 0;
|
||||
const losses = stolenOf(battle);
|
||||
for (const e of unit.mem.vvanaVictims ?? []) {
|
||||
const per = losses.get(e);
|
||||
if (!per || !per.delete(unit.id)) continue;
|
||||
if (e.alive) applyLoss(battle, e, per);
|
||||
}
|
||||
unit.mem.vvanaVictims = new Set();
|
||||
}
|
||||
|
||||
export default {
|
||||
char_4098_vvana: (bb, chess) => {
|
||||
const t0 = talentBb(chess, 0), t1 = talentBb(chess, 1);
|
||||
const tb = traitBb(chess);
|
||||
const b1 = bbOf(chess, S1), b2 = bbOf(chess, S2), b3 = bbOf(chess, S3);
|
||||
const twice = num(b2['attack@atk_scale_twice'], 1);
|
||||
return {
|
||||
skills: {
|
||||
[S1]: {
|
||||
kind: 'charges',
|
||||
attack: { atkScale: num(b1.atk_scale, 1), hitsFn: (b, u) => (u.mem.vvanaCast === 'charged' ? S1_CHARGED_HITS : S1_HITS) },
|
||||
onStart({ unit, skill }) {
|
||||
// after activate's one charge: still ≥ max − 1 ⇒ every charge was stored (蓄力) — a charged cast spends them all
|
||||
const charged = !!unit.mem.vvanaCharged || (skill.maxCharges > 1 && skill.charges >= skill.maxCharges - 1);
|
||||
unit.mem.vvanaCast = charged ? 'charged' : 'plain';
|
||||
if (charged) { skill.charges = 0; skill.sp = 0; }
|
||||
},
|
||||
onEnd({ unit }) { unit.mem.vvanaCast = null; },
|
||||
},
|
||||
[S2]: {
|
||||
kind: 'duration',
|
||||
mods: { atkPct: num(b2.atk), defPct: num(b2.def), blockCnt: num(b2.block_cnt) },
|
||||
attack: {
|
||||
hitAllBlocked: true,
|
||||
hitsFn: (b, u) => (u.mem.vvanaTwice ? S2_TWICE_HITS : 1),
|
||||
dmgMul: (b, u) => (u.mem.vvanaTwice ? twice : 1),
|
||||
onEachHit({ battle, unit, target, kind }) {
|
||||
if (unit.mem.vvanaTwice && kind === 'main') steal(battle, unit, target, num(b2['attack@steal_atk_speed']), num(b2['attack@steal_atk_speed_max'], Infinity));
|
||||
},
|
||||
},
|
||||
onStart({ battle, unit }) { returnLoot(battle, unit); },
|
||||
onEnd({ battle, unit }) { unit.mem.vvanaTwice = false; returnLoot(battle, unit); },
|
||||
},
|
||||
[S3]: {
|
||||
kind: 'duration',
|
||||
mods: { batPct: batMod(b3.base_attack_time, chess), atkPct: num(b3.atk), defPct: num(b3.def), resFlat: num(b3.magic_resistance) },
|
||||
targeting: { priority: 'elite' },
|
||||
attack: { hitsFn: (b, u) => (u.mem.vvanaS3Later ? S3_LATER_HITS : S3_HITS) },
|
||||
onStart({ battle, unit, skill }) {
|
||||
const later = (unit.mem.vvanaS3Casts ?? 0) >= 1;
|
||||
unit.mem.vvanaS3Casts = (unit.mem.vvanaS3Casts ?? 0) + 1;
|
||||
unit.mem.vvanaS3Later = later;
|
||||
if (!later) return;
|
||||
skill.timeLeft = Math.max(0.01, num(b3.enhance_duration, skill.duration));
|
||||
setGrid(battle, unit, RANGE_3_2);
|
||||
},
|
||||
onEnd({ battle, unit }) {
|
||||
if (unit.mem.vvanaS3Later) setGrid(battle, unit, unit.def?.rangeGrid);
|
||||
unit.mem.vvanaS3Later = false;
|
||||
},
|
||||
},
|
||||
},
|
||||
talents: [
|
||||
{ install(battle, unit) { // 燃烛施明: arts dealt +, phys / arts taken −, ×super_scale with an elite / leader there
|
||||
const dsm = num(t0.damage_scale_m), drp = num(t0.damage_resistance_pm), sup = num(t0.super_scale, 1), ep = num(t0.ep_damage_ratio_m);
|
||||
const factor = () => (enemiesIn(battle, unit, unit.rangeKeys).some(isElite) || unit.blocking.some(isElite) ? sup : 1);
|
||||
const check = () => {
|
||||
if (!up(unit)) return;
|
||||
const f = factor();
|
||||
if (unit.mem.vvanaCandle === f && unit.findBuff(CANDLE_KEY)) return;
|
||||
unit.mem.vvanaCandle = f;
|
||||
battle.addBuff(unit, { key: CANDLE_KEY, mods: { artsDealtMul: 1 + dsm * f, physTakenMul: 1 - drp * f, artsTakenMul: 1 - drp * f }, data: { f }, tags: ['talent'] });
|
||||
};
|
||||
battle.on('tick', check, { owner: unit });
|
||||
battle.on('battleStart', check, { owner: unit });
|
||||
battle.on('deploy', (c) => { if (c.unit === unit) { unit.mem.vvanaCandle = null; check(); } }, { owner: unit });
|
||||
// exact at the damage: re-read before any hit she deals or takes is resolved (the pipeline reads both units'
|
||||
// stats after the `hit` hook)
|
||||
battle.on('hit', (c) => { if (c.source === unit || c.target === unit) check(); }, { owner: unit, priority: CANDLE_PRIORITY });
|
||||
if (!(ep > 0)) return;
|
||||
// AFT-D stage 3: 攻击附带相当于9%伤害的灼燃损伤 (× the same factor) — her arts damage that removed HP
|
||||
battle.on('damaged', (c) => {
|
||||
const d = c.dmg;
|
||||
if (c.source !== unit || c.type !== 'arts' || tagged(d, 'dot') || !(c.amount > 0) || !c.target || c.target.side !== 'enemy') return;
|
||||
elementDmg(battle, unit, c.target, 'burn', c.amount * ep * (unit.mem.vvanaCandle ?? 1), ['talent']);
|
||||
}, { owner: unit });
|
||||
} },
|
||||
{ install(battle, unit) { // 散华: a melee-only 护盾 layer from her damage on elite / leader enemies
|
||||
const p = num(t1.prob), max = Math.max(1, Math.floor(num(t1.max_stack_cnt, 1)));
|
||||
const s3Scale = num(b3.talent_scale, 1);
|
||||
const layers = () => unit.findBuff(SHIELD_KEY)?.data?.n ?? 0;
|
||||
const setLayers = (n) => {
|
||||
if (n > 0) battle.addBuff(unit, { key: SHIELD_KEY, data: { n }, visible: true, tags: ['talent'] });
|
||||
else battle.removeBuff(unit, SHIELD_KEY);
|
||||
};
|
||||
battle.on('hit', (c) => {
|
||||
if (c.source !== unit || !isElite(c.target) || !up(unit)) return;
|
||||
const have = layers();
|
||||
if (have >= max) return;
|
||||
const prob = p * (unit.skill?.active && unit.skill.id === S3 ? s3Scale : 1);
|
||||
if (!(prob > 0) || !battle.rng.chance(prob)) return;
|
||||
setLayers(have + 1);
|
||||
battle.fx('shield', { x: unit.x, y: unit.y, id: unit.id });
|
||||
}, { owner: unit, priority: OUTPUT_PRIORITY });
|
||||
battle.on('hit', (c) => {
|
||||
if (c.target !== unit || c.dmg.cancel) return;
|
||||
const s = c.source;
|
||||
if (!s || s.side !== 'enemy' || c.dmg.isProjectile) return;
|
||||
const have = layers();
|
||||
if (!(have > 0)) return;
|
||||
c.dmg.cancel = true;
|
||||
setLayers(have - 1);
|
||||
battle.fx('shieldBreak', { x: unit.x, y: unit.y, id: unit.id });
|
||||
}, { owner: unit, priority: SHIELD_PRIORITY });
|
||||
} },
|
||||
],
|
||||
install(battle, unit) {
|
||||
const own = unit.def?.rangeGrid;
|
||||
// S1's 蓄力 mode: both charges stored ⇒ her range is 3-2 until the next end of the skill
|
||||
if (unit.skill?.id === S1) {
|
||||
const leave = () => { unit.mem.vvanaCharged = false; setGrid(battle, unit, own); };
|
||||
battle.on('tick', () => {
|
||||
const sk = unit.skill;
|
||||
if (!up(unit) || unit.mem.vvanaCharged || !sk || !(sk.maxCharges > 1) || sk.charges < sk.maxCharges) return;
|
||||
unit.mem.vvanaCharged = true;
|
||||
setGrid(battle, unit, RANGE_3_2);
|
||||
}, { owner: unit });
|
||||
battle.on('skillEnd', (c) => { if (c.unit === unit && c.skill.id === S1 && unit.mem.vvanaCharged) leave(); }, { owner: unit });
|
||||
battle.on('deploy', (c) => { if (c.unit === unit) leave(); }, { owner: unit });
|
||||
}
|
||||
// S2: one Attack_Once / Attack_Twice pick per attack while it runs
|
||||
if (unit.skill?.id === S2) {
|
||||
const prob = num(b2['attack@prob_twice']);
|
||||
battle.on('beforeAttack', (c) => {
|
||||
if (c.attacker !== unit) return;
|
||||
unit.mem.vvanaTwice = !!(unit.skill?.active && unit.skill.id === S2) && prob > 0 && battle.rng.chance(prob);
|
||||
}, { owner: unit });
|
||||
battle.on('death', (c) => { if (c.unit === unit) returnLoot(battle, unit); }, { owner: unit });
|
||||
}
|
||||
// S3: the cast count of a deployment ("每次部署…重新计算"), her own range back
|
||||
if (unit.skill?.id === S3) {
|
||||
battle.on('deploy', (c) => {
|
||||
if (c.unit !== unit) return;
|
||||
unit.mem.vvanaS3Casts = 0;
|
||||
unit.mem.vvanaS3Later = false;
|
||||
setGrid(battle, unit, own);
|
||||
}, { owner: unit });
|
||||
}
|
||||
// AFT-D: 元素伤害 at the output of every damage of hers on an enemy in its 灼燃 爆发冷却 (not on this rider's own)
|
||||
const er = num(tb.ep_damage_ratio);
|
||||
if (er > 0) {
|
||||
battle.on('hit', (c) => {
|
||||
const t = c.target;
|
||||
if (c.source !== unit || !t || t.side !== 'enemy' || tagged(c.dmg, AFTD_TAG) || !hasHp(t) || !t.findBuff('burnBurst')) return;
|
||||
battle.dealDamage(unit, t, { amount: unit.s.atk * er, type: 'elemental', element: 'burn', canDodge: false, tags: [AFTD_TAG, 'dot'] });
|
||||
}, { owner: unit, priority: OUTPUT_PRIORITY });
|
||||
}
|
||||
// AFT-Y: 自身阻挡的敌人受到10%的法术脆弱效果
|
||||
const fragile = num(tb.damage_scale, 1) - 1;
|
||||
if (fragile > 0) {
|
||||
battle.every(FRAGILE_IV, () => {
|
||||
if (!up(unit)) return;
|
||||
for (const e of unit.blocking) if (e.alive) battle.applyStatus(e, 'artsFragile', { duration: FRAGILE_DUR, value: fragile, source: unit });
|
||||
}, { owner: unit });
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -181,6 +181,8 @@ const PRIORITY_FNS = {
|
||||
lowestHpRatio: (e) => e.hpRatio,
|
||||
highestAtk: (e) => -e.s.atk,
|
||||
boss: (e) => (e.isBoss ? 0 : 1),
|
||||
// "优先攻击精英或领袖敌人" (薇薇安娜 S3: kits/ops/op-vvana.js): an ELITE / BOSS rank enemy or a leader first
|
||||
elite: (e) => (e.isBoss || e.def?.rank === 'ELITE' || e.def?.rank === 'BOSS' ? 0 : 1),
|
||||
notBurst: (e) => (e.s.flags.burstLock ? 1 : 0),
|
||||
ground: (e) => (e.isFlying ? 1 : 0),
|
||||
// 攻城手 trait "优先攻击重量最重的敌人" (早露 / 提丰: kits/ops/op-poca.js, op-typhon.js): the highest current 重量等级
|
||||
|
||||
Reference in new issue
Block a user