diff options
| author | trickerer <onlysuffering@gmail.com> | 2021-10-01 21:40:20 +0700 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-03-19 22:37:41 +0100 |
| commit | 6c9bde098b40f38905ea7407d0cd77437b0b953c (patch) | |
| tree | 01505b887ce061c00a79c007577388e8218496b3 /src/server/game/Spells/Spell.cpp | |
| parent | 179686d4c9e1c73f0752b4a27767c926771115af (diff) | |
Core/Combat Improve extra attacks handling (#26859)
* Core/Combat Improve extra attacks handling
* Remove unnecessary _lastDamagedTargetGuid check
* Add missing initialization of _lastExtraAttackSpell. Do not use hardcoded spell ids.
* Partially revert 9f90b835019b
(cherry picked from commit 084f8f3ded45150a57eabd3ad117f1152d4d046d)
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6adbfa28086..53656861b92 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -199,28 +199,6 @@ void SpellCastTargets::Write(WorldPackets::Spells::SpellTargetData& data) data.Name = m_strTarget; } -ObjectGuid SpellCastTargets::GetOrigUnitTargetGUID() const -{ - switch (m_origObjectTargetGUID.GetHigh()) - { - case HighGuid::Player: - case HighGuid::Vehicle: - case HighGuid::Creature: - 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()) @@ -646,7 +624,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) @@ -2696,6 +2674,8 @@ void Spell::TargetInfo::DoDamageAndTriggers(Spell* spell) } else { + caster->SetLastDamagedTargetGuid(spell->unitTarget->GetGUID()); + // Add bonuses and fill damageInfo struct caster->CalculateSpellDamageTaken(&damageInfo, spell->m_damage, spell->m_spellInfo, spell->m_attackType, IsCrit, spell); Unit::DealDamageMods(damageInfo.attacker, damageInfo.target, damageInfo.damage, &damageInfo.absorb); @@ -3955,13 +3935,8 @@ void Spell::_handle_finish_phase() if (m_comboPointGain) unitCaster->AddComboPoints(m_comboPointGain); - if (unitCaster->m_extraAttacks && m_spellInfo->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS)) - { - if (Unit* victim = ObjectAccessor::GetUnit(*unitCaster, m_targets.GetOrigUnitTargetGUID())) - unitCaster->HandleProcExtraAttackFor(victim); - else - unitCaster->m_extraAttacks = 0; - } + if (m_spellInfo->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS)) + unitCaster->SetLastExtraAttackSpell(m_spellInfo->Id); } // Handle procs on finish |
