From 6e9d1ba1f787b30a3bb969b0273bfaed95af2e74 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 9 Sep 2021 13:53:16 -0400 Subject: [PATCH] Core/Entities: don't skip immunity checks for positive spells Port From (https://github.com/TrinityCore/TrinityCore/commit/cfe69470a888082f21a639560f54e9c9ed2f3512) --- Source/Game/Entities/Object/WorldObject.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index af3fc70d7..c7678383c 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -1981,6 +1981,15 @@ namespace Game.Entities // Resist public SpellMissInfo SpellHitResult(Unit victim, SpellInfo spellInfo, bool canReflect = false) { + // Check for immune + if (victim.IsImmunedToSpell(spellInfo, this)) + return SpellMissInfo.Immune; + + // Damage immunity is only checked if the spell has damage effects, this immunity must not prevent aura apply + // returns SPELL_MISS_IMMUNE in that case, for other spells, the SMSG_SPELL_GO must show hit + if (spellInfo.HasOnlyDamageEffects() && victim.IsImmunedToDamage(spellInfo)) + return SpellMissInfo.Immune; + // All positive spells can`t miss /// @todo client not show miss log for this spells - so need find info for this in dbc and use it! if (spellInfo.IsPositive() && !IsHostileTo(victim)) // prevent from affecting enemy by "positive" spell @@ -2006,15 +2015,6 @@ namespace Game.Entities if (spellInfo.HasAttribute(SpellAttr3.IgnoreHitResult)) return SpellMissInfo.None; - // Check for immune - if (victim.IsImmunedToSpell(spellInfo, this)) - return SpellMissInfo.Immune; - - // Damage immunity is only checked if the spell has damage effects, this immunity must not prevent aura apply - // returns SPELL_MISS_IMMUNE in that case, for other spells, the SMSG_SPELL_GO must show hit - if (spellInfo.HasOnlyDamageEffects() && victim.IsImmunedToDamage(spellInfo)) - return SpellMissInfo.Immune; - switch (spellInfo.DmgClass) { case SpellDmgClass.Ranged: