[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);
}
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)
if (m_auras[i] && m_spellProto->EffectMechanic[i] == mechanic)
return true;
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)
if (m_auras[i] && m_spellProto->EffectMechanic[i] & mechanicMask)
return true;

View file

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

View file

@ -7362,7 +7362,7 @@ void Spell::EffectDispelMechanic(SpellEffectIndex eff_idx)
next = iter;
++next;
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);
if (Auras.empty())

View file

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

View file

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

View file

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