aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
authortrickerer <onlysuffering@gmail.com>2014-10-18 20:51:00 +0100
committerDDuarte <dnpd.dd@gmail.com>2014-10-18 20:51:00 +0100
commit47359a1ae21ff24dfe14e8d2d7107293aa36881a (patch)
tree3f7749b57a8d19a9f55dae594c46ada2d5f4e64d /src/server/game/Spells/Spell.cpp
parent996ad78122d072e8f15de60a0baa083ae86a7050 (diff)
Core/Spells: Trigger extra attacks on proper target
Ref #6892 Closes #11001
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 2289020ee38..311182291c5 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -111,8 +111,6 @@ SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0), m_strTarget()
m_objectTarget = NULL;
m_itemTarget = NULL;
- m_objectTargetGUID.Clear();
- m_itemTargetGUID.Clear();
m_itemTargetEntry = 0;
m_targetMask = 0;
@@ -210,6 +208,28 @@ void SpellCastTargets::Write(ByteBuffer& data)
data << m_strTarget;
}
+ObjectGuid SpellCastTargets::GetOrigUnitTargetGUID() const
+{
+ switch (m_origObjectTargetGUID.GetHigh())
+ {
+ case HIGHGUID_PLAYER:
+ case HIGHGUID_VEHICLE:
+ case HIGHGUID_UNIT:
+ case HIGHGUID_PET:
+ return m_origObjectTargetGUID;
+ default:
+ return ObjectGuid();
+ }
+}
+
+void SpellCastTargets::SetOrigUnitTarget(Unit* target)
+{
+ if (!target)
+ return;
+
+ m_origObjectTargetGUID = target->GetGUID();
+}
+
ObjectGuid SpellCastTargets::GetUnitTargetGUID() const
{
if (m_objectTargetGUID.IsUnit())
@@ -636,6 +656,7 @@ Spell::~Spell()
void Spell::InitExplicitTargets(SpellCastTargets const& targets)
{
m_targets = targets;
+ m_targets.SetOrigUnitTarget(m_targets.GetUnitTarget());
// this function tries to correct spell explicit targets for spell
// client doesn't send explicit targets correctly sometimes - we need to fix such spells serverside
// this also makes sure that we correctly send explicit targets to client (removes redundant data)
@@ -3399,8 +3420,13 @@ void Spell::_handle_finish_phase()
m_caster->m_movedPlayer->GainSpellComboPoints(m_comboPointGain);
}
- if (m_caster->m_extraAttacks && GetSpellInfo()->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
- m_caster->HandleProcExtraAttackFor(m_caster->GetVictim());
+ if (m_caster->m_extraAttacks && m_spellInfo->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
+ {
+ if (Unit* victim = ObjectAccessor::FindUnit(m_targets.GetOrigUnitTargetGUID()))
+ m_caster->HandleProcExtraAttackFor(victim);
+ else
+ m_caster->m_extraAttacks = 0;
+ }
/// @todo trigger proc phase finish here
}