Jump to content

[patch] Show correct values in combat log for partially resisted/absorbed spells


Auntie Mangos

Recommended Posts

* What bug does the patch fix? What features does the patch add?

Fix incorrect damage shown in combat log when spell or elemental melee damage was partially resisted or absorbed.

* For which SubVersion revision was the patch created?

6872

* Is there a thread in the bug report section? If yes, please add a link to the thread.

http://getmangos.eu/community/showthread.php?p=36302

* Who has been writing this patch? Please include either forum user names or email addresses.

Me, Tassader

diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 4b6372f..f5397ec 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -3359,7 +3359,7 @@ bool ChatHandler::HandleDamageCommand(const char * args)
        damage -= absorb + resist;

        m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false);
-        m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_NORMALSWING2, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_NORMAL, 0);
+        m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_NORMALSWING2, target, 1, schoolmask, damage+absorb+resist, absorb, resist, VICTIMSTATE_NORMAL, 0);
        return true;
    }

diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index b4741b4..12902f3 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -5592,6 +5592,8 @@ void Aura::PeriodicTick()

            pCaster->CalcAbsorbResist(m_target, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist);

+            pdamage=(pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist);
+
            sLog.outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
                GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb);

@@ -5610,7 +5612,7 @@ void Aura::PeriodicTick()
            Unit* target = m_target;                        // aura can be deleted in DealDamage
            SpellEntry const* spellProto = GetSpellProto();

-            pCaster->DealDamage(m_target, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), &cleanDamage, DOT, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), true);
+            pCaster->DealDamage(m_target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), true);

            // DO NOT ACCESS MEMBERS OF THE AURA FROM NOW ON (DealDamage can delete aura)

@@ -5710,6 +5712,8 @@ void Aura::PeriodicTick()

            pCaster->CalcAbsorbResist(m_target, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist);

+            pdamage=(pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist);
+            
            if(m_target->GetHealth() < pdamage)
                pdamage = uint32(m_target->GetHealth());

@@ -5723,7 +5727,7 @@ void Aura::PeriodicTick()
            SpellEntry const* spellProto = GetSpellProto();
            float multiplier = spellProto->EffectMultipleValue[GetEffIndex()] > 0 ? spellProto->EffectMultipleValue[GetEffIndex()] : 1;

-            uint32 new_damage = pCaster->DealDamage(m_target, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), &cleanDamage, DOT, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), false);
+            uint32 new_damage = pCaster->DealDamage(m_target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), false);

            // DO NOT ACCESS MEMBERS OF THE AURA FROM NOW ON (DealDamage can delete aura)

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index d1259d0..8526363 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -1429,7 +1429,7 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage
            GetGUIDLow(), GetTypeId(), pVictim->GetGUIDLow(), pVictim->GetTypeId(), damage, spellID, absorb,resist);

        // Actual log sent to client
-        SendSpellNonMeleeDamageLog(pVictim, spellID, damage, GetSpellSchoolMask(spellInfo), absorb, resist, false, 0, crit);
+        SendSpellNonMeleeDamageLog(pVictim, spellID, damage+absorb+resist, GetSpellSchoolMask(spellInfo), absorb, resist, false, 0, crit);

        // Procflags
        uint32 procAttacker = PROC_FLAG_HIT_SPELL;

Description:

In Unit::SpellNonMeleeDamageLog(), resisted and absorbed part of damage was subtracted before calling SendSpellNonMeleeDamageLog() and than once again IN SendSpellNonMeleeDamageLog(), resulting in too low (or even negative) damage shown in combat log

Similarly in ChatHandler::HandleDamageCommand()

In Aura::PeriodicTick(), resisted+absorbed portion was NOT subtracted before sending data to client, so client's combat log always reported full damage

Link to comment
Share on other sites

  • 38 years later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use