fix(Core/Combat): Improved extra attacks handling. Author: @trickerer (#11169)

Fixes #9423
Fixes #11138
This commit is contained in:
UltraNix
2022-03-27 17:08:18 +02:00
committed by GitHub
parent c9377a244f
commit 9c0c925433
5 changed files with 98 additions and 24 deletions

View File

@@ -2605,6 +2605,8 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
// Do damage and triggers
else if (m_damage > 0)
{
caster->SetLastDamagedTargetGuid(unitTarget->GetGUID());
// Fill base damage struct (unitTarget - is real spell target)
SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo, m_spellSchoolMask);
@@ -4049,8 +4051,10 @@ void Spell::_handle_finish_phase()
m_caster->AddComboPoints(m_comboTarget, m_comboPointGain);
}
if (m_caster->m_extraAttacks && GetSpellInfo()->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
m_caster->HandleProcExtraAttackFor(m_caster->GetVictim());
if (m_spellInfo->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
{
m_caster->SetLastExtraAttackSpell(m_spellInfo->Id);
}
if (!IsAutoRepeat() && !IsNextMeleeSwingSpell())
if (m_caster->GetCharmerOrOwnerPlayerOrPlayerItself())

View File

@@ -4664,17 +4664,18 @@ void Spell::EffectResurrect(SpellEffIndex effIndex)
void Spell::EffectAddExtraAttacks(SpellEffIndex effIndex)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
{
return;
}
if (!unitTarget || !unitTarget->IsAlive() || !unitTarget->GetVictim())
if (!unitTarget || !unitTarget->IsAlive())
{
return;
}
if (unitTarget->m_extraAttacks)
return;
unitTarget->AddExtraAttacks(damage);
unitTarget->m_extraAttacks = damage;
ExecuteLogEffectExtraAttacks(effIndex, unitTarget->GetVictim(), damage);
ExecuteLogEffectExtraAttacks(effIndex, unitTarget, damage);
}
void Spell::EffectParry(SpellEffIndex /*effIndex*/)