feedback5 WE1: 秘术师 stores its energy at the attack check, not one interval later (GitHub #181)

PRTS 分支特性信息 秘术师: "能量储存与攻击占用相同的攻击间隔:在进行攻击判定时…若无有效目标且能量储存数未满,则改为储存一份
攻击能量(属于攻击行为);仅没有有效目标,且能量储存数已满的情况下才进入待机状态", "攻击被打断且弹道未能成功生成的情况下,储存的
能量不会被消耗"; PRTS 异常效果 缴械 "秘术师储存能量同样无法进行".

- ai.js updateAlly: a ready unit (able to act, not disarmed) whose attack check finds no valid target — no target, or
  its profile's canAttack false (a 秘术师 kit's target rule: 深靛's bound enemies, 维伊's marked ones) — calls the
  profile's storeEnergy; a stored energy restarts the attack interval, a full store idles with the attack ready. A
  DEFAULT cast at the check that leaves no target stores in the same check.
- professions.js mystic: storeEnergy (up to bb times), releaseEnergy (performAttack, after beforeAttack: a cancelled
  shot keeps them) and hitsFn(b, u, info) — the energies leave with the attack and land with its main hit; the old
  separate store timer (it started only once the attack was ready and never restarted the interval) is gone.
  [ASSUMED] a redeployment holds no energy.
- 维伊 / 黑键 kits: their own tick stores become the kit's storeEnergy on the shared check; 深靛 / 维伊 no longer write
  hadTarget themselves.

Golden: roster-003, roster-021, roster-022, bond-preciShip-high (深靛 stores at her check); matches solo-FUNNY-1,
solo-NORMAL-2, solo-HARD-2, solo-ABYSS-1, solo-ABYSS-2, coop2-NORMAL-3, coop2-HARD-4, coop4-FUNNY-6, coop4-ABYSS-7,
coop2-NORMAL-8-serverrun, solo-HARD-9-boosted, coop2-ABYSS-10-boosted, coop2-NORMAL-14-standins (each fields 深靛);
diy-032 (维伊) and diy-114 (黑键): the first store after a redeployment comes at the next tick's attack check instead of
the end of the redeploy tick (with the old tick store added back as a fallback the diy family matches the old digests).
fields, standins unchanged.

Tests: test/sim/feedback5-mystic-store.test.js (new, 4); op_veen, op_ebnhlz, kits_t1t2, kits_alt_t1 pass unchanged.
Docs: SIM.md §Professions (mystic row, profile hooks).
This commit is contained in:
sganggs committed 2026-10-06 14:53:56 +08:00
1 parent a009d77d71
commit 8f62f3e360
11 files changed
+354 -214

No files matched your search

