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-
2016-11-14 20:40:17 -03:00
committed by roc13x
parent 045bf711c2
commit 746cb97dce
2 changed files with 10 additions and 5 deletions

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;

View File

@@ -2547,7 +2547,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