diff options
| author | trickerer <onlysuffering@gmail.com> | 2021-10-01 21:40:20 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-01 16:40:20 +0200 |
| commit | 084f8f3ded45150a57eabd3ad117f1152d4d046d (patch) | |
| tree | 5fd3fb733d8618c043704bc373c3a19a40a3969f /src/server/game/Spells/Spell.cpp | |
| parent | e317beb449fb36b9f13c3bda192f86dc72d07581 (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
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 2e7c93c9d80..450957a5ca9 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -215,28 +215,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::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()) @@ -651,7 +629,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) @@ -2515,6 +2493,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.target, damageInfo.damage, &damageInfo.absorb); @@ -3711,13 +3691,8 @@ void Spell::_handle_finish_phase() unitCaster->AddComboPoints(m_comboTarget, 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 |
