Core/AI: refactor SpellHit and SpellHitTarget.

Port From (https://github.com/TrinityCore/TrinityCore/commit/3171cd3fa9dbcec43f5d70b74ab2f54a2aa44173)
This commit is contained in:
hondacrx
2022-02-23 16:02:13 -05:00
parent 19abbbf0b5
commit c41acd0bc8
7 changed files with 28 additions and 206 deletions
+4 -14
View File
@@ -8226,12 +8226,7 @@ namespace Game.Spells
{
CreatureAI hitTargetAI = cHitTarget.GetAI();
if (hitTargetAI != null)
{
if (spell.GetCaster().IsGameObject())
hitTargetAI.SpellHitByGameObject(spell.GetCaster().ToGameObject(), spell.m_spellInfo);
else
hitTargetAI.SpellHit(spell.GetCaster().ToUnit(), spell.m_spellInfo);
}
hitTargetAI.SpellHit(spell.GetCaster(), spell.m_spellInfo);
}
if (spell.GetCaster().IsCreature() && spell.GetCaster().ToCreature().IsAIEnabled())
@@ -8285,17 +8280,12 @@ namespace Game.Spells
//AI functions
if (go.GetAI() != null)
{
if (spell.GetCaster().IsGameObject())
go.GetAI().SpellHitByGameObject(spell.GetCaster().ToGameObject(), spell.m_spellInfo);
else
go.GetAI().SpellHit(spell.GetCaster().ToUnit(), spell.m_spellInfo);
}
go.GetAI().SpellHit(spell.GetCaster(), spell.m_spellInfo);
if (spell.GetCaster().IsCreature() && spell.GetCaster().ToCreature().IsAIEnabled())
spell.GetCaster().ToCreature().GetAI().SpellHitTargetGameObject(go, spell.m_spellInfo);
spell.GetCaster().ToCreature().GetAI().SpellHitTarget(go, spell.m_spellInfo);
else if (spell.GetCaster().IsGameObject() && spell.GetCaster().ToGameObject().GetAI() != null)
spell.GetCaster().ToGameObject().GetAI().SpellHitTargetGameObject(go, spell.m_spellInfo);
spell.GetCaster().ToGameObject().GetAI().SpellHitTarget(go, spell.m_spellInfo);
spell.CallScriptOnHitHandlers();
spell.CallScriptAfterHitHandlers();