From 70fb5c6fd8c79a1d6cdb5f6be03156cd445539ba Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 12 Apr 2018 18:14:14 -0400 Subject: [PATCH] Core/AI: Added CreatureAI hook that is getting triggered when a spell cast has been successfully finished. --- Source/Game/AI/CoreAI/CreatureAI.cs | 3 +++ Source/Game/Spells/Spell.cs | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/Source/Game/AI/CoreAI/CreatureAI.cs b/Source/Game/AI/CoreAI/CreatureAI.cs index fb9d7ca69..d6c036182 100644 --- a/Source/Game/AI/CoreAI/CreatureAI.cs +++ b/Source/Game/AI/CoreAI/CreatureAI.cs @@ -435,6 +435,9 @@ namespace Game.AI // Called when a spell cast gets interrupted public virtual void OnSpellCastInterrupt(SpellInfo spell) { } + // Called when a spell cast has been successfully finished + public virtual void OnSuccessfulSpellCast(SpellInfo spell) { } + // Called at reaching home after evade public virtual void JustReachedHome() { } diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index dbdca373d..aac3d3583 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -2954,6 +2954,12 @@ namespace Game.Spells hitMask |= ProcFlagsHit.Normal; m_originalCaster.ProcSkillsAndAuras(null, procAttacker, ProcFlags.None, ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.Cast, hitMask, this, null, null); + + // Call CreatureAI hook OnSuccessfulSpellCast + Creature caster = m_originalCaster.ToCreature(); + if (caster) + if (caster.IsAIEnabled) + caster.GetAI().OnSuccessfulSpellCast(GetSpellInfo()); } void handle_immediate()