fix(Core/AI): fix OnSpellFailed crash on TempSummon despawn (#25036)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4209,6 +4209,8 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi
|
|||||||
spell->SetReferencedFromCurrent(false);
|
spell->SetReferencedFromCurrent(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsCreature() && IsAIEnabled)
|
||||||
|
ToCreature()->AI()->OnSpellFailed(spell->GetSpellInfo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3733,11 +3733,6 @@ void Spell::cancel(bool bySelf)
|
|||||||
|
|
||||||
sScriptMgr->OnSpellCastCancel(this, m_caster, m_spellInfo, bySelf);
|
sScriptMgr->OnSpellCastCancel(this, m_caster, m_spellInfo, bySelf);
|
||||||
|
|
||||||
// Call CreatureAI hook OnSpellFailed only for true interrupts/cancels, not prepare-time failures
|
|
||||||
if (Creature* creatureCaster = m_caster->ToCreature())
|
|
||||||
if (creatureCaster->IsAIEnabled)
|
|
||||||
creatureCaster->AI()->OnSpellFailed(m_spellInfo);
|
|
||||||
|
|
||||||
finish(false);
|
finish(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user