[11375] Move holder-wide code from effect loop in immune cast checks.

This commit is contained in:
VladimirMangos 2011-04-17 05:43:06 +04:00
parent 79cd96af8a
commit c6dee6c2d6
2 changed files with 40 additions and 39 deletions

View file

@ -5714,20 +5714,22 @@ SpellCastResult Spell::CheckCasterAuras() const
Unit::SpellAuraHolderMap const& auras = m_caster->GetSpellAuraHolderMap(); Unit::SpellAuraHolderMap const& auras = m_caster->GetSpellAuraHolderMap();
for(Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) for(Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{ {
if (SpellAuraHolder *holder = itr->second) SpellAuraHolder *holder = itr->second;
{
for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{
SpellEntry const * pEntry = holder->GetSpellProto(); SpellEntry const * pEntry = holder->GetSpellProto();
if (GetSpellMechanicMask(pEntry, 1 << i) & mechanic_immune)
continue;
if ((GetSpellSchoolMask(pEntry) & school_immune) && !(pEntry->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE)) if ((GetSpellSchoolMask(pEntry) & school_immune) && !(pEntry->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE))
continue; continue;
if ((1<<(pEntry->Dispel)) & dispel_immune) if ((1<<(pEntry->Dispel)) & dispel_immune)
continue; continue;
for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{
Aura *aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i)); Aura *aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i));
if (!aura) if (!aura)
continue; continue;
if (GetSpellMechanicMask(pEntry, 1 << i) & mechanic_immune)
continue;
// Make a second check for spell failed so the right SPELL_FAILED message is returned. // Make a second check for spell failed so the right SPELL_FAILED message is returned.
// That is needed when your casting is prevented by multiple states and you are only immune to some of them. // That is needed when your casting is prevented by multiple states and you are only immune to some of them.
switch(aura->GetModifier()->m_auraname) switch(aura->GetModifier()->m_auraname)
@ -5757,7 +5759,6 @@ SpellCastResult Spell::CheckCasterAuras() const
} }
} }
} }
}
// You are prevented from casting and the spell casted does not grant immunity. Return a failed error. // You are prevented from casting and the spell casted does not grant immunity. Return a failed error.
else else
return prevented_reason; return prevented_reason;

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 "11374" #define REVISION_NR "11375"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__