Core/AI: refactor SpellHit and SpellHitTarget.
Port From (https://github.com/TrinityCore/TrinityCore/commit/3171cd3fa9dbcec43f5d70b74ab2f54a2aa44173)
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user