Jump to content

[patch] resist log


Auntie Mangos

Recommended Posts

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

fixes damage resist logs sometimes showing

remove discrepancies in use of Unit::SendAttackStateUpdate() and Unit::SendSpellNonMeleeDamageLog(), where 'damage' parameter was sometime used for total damage (damage + resisted + absorbed + blocked), sometimes just for actual damage - now it should be used just for real damage

fixes enviromental damage not being really resisted/absorbed although there are some resists/absorbs in log

For which SubVersion revision was the patch created?

6767 (no GIT, sorry)

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

maybe here: http://getmangos.eu/community/viewtopic.php?id=3175

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

domingo

Index: SpellEffects.cpp
===================================================================
--- SpellEffects.cpp    (revision 6767)
+++ SpellEffects.cpp    (working copy)
@@ -288,9 +288,11 @@

    m_caster->CalcAbsorbResist(m_caster,GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);

-    m_caster->SendSpellNonMeleeDamageLog(m_caster, m_spellInfo->Id, damage, GetSpellSchoolMask(m_spellInfo), absorb, resist, false, 0, false);
+    uint32 realdamage = (damage <= absorb + resist) ? 0 : damage - absorb - resist;
+
+    m_caster->SendSpellNonMeleeDamageLog(m_caster, m_spellInfo->Id, realdamage, GetSpellSchoolMask(m_spellInfo), absorb, resist, false, 0, false);
    if(m_caster->GetTypeId() == TYPEID_PLAYER)
-        ((Player*)m_caster)->EnvironmentalDamage(m_caster->GetGUID(),DAMAGE_FIRE,damage);
+        ((Player*)m_caster)->EnvironmentalDamage(m_caster->GetGUID(),DAMAGE_FIRE,realdamage);
}

void Spell::EffectSchoolDMG(uint32 effect_idx)
@@ -4340,11 +4342,7 @@

    m_caster->DoAttackDamage(unitTarget, &eff_damage, &cleanDamage, &blocked_dmg, m_spellSchoolMask, &hitInfo, &victimState, &absorbed_dmg, &resisted_dmg, m_attackType, m_spellInfo, m_IsTriggeredSpell);

-    if ((hitInfo & nohitMask) && m_attackType != RANGED_ATTACK)  // not send ranged miss/etc
-        m_caster->SendAttackStateUpdate(hitInfo & nohitMask, unitTarget, 1, m_spellSchoolMask, eff_damage, absorbed_dmg, resisted_dmg, VICTIMSTATE_NORMAL, blocked_dmg);
-
    bool criticalhit = (hitInfo & HITINFO_CRITICALHIT);
-    m_caster->SendSpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, eff_damage, m_spellSchoolMask, absorbed_dmg, resisted_dmg, false, blocked_dmg, criticalhit);

    if (eff_damage > (absorbed_dmg + resisted_dmg + blocked_dmg))
    {
@@ -4356,6 +4354,10 @@
        eff_damage = 0;
    }

+    if ((hitInfo & nohitMask) && m_attackType != RANGED_ATTACK)  // not send ranged miss/etc
+        m_caster->SendAttackStateUpdate(hitInfo & nohitMask, unitTarget, 1, m_spellSchoolMask, eff_damage, absorbed_dmg, resisted_dmg, VICTIMSTATE_NORMAL, blocked_dmg);
+    m_caster->SendSpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, eff_damage, m_spellSchoolMask, absorbed_dmg, resisted_dmg, false, blocked_dmg, criticalhit);
+
    // SPELL_SCHOOL_NORMAL use for weapon-like threat and rage calculation
    m_caster->DealDamage(unitTarget, eff_damage, &cleanDamage, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, true);

Index: Unit.cpp
===================================================================
--- Unit.cpp    (revision 6767)
+++ Unit.cpp    (working copy)
@@ -1412,7 +1412,7 @@
            }

            //Send resist
-            SendAttackStateUpdate(HitInfo, pVictim, 1, GetSpellSchoolMask(spellInfo), damage, absorb,resist,VICTIMSTATE_NORMAL,0);
+            SendAttackStateUpdate(HitInfo, pVictim, 1, GetSpellSchoolMask(spellInfo), 0, absorb,resist,VICTIMSTATE_NORMAL,0);
            return 0;
        }

@@ -2225,17 +2225,17 @@

    if (hitInfo & HITINFO_MISS)
        //send miss
