diff options
| author | DDuarte <dnpd.dd@gmail.com> | 2014-10-19 00:23:18 +0100 |
|---|---|---|
| committer | DDuarte <dnpd.dd@gmail.com> | 2014-10-19 00:23:18 +0100 |
| commit | 98f98fa17fde4a1294b3e9227973ce5df70fbd6b (patch) | |
| tree | 911710fb74f5b3665c8c88a0608969f2d9c2fbf4 /src/server/game/Spells/Spell.cpp | |
| parent | 8936723291985d1759a4903901c7a29cc54fdcbf (diff) | |
| parent | eb68b116271780f36d34e432cd6f2e9ad12d2b54 (diff) | |
Merge remote-tracking branch 'origin/4.3.4' into 6.x
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 3d0955f5d97..81b7198b2e8 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -113,8 +113,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; @@ -212,6 +210,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()) @@ -638,6 +658,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) @@ -3411,8 +3432,13 @@ void Spell::_handle_finish_phase() HandleHolyPower(m_caster->m_movedPlayer); } - 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 } |
