diff --git a/src/game/Object/Unit.cpp b/src/game/Object/Unit.cpp index 8ea8a1cd..c04fd888 100644 --- a/src/game/Object/Unit.cpp +++ b/src/game/Object/Unit.cpp @@ -2102,14 +2102,8 @@ void Unit::AttackerStateUpdate(Unit* pVictim, WeaponAttackType attType, bool ext // not recent extra attack only at any non extra attack (melee spell case) if (!extra && extraAttacks) - { - while (m_extraAttacks) - { - AttackerStateUpdate(pVictim, BASE_ATTACK, true); - if (m_extraAttacks > 0) - { --m_extraAttacks; } - } - } + HandleProcExtraAttackFor(pVictim); + return; } @@ -2133,13 +2127,15 @@ void Unit::AttackerStateUpdate(Unit* pVictim, WeaponAttackType attType, bool ext // extra attack only at any non extra attack (normal case) if (!extra && extraAttacks) + HandleProcExtraAttackFor(pVictim); +} + +void Unit::HandleProcExtraAttackFor(Unit* victim) +{ + while (m_extraAttacks) { - while (m_extraAttacks) - { - AttackerStateUpdate(pVictim, BASE_ATTACK, true); - if (m_extraAttacks > 0) - { --m_extraAttacks; } - } + --m_extraAttacks; + AttackerStateUpdate(victim, BASE_ATTACK, true); } } diff --git a/src/game/Object/Unit.h b/src/game/Object/Unit.h index b56a9906..0ab6bda7 100644 --- a/src/game/Object/Unit.h +++ b/src/game/Object/Unit.h @@ -1971,7 +1971,10 @@ class Unit : public WorldObject * @param durabilityLoss whether or not durability loss should happen */ void DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss); - + /** + * Handles all extra attacks set up by a spell + */ + void HandleProcExtraAttackFor(Unit* victim); /** * Calculates how much damage a spell should do, it will do some bonus damage according * to which SpellNonMeleeDamage::DmgClass it belongs to, ie: SPELL_DAMAGE_CLASS_RANGED diff --git a/src/game/Server/DBCStructure.h b/src/game/Server/DBCStructure.h index 12ed6b4f..11790f3b 100644 --- a/src/game/Server/DBCStructure.h +++ b/src/game/Server/DBCStructure.h @@ -921,6 +921,13 @@ struct SpellEntry */ inline bool HasAttribute(SpellAttributesEx4 attribute) const { return AttributesEx4 & attribute; } + inline bool HasSpellEffect(uint16 effect) const + { + for (uint8 i = EFFECT_INDEX_0; i <= EFFECT_INDEX_2; ++i) + if (Effect[i] == effect) + return true; + return false; + } private: // prevent creating custom entries (copy data from original in fact) SpellEntry(SpellEntry const&); // DON'T must have implementation diff --git a/src/game/WorldHandlers/Spell.cpp b/src/game/WorldHandlers/Spell.cpp index 1eef27a4..04c2ccb0 100644 --- a/src/game/WorldHandlers/Spell.cpp +++ b/src/game/WorldHandlers/Spell.cpp @@ -2950,6 +2950,22 @@ void Spell::_handle_finish_phase() // spell log if (m_needSpellLog) { SendLogExecute(); } + + if (m_caster->m_extraAttacks && m_spellInfo->HasSpellEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS)) + { + switch (m_spellInfo->Id) + { + case 15494: + case 18797: + case 21919: + case 20178: // paladin reckoning proc + break; + default: + if (Unit* victim = m_caster->getVictim()) + m_caster->HandleProcExtraAttackFor(victim); + break; + } + } } void Spell::SendSpellCooldown()