fix(sim): 浊心斯卡蒂 S1 and 坚守 tier 2 no longer bounce redirected damage between each other (the battle froze: every cycle branched per 坚守 member until the hook depth guard); regression test; golden: unchanged

This commit is contained in:
HappyTanuki committed 2026-10-10 11:06:10 +09:00
1 parent 1db8e51023
commit e9a2e27c58
3 files changed
+55 -2

No files matched your search

+3 -1
View File
@@ -542,7 +542,9 @@ export function install(battle) {
if (stead) {
battle.on('hit', (c) => {
const t = c.target, dmg = c.dmg;
if (!t || t.side !== 'ally' || t.kind !== 'op' || !dmg || dmg.cancel || dmg.steadShare || dmg.steadCut || dmg.type === 'element') return;
// redirected damage (浊心斯卡蒂 S1 transfer) is not cut and re-shared again (see chess_char_6_04-skadi2.js)
// [ASSUMED: the official game does not chain the two transfers either]
if (!t || t.side !== 'ally' || t.kind !== 'op' || !dmg || dmg.cancel || dmg.steadShare || dmg.steadCut || dmg.type === 'element' || dmg.tags?.includes('transfer')) return;
const st = byPid[t.ownerId];
if (!st || (st.tiers[ID.stead] ?? 0) < 2 || st.members[ID.stead].has(t)) return;
let any = false;
@@ -121,7 +121,10 @@ function skadi2(bb, chess, def) {
battle.on('hit', (ctx) => {
const t = ctx.target, d = ctx.dmg;
if (!(share > 0) || !t || t === unit || t.side !== 'ally' || t.kind === 'device' || !live(unit) || !unit.skill?.active) return;
if (d.type === 'element' || d.type === 'elemental' || d.skadiShare || d.tags?.includes('transfer') || !inCover(battle, unit, t)) return;
// damage another sharing effect already redirected (坚守 bond:stead:share) is not redirected again: the two
// would bounce it between Skadi and the 坚守 members until the hook depth guard (docs/SIM.md §5 re-entrancy
// rule) [ASSUMED: the official game does not chain the two transfers either]
if (d.type === 'element' || d.type === 'elemental' || d.skadiShare || d.steadShare || d.tags?.includes('transfer') || d.tags?.includes('bond:stead:share') || !inCover(battle, unit, t)) return;
d.skadiShare = { share, tag: TAG }; // 同类效果取最高: one transfer per damage instance
d.mul *= 1 - share;
}, { owner: unit, priority: -20 });