aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2016-11-14 20:40:17 -0300
committerariel- <ariel-@users.noreply.github.com>2016-11-14 20:40:17 -0300
commit9f5df023b746d324588f175e264c62205b69e165 (patch)
treed44b5ce5b754693a4528ece426db1bd2b96fa2ef /src
parent425f6c3c34b72190e481ba89fd4757df238475d8 (diff)
Core/Unit: don't use damage immunity to calculate hit result for the whole spell. Should be used only for damage
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp13
-rw-r--r--src/server/game/Spells/Spell.cpp2
2 files changed, 10 insertions, 5 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 40c7ee9fc3f..2b6c16c4d2a 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -665,6 +665,12 @@ void Unit::DealDamageMods(Unit const* victim, uint32 &damage, uint32* absorb) co
uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss)
{
+ if (victim->IsImmunedToDamage(spellProto))
+ {
+ SendSpellDamageImmune(victim, spellProto->Id);
+ return 0;
+ }
+
if (victim->IsAIEnabled)
victim->GetAI()->DamageTaken(this, damage);
@@ -2692,10 +2698,6 @@ SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellInfo const* spellInfo, boo
if (spellInfo->IsPositive() && !IsHostileTo(victim)) // prevent from affecting enemy by "positive" spell
return SPELL_MISS_NONE;
- // Check for immune
- if (victim->IsImmunedToDamage(spellInfo))
- return SPELL_MISS_IMMUNE;
-
if (this == victim)
return SPELL_MISS_NONE;
@@ -7886,6 +7888,9 @@ bool Unit::IsImmunedToDamage(SpellSchoolMask schoolMask) const
bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo) const
{
+ if (!spellInfo)
+ return false;
+
if (spellInfo->HasAttribute(SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE) || spellInfo->HasAttribute(SPELL_ATTR2_UNAFFECTED_BY_AURA_SCHOOL_IMMUNE))
return false;
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index a0bd3306423..92eed603789 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -2531,7 +2531,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
return SPELL_MISS_EVADE;
// For delayed spells immunity may be applied between missile launch and hit - check immunity for that case
- if (m_spellInfo->Speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo)))
+ if (m_spellInfo->Speed && unit->IsImmunedToSpell(m_spellInfo))
return SPELL_MISS_IMMUNE;
// disable effects to which unit is immune