diff options
| -rw-r--r-- | src/server/game/DataStores/DBCEnums.h | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 10 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 4 | ||||
| -rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 10 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp | 2 |
5 files changed, 17 insertions, 11 deletions
diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h index b367da13854..70dcb492655 100644 --- a/src/server/game/DataStores/DBCEnums.h +++ b/src/server/game/DataStores/DBCEnums.h @@ -1862,7 +1862,7 @@ enum SpellCategoryFlags enum class SpellEffectAttributes { None = 0, - NoImmunity = 0x000001, /*NYI*/ // not cancelled by immunities + NoImmunity = 0x000001, // not cancelled by immunities PositionIsFacingRelative = 0x000002, /*NYI*/ JumpChargeUnitMeleeRange = 0x000004, /*NYI*/ JumpChargeUnitStrictPathCheck = 0x000008, /*NYI*/ diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 7f4b58621b5..d68fc26cf3a 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -7282,7 +7282,7 @@ bool Unit::IsImmunedToDamage(SpellSchoolMask schoolMask) const return false; } -bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo) const +bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo, SpellEffectInfo const* spellEffectInfo /*= nullptr*/) const { if (!spellInfo) return false; @@ -7294,6 +7294,9 @@ bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo) const if (spellInfo->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS) || spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES)) return false; + if (spellEffectInfo && spellEffectInfo->EffectAttributes.HasFlag(SpellEffectAttributes::NoImmunity)) + return false; + if (uint32 schoolMask = spellInfo->GetSchoolMask()) { // If m_immuneToSchool type contain this school type, IMMUNE damage. @@ -7445,6 +7448,9 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, SpellEffectInfo co if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES)) return false; + if (spellEffectInfo.EffectAttributes.HasFlag(SpellEffectAttributes::NoImmunity)) + return false; + auto hasImmunity = [requireImmunityPurgesEffectAttribute](SpellImmuneContainer const& container, uint32 key) { Trinity::IteratorPair<SpellImmuneContainer::const_iterator> range = Trinity::Containers::MapEqualRange(container, key); @@ -7717,7 +7723,7 @@ int32 Unit::MeleeDamageBonusTaken(Unit* attacker, int32 pdamage, WeaponAttackTyp return int32(std::max(tmpDamage, 0.0f)); } -void Unit::ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply) +void Unit::ApplySpellImmune(uint32 spellId, SpellImmunity op, uint32 type, bool apply) { if (apply) m_spellImmune[op].emplace(type, spellId); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index bc4b402259c..6a91b7d092c 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1728,14 +1728,14 @@ class TC_GAME_API Unit : public WorldObject static uint32 SpellCriticalDamageBonus(Unit const* caster, SpellInfo const* spellProto, uint32 damage, Unit* victim); static uint32 SpellCriticalHealingBonus(Unit const* caster, SpellInfo const* spellProto, uint32 damage, Unit* victim); - void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); + void ApplySpellImmune(uint32 spellId, SpellImmunity op, uint32 type, bool apply); bool IsImmunedToSpell(SpellInfo const* spellInfo, WorldObject const* caster, bool requireImmunityPurgesEffectAttribute = false) const; uint32 GetSchoolImmunityMask() const; uint32 GetDamageImmunityMask() const; uint64 GetMechanicImmunityMask() const; bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const; - bool IsImmunedToDamage(SpellInfo const* spellInfo) const; + bool IsImmunedToDamage(SpellInfo const* spellInfo, SpellEffectInfo const* spellEffectInfo = nullptr) const; virtual bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, SpellEffectInfo const& spellEffectInfo, WorldObject const* caster, bool requireImmunityPurgesEffectAttribute = false) const; static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const* spellInfo = nullptr); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 3efbbbf0696..d7a08f4b1dc 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5377,7 +5377,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const if (!target->IsAlive()) return; - if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) + if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo(), &GetSpellEffectInfo())) { SendTickImmune(target, caster); return; @@ -5512,7 +5512,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c if (!target->IsAlive()) return; - if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) + if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo(), &GetSpellEffectInfo())) { SendTickImmune(target, caster); return; @@ -5701,7 +5701,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con if (!caster || !caster->IsAlive() || !target->IsAlive() || target->GetPowerType() != powerType) return; - if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) + if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo(), &GetSpellEffectInfo())) { SendTickImmune(target, caster); return; @@ -5826,7 +5826,7 @@ void AuraEffect::HandlePeriodicPowerBurnAuraTick(Unit* target, Unit* caster) con if (!caster || !target->IsAlive() || target->GetPowerType() != powerType) return; - if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) + if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo(), &GetSpellEffectInfo())) { SendTickImmune(target, caster); return; @@ -5950,7 +5950,7 @@ void AuraEffect::HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEv { Unit* target = aurApp->GetTarget(); Unit* triggerTarget = eventInfo.GetProcTarget(); - if (triggerTarget->HasUnitState(UNIT_STATE_ISOLATED) || triggerTarget->IsImmunedToDamage(GetSpellInfo())) + if (triggerTarget->HasUnitState(UNIT_STATE_ISOLATED) || triggerTarget->IsImmunedToDamage(GetSpellInfo(), &GetSpellEffectInfo())) { SendTickImmune(triggerTarget, target); return; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 9d7a7df5dbe..d6ab270a5fc 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1057,7 +1057,7 @@ class spell_sindragosa_s_fury : public SpellScript if (!GetHitUnit()->IsAlive() || !_targetCount) return; - if (GetHitUnit()->IsImmunedToDamage(GetSpellInfo())) + if (GetHitUnit()->IsImmunedToDamage(GetSpellInfo(), &GetEffectInfo())) { GetCaster()->SendSpellDamageImmune(GetHitUnit(), GetSpellInfo()->Id, false); return; |
