diff options
author | joschiwald <joschiwald.trinity@gmail.com> | 2016-04-23 16:13:12 +0200 |
---|---|---|
committer | joschiwald <joschiwald.trinity@gmail.com> | 2016-04-23 16:55:15 +0200 |
commit | 3b9c78a176e74654dd55b70187c00fa8b9855227 (patch) | |
tree | cae0a59f765fb66a2fa4067308dbe5b8dab46dff /src | |
parent | b4778cefceddb683a5ce4fccbdcd4a1c472f8714 (diff) |
Core/SpellScripts: allow to modify target destination of all target type
(cherry picked from commit 25da16ba44db9014d879f00a987d76c349469d22)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index ce9fb930834..983ce5eb96c 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -987,14 +987,22 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa { CallScriptObjectTargetSelectHandlers(target, effIndex, targetType); if (target) - m_targets.SetDst(*target); + { + SpellDestination dest(*target); + CallScriptDestinationTargetSelectHandlers(dest, effIndex, targetType); + m_targets.SetDst(dest); + } } else TC_LOG_DEBUG("spells", "SPELL: cannot find channel spell destination for spell ID %u, effect %u", m_spellInfo->Id, effIndex); break; case TARGET_DEST_CHANNEL_CASTER: - m_targets.SetDst(*channeledSpell->GetCaster()); + { + SpellDestination dest(*channeledSpell->GetCaster()); + CallScriptDestinationTargetSelectHandlers(dest, effIndex, targetType); + m_targets.SetDst(dest); break; + } default: ASSERT(false && "Spell::SelectImplicitChannelTargets: received not implemented target type"); break; @@ -1054,7 +1062,11 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar if (m_spellInfo->RequiresSpellFocus) { if (focusObject) - m_targets.SetDst(*focusObject); + { + SpellDestination dest(*focusObject); + CallScriptDestinationTargetSelectHandlers(dest, effIndex, targetType); + m_targets.SetDst(dest); + } return; } break; @@ -1080,7 +1092,6 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar switch (targetType.GetObjectType()) { case TARGET_OBJECT_TYPE_UNIT: - { if (Unit* unit = target->ToUnit()) AddUnitTarget(unit, effMask, true, false); else @@ -1089,7 +1100,6 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar return; } break; - } case TARGET_OBJECT_TYPE_GOBJ: if (GameObject* gobjTarget = target->ToGameObject()) AddGOTarget(gobjTarget, effMask); @@ -1100,8 +1110,12 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar } break; case TARGET_OBJECT_TYPE_DEST: - m_targets.SetDst(*target); + { + SpellDestination dest(*target); + CallScriptDestinationTargetSelectHandlers(dest, effIndex, targetType); + m_targets.SetDst(dest); break; + } default: ASSERT(false && "Spell::SelectImplicitNearbyTargets: received not implemented target object type"); break; |