Core/Unit: don't use damage immunity to calculate hit result for the whole spell. Should be used only for damage

This commit is contained in:
ariel- authored and roc13x committed 2017-05-04 01:45:58 +01:00
1 parent 045bf711c2
commit 746cb97dce
2 files changed
+10 -5

No files matched your search

+9 -4
View File
@@ -666,6 +666,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);
@@ -2607,10 +2613,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;
@@ -7673,6 +7675,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;