Properly check if triggering spell can stack with player's aura.

That should fix e.g. water shield.

--HG--
branch : trunk
This commit is contained in:
krz
2009-05-17 12:03:54 +02:00
parent 10ee81ef13
commit cc85d9e1c4
+19 -13
View File
@@ -6894,19 +6894,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
Item* castItem = triggeredByAura->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER Item* castItem = triggeredByAura->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL; ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL;
// check if triggering spell can stack with current target's auras (if not - don't proc) // Try handle unknown trigger spells
AuraMap::iterator i,next;
for (i = m_Auras.begin(); i != m_Auras.end(); i = next)
{
next = i;
++next;
if (!(*i).second) continue;
if ( (*i).second->GetSpellProto()->Id == trigger_spell_id) continue;
if (spellmgr.IsNoStackSpellDueToSpell(trigger_spell_id, (*i).second->GetSpellProto()->Id, (pVictim == this)))
return false;
}
// Try handle uncnown trigger spells
if (sSpellStore.LookupEntry(trigger_spell_id)==NULL) if (sSpellStore.LookupEntry(trigger_spell_id)==NULL)
switch (auraSpellInfo->SpellFamilyName) switch (auraSpellInfo->SpellFamilyName)
{ {
@@ -7404,6 +7392,24 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
return false; return false;
} }
// check if triggering spell can stack with current target's auras (if not - don't proc)
// don't check if
// aura is passive (talent's aura)
// trigger_spell_id's aura is already active (allow to refresh triggered auras)
// trigger_spell_id's triggeredByAura is already active (for example shaman's shields)
AuraMap::iterator i,next;
uint32 aura_id = 0;
for (i = m_Auras.begin(); i != m_Auras.end(); i = next)
{
next = i;
++next;
if (!(*i).second) continue;
aura_id = (*i).second->GetSpellProto()->Id;
if ( IsPassiveSpell(aura_id) || aura_id == trigger_spell_id || aura_id == triggeredByAura->GetSpellProto()->Id ) continue;
if (spellmgr.IsNoStackSpellDueToSpell(trigger_spell_id, (*i).second->GetSpellProto()->Id, ((*i).second->GetCasterGUID() == GetGUID())))
return false;
}
// not allow proc extra attack spell at extra attack // not allow proc extra attack spell at extra attack
if( m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS) ) if( m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS) )
return false; return false;