aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Spell.cpp6
-rw-r--r--src/game/SpellEffects.cpp13
-rw-r--r--src/game/Unit.cpp24
3 files changed, 18 insertions, 25 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 49b957c05bf..9c4681d2f1c 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -2728,6 +2728,10 @@ void Spell::finish(bool ok)
if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->RemoveSpellMods(this);
+ // Okay to remove extra attacks
+ if(IsSpellHaveEffect(m_spellInfo, SPELL_EFFECT_ADD_EXTRA_ATTACKS))
+ m_caster->m_extraAttacks = 0;
+
// Heal caster for all health leech from all targets
if (m_healthLeech)
{
@@ -2989,7 +2993,7 @@ void Spell::SendLogExecute()
data.append(unit->GetPackGUID());
else
data << uint8(0);
- data << uint32(0); // count?
+ data << uint32(m_caster->m_extraAttacks);
break;
case SPELL_EFFECT_INTERRUPT_CAST:
if(Unit *unit = m_targets.getUnitTarget())
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index a1cf876fc6c..89b92ccdc61 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -5441,7 +5441,20 @@ void Spell::EffectAddExtraAttacks(uint32 /*i*/)
if( unitTarget->m_extraAttacks )
return;
+ Unit *victim = unitTarget->getVictim();
+
+ // attack prevented
+ // fixme, some attacks may not target current victim, this is right now not handled
+ if (!victim || !unitTarget->IsWithinMeleeRange(victim) || !unitTarget->HasInArc( 2*M_PI/3, victim ))
+ return;
+
+ // Only for proc/log informations
unitTarget->m_extraAttacks = damage;
+ // Need to send log before attack is made
+ SendLogExecute();
+ m_needSpellLog = false;
+
+ unitTarget->AttackerStateUpdate(victim, BASE_ATTACK, true);
}
void Spell::EffectParry(uint32 /*i*/)
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index ceade1af235..38e2519fe47 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -2378,24 +2378,10 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex
else
return; // ignore ranged case
- uint32 extraAttacks = m_extraAttacks;
-
// melee attack spell casted at main hand attack only
if (attType == BASE_ATTACK && m_currentSpells[CURRENT_MELEE_SPELL])
{
m_currentSpells[CURRENT_MELEE_SPELL]->cast();
-
- // 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;
- }
- }
-
return;
}
@@ -2413,16 +2399,6 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex
DEBUG_LOG("AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
GetGUIDLow(), pVictim->GetGUIDLow(), pVictim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist);
- // extra attack only at any non extra attack (normal case)
- if(!extra && extraAttacks)
- {
- while(m_extraAttacks)
- {
- AttackerStateUpdate(pVictim, BASE_ATTACK, true);
- if(m_extraAttacks > 0)
- --m_extraAttacks;
- }
- }
}
/*