feedback5 O5: damage.js gets the hpDamage hook — what passed the shields of a damage instance, before the HP loss; a handler may only lower it (a raise is ignored), a 流失 and a hit the shields absorb whole never reach it
The 伤判效果 that act after a barrier need it: 煌's 紧急除颤 lock (buff template huang_t_1[lock], an ON_TAKE_DAMAGE HpNoLessThanCertainPercentModifier; PRTS 备注 "该伤害减少(伤害值-煌当前生命值+煌最大生命值×50%)点") and 左乐's SBL-X 庇护 re-applied behind his 行险 barrier (PRTS S2 备注). Additive: without a handler the pipeline is unchanged, so golden is unchanged (every family matches). docs/SIM.md §4 / §5 name the hook; test/sim/feedback5-hpdamage-hook.test.js (2).
This commit is contained in:
1 parent
742f478526
commit
89d17d8e08
3 files changed
+68
-3
No files matched your search
@@ -5,8 +5,9 @@
|
||||
// → dodge (phys/arts, canDodge) → mitigation (phys: DEF, arts: RES, true: none)
|
||||
// → × source dmgDealtMul (× phys/artsDealtMul) × target dmgTakenMul (not for 元素伤害) × type-taken mul × dmg.mul
|
||||
// → 限伤 (leaders in boss / hidden battles: a hit of ceil(final) ≥ BOSS_HIT_LIMIT is cancelled, see leaderHitCancelled)
|
||||
// → shields (hit-negating barriers first, then HP shields) → HP loss (boss pool routing) → 'damaged' hook
|
||||
// → SP-on-hurt / TAKE_DAMAGE trigger → fatal/kill.
|
||||
// → shields (hit-negating barriers first, then HP shields) → 'hpDamage' hook (what passed the shields; handlers may
|
||||
// only lower `amount`: the 伤判效果 that act after a barrier — 煌's 紧急除颤 HP floor, 左乐's 庇护 re-applied after his
|
||||
// 行险 barrier) → HP loss (boss pool routing) → 'damaged' hook → SP-on-hurt / TAKE_DAMAGE trigger → fatal/kill.
|
||||
// Damage-dealt stats (the source's `stats.dmg`, the player's `damageDealt`) count only HP removed from the other side:
|
||||
// self and friendly damage (a 源石溶剂 drain, an operator's own 流失) is the target's `taken` and keeps the kill credit.
|
||||
// Phys: max(A − max(0, D×(1−defIgnorePct) − defIgnoreFlat), 5 %·A); Arts: max(A×(1 − R′/100), 5 %·A) with
|
||||
@@ -268,6 +269,12 @@ export function dealDamage(battle, source, target, dmgIn) {
|
||||
// ran before it (the attack, its SP, `hit` hook effects, separate element 损伤) stays; nothing after it happens
|
||||
if (final > 0 && leaderHitCancelled(battle, target, final)) return 0;
|
||||
final = absorbShields(battle, target, final);
|
||||
// 伤判效果 after the barriers (header): a handler may lower what reaches the HP — never raise it (a 流失 skips this)
|
||||
if (final > 0 && battle._hooks.hpDamage) {
|
||||
const hctx = { source: hs, target, amount: final, dmg, credit: source };
|
||||
battle.emit('hpDamage', hctx);
|
||||
if (Number.isFinite(hctx.amount)) final = Math.max(0, Math.min(final, hctx.amount));
|
||||
}
|
||||
return applyHpLoss(battle, source, target, final, dmg);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user