[10232] Fix mechanic-related check, thanks to VladimirMangos

This commit is contained in:
Laise 2010-07-20 13:19:47 +03:00
parent 0065693c4c
commit d8c1374fcd
6 changed files with 14 additions and 8 deletions

View file

@ -8748,16 +8748,22 @@ void SpellAuraHolder::RefreshHolder()
SendAuraUpdate(false); SendAuraUpdate(false);
} }
bool SpellAuraHolder::HasAuraAndMechanicEffect(uint32 mechanic) const bool SpellAuraHolder::HasMechanic(uint32 mechanic) const
{ {
if (mechanic == m_spellProto->Mechanic)
return true;
for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
if (m_auras[i] && m_spellProto->EffectMechanic[i] == mechanic) if (m_auras[i] && m_spellProto->EffectMechanic[i] == mechanic)
return true; return true;
return false; return false;
} }
bool SpellAuraHolder::HasAuraAndMechanicEffectMask(uint32 mechanicMask) const bool SpellAuraHolder::HasMechanicMask(uint32 mechanicMask) const
{ {
if (mechanicMask & (1 << (m_spellProto->Mechanic - 1)))
return true;
for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
if (m_auras[i] && m_spellProto->EffectMechanic[i] & mechanicMask) if (m_auras[i] && m_spellProto->EffectMechanic[i] & mechanicMask)
return true; return true;

View file

@ -153,8 +153,8 @@ class MANGOS_DLL_SPEC SpellAuraHolder
m_stackAmount = stackAmount; m_stackAmount = stackAmount;
} }
bool HasAuraAndMechanicEffect(uint32 mechanic) const; bool HasMechanic(uint32 mechanic) const;
bool HasAuraAndMechanicEffectMask(uint32 mechanicMask) const; bool HasMechanicMask(uint32 mechanicMask) const;
~SpellAuraHolder(); ~SpellAuraHolder();
private: private:

View file

@ -7362,7 +7362,7 @@ void Spell::EffectDispelMechanic(SpellEffectIndex eff_idx)
next = iter; next = iter;
++next; ++next;
SpellEntry const *spell = iter->second->GetSpellProto(); SpellEntry const *spell = iter->second->GetSpellProto();
if (spell->Mechanic == mechanic || iter->second->HasAuraAndMechanicEffect(mechanic)) if (spell->Mechanic == mechanic || iter->second->HasMechanic(mechanic))
{ {
unitTarget->RemoveAurasDueToSpell(spell->Id); unitTarget->RemoveAurasDueToSpell(spell->Id);
if (Auras.empty()) if (Auras.empty())

View file

@ -10180,7 +10180,7 @@ void Unit::RemoveAurasAtMechanicImmunity(uint32 mechMask, uint32 exceptSpellId,
++iter; ++iter;
else if (spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) else if (spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY)
++iter; ++iter;
else if (iter->second->HasAuraAndMechanicEffectMask(mechMask)) else if (iter->second->HasMechanicMask(mechMask))
{ {
RemoveAurasDueToSpell(spell->Id); RemoveAurasDueToSpell(spell->Id);

View file

@ -717,7 +717,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura
SpellEntry const *spell = iter->second->GetSpellProto(); SpellEntry const *spell = iter->second->GetSpellProto();
if( spell->Mechanic == MECHANIC_STUN || if( spell->Mechanic == MECHANIC_STUN ||
iter->second->HasAuraAndMechanicEffect(MECHANIC_STUN)) iter->second->HasMechanic(MECHANIC_STUN))
{ {
pVictim->RemoveAurasDueToSpell(spell->Id); pVictim->RemoveAurasDueToSpell(spell->Id);
iter = Auras.begin(); iter = Auras.begin();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10231" #define REVISION_NR "10232"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__