diff options
author | Xanadu <none@none> | 2010-03-24 20:35:04 +0100 |
---|---|---|
committer | Xanadu <none@none> | 2010-03-24 20:35:04 +0100 |
commit | 2f17cff295b9933ee6a0bb50b0d7e510521bc1e1 (patch) | |
tree | 8f201d2a4fc9e3605e0b16840904a7ab24338068 | |
parent | 99e186c8303e02d61130113b59e0a6baba30eacf (diff) |
Cleaned and tidied-up the mechanic immunity handler
--HG--
branch : trunk
-rw-r--r-- | src/game/SpellAuraEffects.cpp | 63 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 6 |
2 files changed, 25 insertions, 44 deletions
diff --git a/src/game/SpellAuraEffects.cpp b/src/game/SpellAuraEffects.cpp index 3b1fb2e0c8f..d12817eaef2 100644 --- a/src/game/SpellAuraEffects.cpp +++ b/src/game/SpellAuraEffects.cpp @@ -4095,53 +4095,30 @@ void AuraEffect::HandleModMechanicImmunity(AuraApplication const * aurApp, uint8 return; Unit * target = aurApp->GetTarget(); - uint32 mechanic; - mechanic = 1 << GetMiscValue(); - - //immune movement impairment and loss of control - if(GetId()==42292 || GetId()==59752) - mechanic=IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; - // Forbearance - // in DBC wrong mechanic immune since 3.0.x - else if (GetId() == 25771) - mechanic = 1 << MECHANIC_IMMUNE_SHIELD; - - if (!mechanic) - return; - if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) + switch (GetId()) { - Unit::AuraApplicationMap& Auras = target->GetAppliedAuras(); - for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();) - { - SpellEntry const *spell = iter->second->GetBase()->GetSpellProto(); - if (spell->Id != GetId()) - { - //check for mechanic mask - if(GetAllSpellMechanicMask(spell) & mechanic) - { - target->RemoveAura(iter); - } - else - ++iter; - } - else - ++iter; - } - } - - target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,GetMiscValue(), apply); - - // Demonic Empowerment -- voidwalker -- missing movement impairing effects immunity - if (GetId() == 54508) - { - if (apply) - target->RemoveMovementImpairingAuras(); - - target->ApplySpellImmune(GetId(),IMMUNITY_STATE,SPELL_AURA_MOD_ROOT, apply); - target->ApplySpellImmune(GetId(),IMMUNITY_STATE,SPELL_AURA_MOD_DECREASE_SPEED, apply); + case 42292: // PvP trinket + case 59752: // Every Man for Himself + mechanic = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; + // Actually we should apply immunities here, too, but the aura has only 100 ms duration, so there is practically no point + break; + case 54508: // Demonic Empowerment + mechanic = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT); + target->ApplySpellImmune(GetId(), IMMUNITY_STATE, SPELL_AURA_MOD_ROOT, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_STATE, SPELL_AURA_MOD_DECREASE_SPEED, apply); + break; + default: + if (GetMiscValue() < 1) + return; + mechanic = 1 << GetMiscValue(); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, GetMiscValue(), apply); + break; } + + if (apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) + target->RemoveAurasWithMechanic(mechanic, AURA_REMOVE_BY_DEFAULT, GetId()); } void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const * aurApp, uint8 mode, bool apply) const diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 1f0c27494e2..f94f980f7bb 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -939,7 +939,7 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con bool IsPositiveSpell(uint32 spellId) { - if(!sSpellStore.LookupEntry(spellId)) // non-existing spells such as 61988 (Forbearance) + if(!sSpellStore.LookupEntry(spellId)) // non-existing spells return false; return !(spellmgr.GetSpellCustomAttr(spellId) & SPELL_ATTR_CU_NEGATIVE); } @@ -3783,6 +3783,10 @@ void SpellMgr::LoadSpellCustomAttr() spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; count++; break; + case 25771: // Forbearance - wrong mechanic immunity in DBC since 3.0.x + spellInfo->EffectMiscValue[0] = MECHANIC_IMMUNE_SHIELD; + count++; + break; default: break; } |