-        SendAttackStateUpdate (hitInfo, pVictim, 1, meleeSchoolMask, damage, absorbed_dmg, resisted_dmg, victimState, blocked_dmg);
+        SendAttackStateUpdate (hitInfo, pVictim, 1, meleeSchoolMask, 0, 0, 0, victimState, 0);
    else
    {
-        //do animation
-        SendAttackStateUpdate (hitInfo, pVictim, 1, meleeSchoolMask, damage, absorbed_dmg, resisted_dmg, victimState, blocked_dmg);
-
        if (damage > (absorbed_dmg + resisted_dmg + blocked_dmg))
            damage -= (absorbed_dmg + resisted_dmg + blocked_dmg);
        else
            damage = 0;

+        //do animation
+        SendAttackStateUpdate (hitInfo, pVictim, 1, meleeSchoolMask, damage, absorbed_dmg, resisted_dmg, victimState, blocked_dmg);
+
        DealDamage (pVictim, damage, &cleanDamage, DIRECT_DAMAGE, meleeSchoolMask, NULL, true);

        if(GetTypeId() == TYPEID_PLAYER && pVictim->isAlive())
@@ -4343,7 +4343,7 @@
    data.append(target->GetPackGUID());
    data.append(GetPackGUID());
    data << uint32(SpellID);
-    data << uint32(Damage-AbsorbedDamage-Resist-Blocked);
+    data << uint32(Damage);
    data << uint8(damageSchoolMask);                        // spell school
    data << uint32(AbsorbedDamage);                         // AbsorbedDamage
    data << uint32(Resist);                                 // resist
@@ -4377,15 +4377,15 @@
    data << (uint32)HitInfo;
    data.append(GetPackGUID());
    data.append(target->GetPackGUID());
-    data << (uint32)(Damage-AbsorbDamage-Resist-BlockedAmount);
+    data << (uint32)Damage;

    data << (uint8)SwingType;                               // count?

    // for(i = 0; i < SwingType; ++i)
    data << (uint32)damageSchoolMask;
-    data << (float)(Damage-AbsorbDamage-Resist-BlockedAmount);
+    data << (float)Damage;
    // still need to double check damage
-    data << (uint32)(Damage-AbsorbDamage-Resist-BlockedAmount);
+    data << (uint32)Damage;
    data << (uint32)AbsorbDamage;
    data << (uint32)Resist;
    // end loop
Index: SpellAuras.cpp
===================================================================
--- SpellAuras.cpp    (revision 6767)
+++ SpellAuras.cpp    (working copy)
@@ -5639,6 +5639,8 @@

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

+            uint32 realdamage = (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",
                GetCasterGUID(), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb);

@@ -5648,7 +5650,7 @@
            data << uint32(GetId());
            data << uint32(1);
            data << uint32(m_modifier.m_auraname);
-            data << (uint32)pdamage;
+            data << (uint32)realdamage;
            data << (uint32)GetSpellSchoolMask(GetSpellProto()); // will be mask in 2.4.x
            data << (uint32)absorb;
            data << (uint32)resist;
@@ -5657,11 +5659,11 @@
            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, realdamage, &cleanDamage, DOT, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), true);

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

-            pCaster->ProcDamageAndSpell(target, PROC_FLAG_HIT_SPELL, PROC_FLAG_TAKE_DAMAGE, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), GetSpellSchoolMask(spellProto), spellProto);
+            pCaster->ProcDamageAndSpell(target, PROC_FLAG_HIT_SPELL, PROC_FLAG_TAKE_DAMAGE, realdamage, GetSpellSchoolMask(spellProto), spellProto);
            break;
        }
        case SPELL_AURA_PERIODIC_LEECH:
@@ -5757,6 +5759,8 @@

            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());

@@ -5765,12 +5769,11 @@

            pCaster->SendSpellNonMeleeDamageLog(m_target, GetId(), pdamage, GetSpellSchoolMask(GetSpellProto()), absorb, resist, false, 0);

-
            Unit* target = m_target;                        // aura can be deleted in DealDamage
            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)

something of this is already fixed in procflag patch - but afaik not DoTs, leechs and environmental damage

Link to comment
Share on other sites

  • 38 years later...
You test it if get full resist/absorb for dots?

In this case you don`t get any log :(

Its one reason not added in.

Hmm ... so that's why on clean mangos there is DOT full-resist not reducing all damage but keeping 1 ?

I'll try to play with it ...

I didn't specifically play with resists on your patch, I'll try it ... that information (maybe wrong) is from how I understood your changes related to damage -> no changes to periodic & environmetal damage logs in clean.

Link to comment
Share on other sites

When I removed the ?hack? (1 DOT damage on full resist, patch in GIT updated), I get such resist logs (only this patch):

DoT (Corruption):

50% resist: <victim> suffers 5 Shadow damage from <caster>'s Corruption. (5 resisted)

100% resist: <caster>'s Corruption does not affect <victim>. <victim> resisted. (Tick resisted).

full absorb, with any resist: <caster>'s Corruption was absorbed by <victim> for a moment. (Tick absorbed)

Health Leech (Siphon Life):

50% resist: <caster>'s Siphon Life hits <victim> for 8 Shadow damage. (8 resisted)

100% resist: <caster>'s Siphon Life was fully resisted by <victim>.

full absorb, with any resist: <caster>'s Siphon Life was absorbed by <victim>.

(maybe health leech should use SMSG_PERIODICAURALOG instead of SMSG_SPELLNONMELEEDAMAGELOG ? log text makes more sense to me)

Direct Damage (Shadowbolt): same as health leech.

Looks more-or-less ok to me.

Without both patches:

I get 'fully resist' direct damage logs on 50% resist, negative damage log on 75% resist (and no sct log :-)) ... and full damage on any kind of DoT resist (although damage done is correct).

Link to comment
Share on other sites

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