Jump to content

[Bug] Threat Calculation


Recommended Posts

Posted
And since we are calculating with float, multiplying the internal values won't really do anything useful, so as mentioned SendThreatUpdate() would be the more logical place...

Well since we have some fixed value from DBCs for some spells and also from SPELL_THREAT table it do matters where we multiply...

Anyway scaling the threat value on SendThreatUpdate seems the quickiest way but, despite my initial throughs, I think that the right way should be to move the whole threat math from float to integer like it's done for damage and healing.

Also there's another big issue: Mangos allows negative threat values while I'm pretty sure clients can't ever display it value less than 0 (now there's an unexpected signed to unsigned conversion on SendThreatUpdate that borks threat meters) so IHMO it's another reason to calculate threat as an pure unsigned integer.

For differences between mangos and offy, as we said, surely some spells, mainly those used by tanks, should generate more threat as documented on wowwiki so something like this could be a start:

-            if(spellProto && IsDamageToThreatSpell(spellProto))
-                pVictim->AddThreat(this, float(damage*2), (cleanDamage && cleanDamage->hitOutCome == MELEE_HIT_CRIT), damageSchoolMask, spellProto);
-            else
-                pVictim->AddThreat(this, float(damage), (cleanDamage && cleanDamage->hitOutCome == MELEE_HIT_CRIT), damageSchoolMask, spellProto);
+            float DtTcoef = DamageToThreatSpell(spellProto);
+            pVictim->AddThreat(this, float(damage*DtTcoef), (cleanDamage && cleanDamage->hitOutCome == MELEE_HIT_CRIT), damageSchoolMask, spellProto);

-bool Unit::IsDamageToThreatSpell(SpellEntry const * spellInfo) const
+float Unit::DamageToThreatSpell(SpellEntry const * spellInfo) const
{
    if (!spellInfo)
-        return false;
+        return 1.0f;

    uint32 family = spellInfo->SpellFamilyName;
    uint64 flags = spellInfo->SpellFamilyFlags;

    if ((family == 5 && flags == 256) ||                    //Searing Pain
        (family == 6 && flags == 8192) ||                   //Mind Blast
        (family == 11 && flags == 1048576))                 //Earth Shock
-        return true;
+        return 2.0f;

-    return false;
+    // Rune Strike     return 1.75f
+    // Death and Decay     return 1.9f
+    // Icy Touch     return 7.0f
+    // Thunder Clap     return 1.85f
+    // Swipe (Bear)     return 1.5f
+
+    return 1.0f; // default

it should be completed with the usual spellfamily&spellflags switches for all the spells that doesn't scales 1:1 with damage (I'm not sure if there are also some healing spell with differenct coefficient than the default 0.5).

×
×
  • 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