Cleaned and tidied-up the mechanic immunity handler

--HG--
branch : trunk
This commit is contained in:
Xanadu
2010-03-24 20:35:04 +01:00
parent 99e186c830
commit 2f17cff295
2 changed files with 25 additions and 44 deletions
+20 -43
View File
@@ -4095,53 +4095,30 @@ void AuraEffect::HandleModMechanicImmunity(AuraApplication const * aurApp, uint8
return; return;
Unit * target = aurApp->GetTarget(); Unit * target = aurApp->GetTarget();
uint32 mechanic; uint32 mechanic;
mechanic = 1 << GetMiscValue();
//immune movement impairment and loss of control switch (GetId())
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)
{ {
Unit::AuraApplicationMap& Auras = target->GetAppliedAuras(); case 42292: // PvP trinket
for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();) case 59752: // Every Man for Himself
{ mechanic = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
SpellEntry const *spell = iter->second->GetBase()->GetSpellProto(); // Actually we should apply immunities here, too, but the aura has only 100 ms duration, so there is practically no point
if (spell->Id != GetId()) break;
{ case 54508: // Demonic Empowerment
//check for mechanic mask mechanic = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT);
if(GetAllSpellMechanicMask(spell) & mechanic) target->ApplySpellImmune(GetId(), IMMUNITY_STATE, SPELL_AURA_MOD_ROOT, apply);
{ target->ApplySpellImmune(GetId(), IMMUNITY_STATE, SPELL_AURA_MOD_DECREASE_SPEED, apply);
target->RemoveAura(iter); break;
} default:
else if (GetMiscValue() < 1)
++iter; return;
} mechanic = 1 << GetMiscValue();
else target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, GetMiscValue(), apply);
++iter; break;
}
}
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);
} }
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 void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const * aurApp, uint8 mode, bool apply) const
+5 -1
View File
@@ -939,7 +939,7 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con
bool IsPositiveSpell(uint32 spellId) 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 false;
return !(spellmgr.GetSpellCustomAttr(spellId) & SPELL_ATTR_CU_NEGATIVE); return !(spellmgr.GetSpellCustomAttr(spellId) & SPELL_ATTR_CU_NEGATIVE);
} }
@@ -3783,6 +3783,10 @@ void SpellMgr::LoadSpellCustomAttr()
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
count++; count++;
break; break;
case 25771: // Forbearance - wrong mechanic immunity in DBC since 3.0.x
spellInfo->EffectMiscValue[0] = MECHANIC_IMMUNE_SHIELD;
count++;
break;
default: default:
break; break;
} }