Core/Unit: damage immune improvements
This commit is contained in:
1 parent
746cb97dce
commit
b7b69b88ba
8 files changed
+80
-40
No files matched your search
@@ -666,12 +666,6 @@ 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);
|
||||
|
||||
@@ -1068,23 +1062,6 @@ void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castI
|
||||
CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
|
||||
}
|
||||
|
||||
// Obsolete func need remove, here only for comotability vs another patches
|
||||
uint32 Unit::SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
|
||||
if (!spellInfo)
|
||||
return 0;
|
||||
SpellNonMeleeDamage damageInfo(this, victim, spellInfo->Id, spellInfo->SchoolMask);
|
||||
damage = SpellDamageBonusDone(victim, spellInfo, damage, SPELL_DIRECT_DAMAGE);
|
||||
damage = victim->SpellDamageBonusTaken(this, spellInfo, damage, SPELL_DIRECT_DAMAGE);
|
||||
|
||||
CalculateSpellDamageTaken(&damageInfo, damage, spellInfo);
|
||||
DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
|
||||
SendSpellNonMeleeDamageLog(&damageInfo);
|
||||
DealSpellDamage(&damageInfo, true);
|
||||
return damageInfo.damage;
|
||||
}
|
||||
|
||||
void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType, bool crit)
|
||||
{
|
||||
if (damage < 0)
|
||||
@@ -1192,11 +1169,10 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
|
||||
|
||||
void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss)
|
||||
{
|
||||
if (damageInfo == 0)
|
||||
if (!damageInfo)
|
||||
return;
|
||||
|
||||
Unit* victim = damageInfo->target;
|
||||
|
||||
if (!victim)
|
||||
return;
|
||||
|
||||
@@ -1527,7 +1503,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
|
||||
data << uint32(0); // FIX ME: Send resisted damage, both fully resisted and partly resisted
|
||||
victim->SendMessageToSet(&data, true);
|
||||
|
||||
victim->DealDamage(this, damage, 0, SPELL_DIRECT_DAMAGE, spellInfo->GetSchoolMask(), spellInfo, true);
|
||||
victim->DealDamage(this, damage, nullptr, SPELL_DIRECT_DAMAGE, spellInfo->GetSchoolMask(), spellInfo, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2608,6 +2584,11 @@ SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellInfo const* spellInfo, boo
|
||||
if (victim->IsImmunedToSpell(spellInfo))
|
||||
return SPELL_MISS_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 SPELL_MISS_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
|
||||
|
||||
Reference in new issue
Block a user