[8649] Implement SPELL_AURA_MECHANIC_IMMUNITY_MASK (147) and related cleanups.

* Always use machanic masks in form (1 << (mech-1)), fix all cases.
* Imppement SPELL_AURA_MECHANIC_IMMUNITY_MASK (mostly boss/elite spells).

Note: db stored mechannic masks already stored in proper format so not affected.
This commit is contained in:
VladimirMangos 2009-10-15 20:44:30 +04:00
parent 369e50e068
commit a4d61a6988
11 changed files with 158 additions and 119 deletions

View file

@ -197,7 +197,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleAuraSafeFall, //144 SPELL_AURA_SAFE_FALL implemented in WorldSession::HandleMovementOpcodes
&Aura::HandleAuraModPetTalentsPoints, //145 SPELL_AURA_MOD_PET_TALENT_POINTS
&Aura::HandleNoImmediateEffect, //146 SPELL_AURA_ALLOW_TAME_PET_TYPE
&Aura::HandleNULL, //147 SPELL_AURA_ADD_CREATURE_IMMUNITY
&Aura::HandleModMechanicImmunityMask, //147 SPELL_AURA_ADD_CREATURE_IMMUNITY implemented in Unit::IsImmunedToSpell and Unit::IsImmunedToSpellEffect (check part)
&Aura::HandleAuraRetainComboPoints, //148 SPELL_AURA_RETAIN_COMBO_POINTS
&Aura::HandleNoImmediateEffect, //149 SPELL_AURA_REDUCE_PUSHBACK
&Aura::HandleShieldBlockValue, //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
@ -2887,7 +2887,8 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
// If spell that caused this aura has Croud Control or Daze effect
if((aurMechMask & MECHANIC_NOT_REMOVED_BY_SHAPESHIFT) ||
// some Daze spells have these parameters instead of MECHANIC_DAZE (skip snare spells)
aurSpellInfo->SpellIconID == 15 && aurSpellInfo->Dispel == 0 && (aurMechMask & (1 << MECHANIC_SNARE))==0)
aurSpellInfo->SpellIconID == 15 && aurSpellInfo->Dispel == 0 &&
(aurMechMask & (1 << (MECHANIC_SNARE-1)))==0)
{
++iter;
continue;
@ -4171,32 +4172,13 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/)
if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
{
uint32 mechanic = 1 << misc;
uint32 mechanic = 1 << (misc-1);
//immune movement impairment and loss of control
if(GetId()==42292 || GetId()==59752)
mechanic=IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
Unit::AuraMap& Auras = m_target->GetAuras();
for(Unit::AuraMap::iterator iter = Auras.begin(), next; iter != Auras.end(); iter = next)
{
next = iter;
++next;
SpellEntry const *spell = iter->second->GetSpellProto();
if (!( spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) && // spells unaffected by invulnerability
spell->Id != GetId())
{
//check for mechanic mask
if(GetSpellMechanicMask(spell, iter->second->GetEffIndex()) & mechanic)
{
m_target->RemoveAurasDueToSpell(spell->Id);
if(Auras.empty())
break;
else
next = Auras.begin();
}
}
}
m_target->RemoveAurasAtMechanicImmunity(mechanic,GetId());
}
m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,misc,apply);
@ -4224,6 +4206,16 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/)
}
}
void Aura::HandleModMechanicImmunityMask(bool apply, bool /*Real*/)
{
uint32 mechanic = m_modifier.m_miscvalue;
if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
m_target->RemoveAurasAtMechanicImmunity(mechanic,GetId());
// check implemented in Unit::IsImmunedToSpell and Unit::IsImmunedToSpellEffect
}
//this method is called whenever we add / remove aura which gives m_target some imunity to some spell effect
void Aura::HandleAuraModEffectImmunity(bool apply, bool /*Real*/)
{