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:
Andrew
2026-03-08 07:12:50 -03:00
committed by GitHub
parent f9e1a22710
commit fbbf960229
2 changed files with 2 additions and 5 deletions

View File

@@ -4209,6 +4209,8 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi
spell->SetReferencedFromCurrent(false);
}
if (IsCreature() && IsAIEnabled)
ToCreature()->AI()->OnSpellFailed(spell->GetSpellInfo());
}
}

View File

@@ -3733,11 +3733,6 @@ void Spell::cancel(bool 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);
}