+17 -5
View File
@@ -79,20 +79,30 @@ export function updateAlly(b, u, dt) {
if (prof.noAttackUnlessSkill && !(sk && sk.active)) return;
if (u.s.flags.disarm) return;
if (u.atkCd > 0) return;
if (prof.canAttack && !prof.canAttack(b, u)) return;
// (a 秘术师's `canAttack` is its own target rule: false = no valid target — 深靛's bound enemies, 维伊's marked ones)
if (prof.canAttack && !prof.canAttack(b, u)) { if (prof.storeEnergy) { u.trait.hadTarget = false; storeEnergy(b, u, prof); } return; }
let targets = acquireTargets(b, u, prof);
if (!targets.length) { u.trait.hadTarget = false; return; }
if (!targets.length) { u.trait.hadTarget = false; storeEnergy(b, u, prof); return; }
u.trait.hadTarget = true;
if (sk && sk.onAboutToAttack()) {
prof = effectiveProfile(u);
if (prof.noAttack || !u.alive) return;
targets = acquireTargets(b, u, prof);
if (!targets.length) return;
if (!targets.length) { storeEnergy(b, u, prof); return; } // the cast left none (a range change): still this check
}
performAttack(b, u, prof, targets);
u.atkCd = Math.max(u.atkCd, u.s.interval);
}
/**
* The attack check of a ready unit found no valid target: a 秘术师 profile stores one energy instead (`storeEnergy`,
* professions.js installMystic — PRTS 分支特性信息 秘术师 "若无有效目标且能量储存数未满,则改为储存一份攻击能量(属于攻击
* 行为)": the attack interval starts again); with a full store it idles, ready to attack.
*/
function storeEnergy(b, u, prof) {
if (prof.storeEnergy && prof.storeEnergy(b, u)) u.atkCd = Math.max(u.atkCd, u.s.interval);
}
/** Release blocked enemies beyond the current block capacity (latest blocked first). */
export function enforceBlockCapacity(b, u) {
const cap = u.alive && u.deployed ? u.s.blockCnt : 0;
@@ -174,11 +184,13 @@ export function performAttack(b, u, prof, targets, opts = null) {
}
const ranged = !prof._fortressMelee && prof.attack === 'ranged' && prof.projectile && prof.projectile !== 'none' && prof.projectile !== 'beam';
const vis = prof._fortressMelee ? 'none' : (prof.projectile || 'none');
// 秘术师: the stored energies leave with this attack, at its main target (professions.js installMystic)
const energy = !isHeal && prof.releaseEnergy ? prof.releaseEnergy(b, u) : 0;
for (let i = 0; i < targets.length; i++) {
const t = targets[i];
b._ev(['atk', u.id, t.id, vis]);
if (isHeal) { doHeal(b, u, prof, t); continue; }
const info = { isSkill, index: i, attackId };
const info = { isSkill, index: i, attackId, energy: i === 0 ? energy : 0 };
const foe = t.side === 'enemy' || b.isAllyTarget(t);
if (ranged && foe && prof.projectile === 'boomerang') {
throwBoomerang(b, u, prof, t, info);
@@ -260,7 +272,7 @@ export function resolveHit(b, u, prof, target, info, x, y) {
if (target && target.alive) {
let mulT = skillMul;
if (prof.dmgMul) { const m = typeof prof.dmgMul === 'function' ? prof.dmgMul(b, u, target) : prof.dmgMul; if (Number.isFinite(m)) mulT *= m; }
const hits = prof.hitsFn ? prof.hitsFn(b, u) : Math.max(1, prof.hits || 1);
const hits = prof.hitsFn ? prof.hitsFn(b, u, info) : Math.max(1, prof.hits || 1);
let dealtMain = 0;
for (let h = 0; h < hits && target.alive; h++) {
dealtMain += b.dealDamage(u, target, { amount: atk * scale * mulT, type: baseType, isAttack: true, isSkill: info.isSkill, tags: prof.tags || [], attackId });
@@ -11,7 +11,8 @@ export default {
// 柔光缚目: attacks bind the target `duration` s with `prob`; bound enemies are never chosen as targets.
// Alternate S1 灯塔守卫者: for `duration` s the skill range (4-1), attack interval ×(1 + base_attack_time) (PRTS:
// "大幅度缩短(-80%)" ⇒ ×0.2 — a flat −0.8 s on 3 s would be less than S2's "略微缩短 ×0.7"), every attack hits for
// attack@atk_scale × ATK arts. Elite module MSC-X (store 4) is the mystic profile of the module trait (TUNE.mystic).
// attack@atk_scale × ATK arts. Elite module MSC-X (store 4) is the mystic profile of the module trait (TUNE.mystic);
// the store itself is the shared 秘术师 profile (professions.js installMystic: at the attack check, PRTS 分支特性信息).
chess_char_1_17_a: (bb, chess, def) => {
const t = talentBb(chess, 0);
const dScale = num(bb['indigo_s_2[damage].atk_scale']);
@@ -28,12 +29,11 @@ export default {
},
},
trait: {
// with only bound enemies in range (or blocked by her — always her targets, Battle.blockedTargets) she holds her
// fire (the mystic trait stores the energy meanwhile)
// with only bound enemies in range (or blocked by her — always her targets, Battle.blockedTargets) she has no valid
// target: she holds her fire and the mystic trait stores an energy at the attack check (professions.js
// installMystic; a bind on her only target included)
canAttack(battle, u) {
const ok = battle.enemiesInKeys(u.rangeKeys, u, u.profile).some((e) => !bound(e)) || battle.blockedTargets(u, u.profile).some((e) => !bound(e));
if (!ok) u.trait.hadTarget = false;
return ok;
return battle.enemiesInKeys(u.rangeKeys, u, u.profile).some((e) => !bound(e)) || battle.blockedTargets(u, u.profile).some((e) => !bound(e));
},
afterHit(battle, u, target) {
if (!target || !target.alive || target.side !== 'enemy') return;
+14 -17
View File
@@ -12,8 +12,8 @@
// - Trait (秘术师) "攻击造成法术伤害,在找不到攻击目标时可以将攻击能量储存起来之后一齐发射(最多3个)" (bb times; MSC-X 4):
// ranged arts bolts, hits air units (分支特性信息 "可对空"), blocks 1, ground enemies target him. The store (分支特性信息:
// "能量储存与攻击占用相同的攻击间隔:…若无有效目标且能量储存数未满,则改为储存一份攻击能量(属于攻击行为)"): when his attack is
// ready and he has no valid target he stores one energy and his attack interval starts again — this kit's own store,
// as 维伊's (op-veen.js; the engine's mystic profile stores one interval after the attack is ready). His next attack
// ready and he has no valid target he stores one energy and his attack interval starts again — the shared 秘术师
// profile (professions.js installMystic) with this kit's `storeEnergy` (his elite energy, S3), as 维伊's. His next attack
// releases them at its target ("一齐发射"), each hitting for ATK × the attack's scale × the energy scale (talent 1) as
// an arts 普通伤害 attack hit ("由储存能量形成的弹道造成攻击力100%的法术普通伤害"); they land with the main bolt (one
// volley to one target [ASSUMED], as 维伊's), the later ones only on a target still alive. [ASSUMED] a redeployment holds
@@ -60,9 +60,8 @@
// only elite ones, and at its end at most times_2 stay elite, the rest normal (up to times). "可主动关闭" is a manual
// operation (no automatic stop).
import { num, talentBb, moduleBb, traitBb, skillRec, batMod, up, toggleBuff } from '../shared/tier1.js';
import { num, talentBb, moduleBb, traitBb, skillRec, batMod, toggleBuff } from '../shared/tier1.js';
import { canTargetEnemy, sortEnemyTargets } from '../../../targeting.js';
import { acquireTargets, effectiveProfile } from '../../../ai.js';
import { hasHp } from '../../../damage.js';
import { COLS } from '../../../constants.js';
@@ -204,21 +203,19 @@ export default {
trait: {
hitsFn: () => 1, // the engine's main hit only: the stored energies are this kit's (land)
onEachHit(battle, unit, victim, hc) { if (hc.kind === 'main' && victim && victim.side === 'enemy') land(battle, unit, victim, hc); },
// the store (the shared profile calls it at his attack check with no valid target — professions.js installMystic:
// an attack action, the interval restarts): the trait's energies first, then the elite one; during S3 elite ones
// only (false = a full store: he idles)
storeEnergy(battle, unit) {
const v = stateOf(unit);
if (skillOn(unit, S3)) { if (v.n + v.e >= N + E) return false; v.e++; }
else if (v.n < N) v.n++;
else if (v.e < E) v.e++;
else return false;
return true;
},
install(battle, unit) {
battle.on('deploy', (ctx) => { if (ctx.unit === unit && !ctx.move) unit.trait.ebn = null; }, { owner: unit });
// the store: his attack ready and no valid target ⇒ one energy, an attack action (the interval restarts); the
// attack loop ran first this tick (a valid target was attacked instead)
battle.on('tick', () => {
if (!up(unit) || !unit.canAct || unit.s.flags.disarm || unit.atkCd > 0) return;
const prof = effectiveProfile(unit);
if (prof.noAttack || acquireTargets(battle, unit, prof).length) return;
const v = stateOf(unit);
if (skillOn(unit, S3)) { if (v.n + v.e >= N + E) return; v.e++; }
else if (v.n < N) v.n++;
else if (v.e < E) v.e++;
else return;
unit.atkCd = unit.s.interval;
}, { owner: unit });
battle.on('death', (ctx) => { if (ctx.unit && ctx.unit.side === 'enemy') stateOf(unit).q.delete(ctx.unit.id); }, { owner: unit });
},
},
+14 -18
View File
@@ -9,9 +9,9 @@
// - Trait (秘术师) "攻击造成法术伤害,在找不到攻击目标时可以将攻击能量储存起来之后一齐发射" (ranged arts, hits air units,
// targetable by ground enemies). PRTS 分支特性信息 秘术师: "能量储存与攻击占用相同的攻击间隔:在进行攻击判定时,若范围内存在
// 有效目标,则进行普通攻击;若无有效目标且能量储存数未满,则改为储存一份攻击能量(属于攻击行为)" — when her attack is ready
// and she has no valid target she stores one energy and her attack interval starts again (this kit replaces the
// engine's mystic profile, which stores one interval after the attack is ready); the energies fly with her next attack,
// at its target ("由储存能量形成的弹道造成攻击力100%的法术普通伤害").
// and she has no valid target she stores one energy and her attack interval starts again (the shared 秘术师 profile,
// professions.js installMystic, with this kit's `storeEnergy`); the energies fly with her next attack, at its target
// ("由储存能量形成的弹道造成攻击力100%的法术普通伤害").
// T1 “在挥刀之前” "特性储存的能量达到3个时,合成为1个转置能量(至多储存等同于9倍的能量)" (trait bb merge_cnt 3, times 9):
// 3 stored make 1 转置能量, at most times / merge_cnt of those, then no more storing (备注 "转置能量数量达到上限时,停止储存
// 攻击能量"); a 转置能量 hits for merge_cnt × ATK (备注 "攻击力300%的法术普通伤害"). Every shot uses the ATK it left with
@@ -39,7 +39,7 @@
// preferring an enemy not hit yet by it, else another one, else the same (text "优先不同目标" [ASSUMED order]), each
// attack@bounce_atk_scale × the cached ATK arts. The skill ends when the bullets run out.
import { num, talentBb, moduleBb, traitBb, skillRec, batMod, up, toggleBuff } from '../shared/tier1.js';
import { num, talentBb, moduleBb, traitBb, skillRec, batMod, toggleBuff } from '../shared/tier1.js';
import { canTargetEnemy, sortEnemyTargets } from '../../../targeting.js';
const S1 = 'skchr_veen_1';
@@ -146,23 +146,19 @@ export default {
trait: {
hitsFn: () => 0, // the volley's hits are the kit's (land)
onEachHit(battle, unit, victim, hc) { if (hc.kind === 'main' && victim && victim.side === 'enemy') land(battle, unit, victim, hc.attackId, !!hc.isSkill); },
// only enemies under her 战争技艺 in range: she holds her fire (and stores energy)
canAttack(battle, u) {
const ok = validTargets(battle, u, u.profile).length > 0;
if (!ok) u.trait.hadTarget = false;
return ok;
// only enemies under her 战争技艺 in range: no valid target — she holds her fire (and stores energy)
canAttack(battle, u) { return validTargets(battle, u, u.profile).length > 0; },
// the mystic store (the shared profile calls it at her attack check with no valid target — professions.js
// installMystic: an attack action, the interval restarts): one energy, 3 merge into a 转置能量; none once the
// 转置能量 are at their cap (a full store: she idles)
storeEnergy(battle, unit) {
const v = stateOf(unit);
if (v.t >= tMax) return false;
if (++v.s >= merge) { v.s -= merge; v.t++; }
return true;
},
install(battle, unit) {
battle.on('deploy', (ctx) => { if (ctx.unit === unit) unit.trait.veen = null; }, { owner: unit });
// the mystic store: her attack ready and no valid target ⇒ one energy, an attack action (the interval restarts);
// 3 merge into a 转置能量 (the attack loop ran first this tick: a valid target was attacked instead)
battle.on('tick', () => {
const v = stateOf(unit);
if (!up(unit) || !unit.canAct || unit.s.flags.disarm || unit.atkCd > 0 || v.t >= tMax) return;
if (validTargets(battle, unit, unit.profile).length) return;
if (++v.s >= merge) { v.s -= merge; v.t++; }
unit.atkCd = unit.s.interval;
}, { owner: unit });
battle.on('death', (ctx) => { if (ctx.unit && ctx.unit.side === 'enemy') stateOf(unit).q.delete(ctx.unit.id); }, { owner: unit });
},
},
+27 -10
View File
@@ -24,7 +24,10 @@
// skipEnemy(enemy) → bool (an enemy the unit never selects — targeting.js canTargetEnemy; 嵯峨 "不攻击重伤单位")
// healThrough(healer, ally) → bool (a healer that selects and heals that ally through its 禁疗 — Battle
// injuredAlliesInKeys, damage.js heal; 凯尔希 on her Mon3tr)
// hitsFn(battle, unit) → n install(battle, unit) — per-unit hooks, called once at setup
// hitsFn(battle, unit, info) → n (info: the hit's { isSkill, index, attackId, energy })
// install(battle, unit) — per-unit hooks, called once at setup
// storeEnergy(battle, unit) → bool / releaseEnergy(battle, unit) → n (秘术师: the attack check found no valid target ⇒
// store one energy, false when full; the energies leaving with an attack — installMystic)
// dollNoAttack bool (傀儡师: its <替身> makes no normal attack and casts no skill — 归溟幽灵鲨, kit trait)
// tb — the unit's trait blackboard (data `trait.bb`), used for tunables (module upgrades included on elites)
// Behaviour per subprofession is documented in docs/SIM.md §Professions. Front / side tests use the unit's direction
@@ -362,16 +365,23 @@ const installFunnel = (battle, unit) => {
unit.trait.funnelScale = unit.profile.funnel?.init ?? 0.2;
};
/**
* 秘术师 (mystic) trait "攻击造成法术伤害,在找不到攻击目标时可以将攻击能量储存起来之后一齐发射(最多3个)" (bb times; 深靛's
* MSC-X 4) with the branch rules of PRTS 分支特性信息 秘术师: "能量储存与攻击占用相同的攻击间隔:在进行攻击判定时,若范围内存在
* 有效目标,则进行普通攻击;若无有效目标且能量储存数未满,则改为储存一份攻击能量(属于攻击行为);仅没有有效目标,且能量储存数已满的
* 情况下才进入待机状态". The attack loop (ai.js updateAlly) calls the profile's `storeEnergy` at its attack check — the attack
* ready, the unit able to act and not disarmed (PRTS 异常效果 缴械 "秘术师储存能量同样无法进行") — when it finds no valid target
* (no target, or the profile's `canAttack` false: a 秘术师 kit's own target rule — 深靛 never picks a bound enemy, so a bind
* on her only target is no valid target); a stored energy restarts the attack interval, a full store idles (the next
* valid target is attacked at once). The energies leave with the next attack that happens (`releaseEnergy`, called by
* performAttack after `beforeAttack`: "攻击被打断且弹道未能成功生成的情况下,储存的能量不会被消耗") with its main target and land
* with its main hit, one damage instance each (`hitsFn`; "由储存能量形成的弹道造成攻击力100%的法术普通伤害" — each as the
* main hit). [ASSUMED] a redeployment holds no energy (a free move — 乌尔比安 S3 — keeps them). Kits with their own store
* (维伊's 转置能量, 黑键's elite energies) replace `storeEnergy` and release theirs from an `attack` hook.
*/
const installMystic = (battle, unit) => {
unit.trait.stored = 0;
const max = unit.profile.storeMax ?? 3;
battle.on('tick', () => {
if (!unit.canAct) return;
if (unit.atkCd <= 0 && !unit.trait.hadTarget && unit.trait.stored < max) {
unit.trait.storeAcc = (unit.trait.storeAcc ?? 0) + battle.dt;
if (unit.trait.storeAcc >= unit.s.interval) { unit.trait.storeAcc = 0; unit.trait.stored++; }
}
}, { owner: unit });
battle.on('deploy', (ctx) => { if (ctx.unit === unit && !ctx.move) unit.trait.stored = 0; }, { owner: unit });
};
/** Refresh period / lifetime (s) of a bard trait's 生命回复速度 buff: it lapses within BARD_REGEN_DUR once the bard stops. */
@@ -480,7 +490,14 @@ export const SUB = Object.freeze({
return unit.trait.funnelScale;
} }),
mystic: P({ install: installMystic,
hitsFn: (battle, unit) => { const n = 1 + (unit.trait.stored ?? 0); unit.trait.stored = 0; return n; } }),
storeEnergy: (battle, unit) => {
const n = unit.trait.stored ?? 0;
if (n >= (unit.profile.storeMax ?? 3)) return false;
unit.trait.stored = n + 1;
return true;
},
releaseEnergy: (battle, unit) => { const n = unit.trait.stored ?? 0; unit.trait.stored = 0; return n; },
hitsFn: (battle, unit, info) => 1 + (info?.energy ?? 0) }),
phalanx: P({ noAttackUnlessSkill: true, rangeAoe: true, install: installPhalanx }),
primcaster: P({}),
corecaster: P({}),