aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
authorForesterDev <11771800+ForesterDev@users.noreply.github.com>2020-06-07 11:22:13 +0300
committerGitHub <noreply@github.com>2020-06-07 10:22:13 +0200
commite3b232fe0e5c21a87d3fe71813e9d750259823f1 (patch)
tree58f7306a85e196080ec33a9aa97ba755af955618 /src/server/game/Spells/Spell.cpp
parent1181b636c0cec174367906808c999641ca7897fc (diff)
Core/AI: refactor SpellHit and SpellHitTarget. (#24691)
* Core/AI: refactor SpellHit and SpellHitTarget. - now caster/target is WorldObject instead of Unit - remove SpellHitByGameObject / SpellHitTargetGameObject (handled by SpellHit / SpellHitTarget) - rename parameters in scripts according parent methods * Restore logic in Algalon script * Changed check for REMORSELESS_WINTER hit to avoid dublicate call, because it has TARGET_UNIT_CASTER for effects 0/1 and TARGET_GAMEOBJECT_SRC_AREA for effect 2 * Fix build after merge
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index c75e60f6bd3..b6c7a94aa68 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -2534,12 +2534,7 @@ void Spell::TargetInfo::DoDamageAndTriggers(Spell* spell)
//AI functions
if (Creature* cHitTarget = _spellHitTarget->ToCreature())
if (CreatureAI* hitTargetAI = cHitTarget->AI())
- {
- if (spell->m_caster->GetTypeId() == TYPEID_GAMEOBJECT)
- hitTargetAI->SpellHitByGameObject(spell->m_caster->ToGameObject(), spell->m_spellInfo);
- else
- hitTargetAI->SpellHit(spell->m_caster->ToUnit(), spell->m_spellInfo);
- }
+ hitTargetAI->SpellHit(spell->m_caster, spell->m_spellInfo);
if (spell->m_caster->GetTypeId() == TYPEID_UNIT && spell->m_caster->ToCreature()->IsAIEnabled())
spell->m_caster->ToCreature()->AI()->SpellHitTarget(_spellHitTarget, spell->m_spellInfo);
@@ -2583,19 +2578,14 @@ void Spell::GOTargetInfo::DoTargetSpellHit(Spell* spell, uint8 effIndex)
spell->HandleEffects(nullptr, nullptr, go, effIndex, SPELL_EFFECT_HANDLE_HIT_TARGET);
- //AI functions
+ // AI functions
if (go->AI())
- {
- if (spell->m_caster->GetTypeId() == TYPEID_GAMEOBJECT)
- go->AI()->SpellHitByGameObject(spell->m_caster->ToGameObject(), spell->m_spellInfo);
- else
- go->AI()->SpellHit(spell->m_caster->ToUnit(), spell->m_spellInfo);
- }
+ go->AI()->SpellHit(spell->m_caster, spell->m_spellInfo);
if (spell->m_caster->GetTypeId() == TYPEID_UNIT && spell->m_caster->ToCreature()->IsAIEnabled())
- spell->m_caster->ToCreature()->AI()->SpellHitTargetGameObject(go, spell->m_spellInfo);
+ spell->m_caster->ToCreature()->AI()->SpellHitTarget(go, spell->m_spellInfo);
else if (spell->m_caster->GetTypeId() == TYPEID_GAMEOBJECT && spell->m_caster->ToGameObject()->AI())
- spell->m_caster->ToGameObject()->AI()->SpellHitTargetGameObject(go, spell->m_spellInfo);
+ spell->m_caster->ToGameObject()->AI()->SpellHitTarget(go, spell->m_spellInfo);
spell->CallScriptOnHitHandlers();
spell->CallScriptAfterHitHandlers();