diff options
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 36 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.h | 3 | ||||
-rw-r--r-- | src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp | 8 |
5 files changed, 38 insertions, 15 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 7be93c48764..4696300e411 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11078,7 +11078,7 @@ bool Unit::IsImmunedToDamage(SpellEntry const* spellInfo) //If m_immuneToSchool type contain this school type, IMMUNE damage. SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr) - if (itr->type & shoolMask &&!IsDispelableBySpell(spellInfo, itr->spellId)) + if (itr->type & shoolMask && !CanSpellPierceImmuneAura(spellInfo, sSpellStore.LookupEntry(itr->spellId))) return true; } @@ -11136,7 +11136,7 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo) for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr) if ((itr->type & GetSpellSchoolMask(spellInfo)) && !(IsPositiveSpell(itr->spellId) && IsPositiveSpell(spellInfo->Id)) - && !IsDispelableBySpell(spellInfo, itr->spellId)) + && !CanSpellPierceImmuneAura(spellInfo, sSpellStore.LookupEntry(itr->spellId))) return true; } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 3ab48ef0b29..7da5559c4c5 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -4273,7 +4273,7 @@ void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const * aurApp, uin { SpellEntry const *spell = iter->second->GetBase()->GetSpellProto(); if ((GetSpellSchoolMask(spell) & school_mask)//Check for school mask - && IsDispelableBySpell(GetSpellProto(),spell->Id, true) + && CanSpellDispelAura(GetSpellProto(),spell) && !iter->second->IsPositive() //Don't remove positive spells && spell->Id != GetId()) //Don't remove self { diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index f2f1ab610ea..0f06598afe7 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3200,20 +3200,40 @@ bool SpellMgr::CanAurasStack(SpellEntry const *spellInfo_1, SpellEntry const *sp return false; } -bool IsDispelableBySpell(SpellEntry const * dispelSpell, uint32 spellId, bool def) +bool CanSpellDispelAura(SpellEntry const * dispelSpell, SpellEntry const * aura) { - if (!dispelSpell) return false; - SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId); - if (!spellproto) return false; - - // Cyclone etc.. - if (spellproto->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE) + // These auras (like ressurection sickness) can't be dispelled + if (aura->Attributes & SPELL_ATTR_NEGATIVE_1) return false; + // These spells (like Mass Dispel) can dispell all auras if (dispelSpell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) return true; - return def; + // These auras (like Divine Shield) can't be dispelled + if (aura->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) + return false; + + // These auras (Cyclone for example) are not dispelable + if (aura->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE) + return false; + + return true; +} + +bool CanSpellPierceImmuneAura(SpellEntry const * pierceSpell, SpellEntry const * aura) +{ + // these spells pierce all avalible spells (Resurrection Sickness for example) + if (pierceSpell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) + return true; + + // these spells (Cyclone for example) can pierce all... + if ((pierceSpell->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE) + // ...but not these (Divine shield for example) + && !(aura->AttributesEx & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY)) + return true; + + return false; } void SpellMgr::LoadSpellEnchantProcData() diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 7da91dce7d3..93af37ed18d 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -330,7 +330,8 @@ inline bool IsNonCombatSpell(SpellEntry const *spellInfo) bool IsPositiveSpell(uint32 spellId); bool IsPositiveEffect(uint32 spellId, uint32 effIndex); bool IsPositiveTarget(uint32 targetA, uint32 targetB); -bool IsDispelableBySpell(SpellEntry const * dispelSpell, uint32 spellId, bool def = false); +bool CanSpellDispelAura(SpellEntry const * dispelSpell, SpellEntry const * aura); +bool CanSpellPierceImmuneAura(SpellEntry const * pierceSpell, SpellEntry const * aura); bool IsSingleTargetSpell(SpellEntry const *spellInfo); bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellInfo2); diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index f4aec47a78a..458a6f44501 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -336,9 +336,11 @@ struct instance_zulfarrak : public ScriptedInstance //pop a add from list, send him up the stairs... for (uint32 addCount = 0; addCount<count && !addsAtBase.empty(); addCount++) { - Creature* add = instance->GetCreature(*addsAtBase.begin()); - add->GetMotionMaster()->MovePath(PATH_ADDS,false); - movedadds.push_back(add->GetGUID()); + if (Creature* add = instance->GetCreature(*addsAtBase.begin())) + { + add->GetMotionMaster()->MovePath(PATH_ADDS,false); + movedadds.push_back(add->GetGUID()); + } addsAtBase.erase(addsAtBase.begin()); } } |