[Spell] Extra attack: instant or on the next swing

Known issue: wrong combat logging order. Though the timestamp for spelleffect and instant extra attack is the same, the spelleffect appears later in the log.
Was tested on the Windfury weapon only. Main idea was taken from the TC.
This commit is contained in:
Olion 2015-09-25 09:27:40 +03:00 committed by Antz
parent b94c734422
commit b35a53e2b9
4 changed files with 37 additions and 15 deletions

View File

@ -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);
}
}

View File

@ -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

View File

@ -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

View File

@ -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()