diff options
| author | ForesterDev <11771800+ForesterDev@users.noreply.github.com> | 2020-06-07 11:22:13 +0300 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-01-06 20:46:25 +0100 |
| commit | 3171cd3fa9dbcec43f5d70b74ab2f54a2aa44173 (patch) | |
| tree | 838c54078c04b1fdae4ec1aac6fdc70ebdae45b2 /src/server/game/Spells/Spell.cpp | |
| parent | f0242d4ec7857a18145dd0a9965fcb8526e981c8 (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
(cherry picked from commit e3b232fe0e5c21a87d3fe71813e9d750259823f1)
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 4690176be01..4975457c2d6 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2695,12 +2695,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); @@ -2744,19 +2739,14 @@ void Spell::GOTargetInfo::DoTargetSpellHit(Spell* spell, SpellEffectInfo const& spell->HandleEffects(nullptr, nullptr, go, spellEffectInfo, 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(); |
