Jump to content

[patch][8340] Torment the weak - dmg calculation


Auntie Mangos

Recommended Posts

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

it should fix talent torment the weak

For which repository revision was the patch created?

8285

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

http://getmangos.eu/community/viewtopic.php?id=8251&highlight=torment+the+weak

diff --git a/Unit2.cpp b/Unit.cpp
index 0e055b1..309602d 100644
--- a/Unit2.cpp
+++ b/Unit.cpp
@@ -7955,14 +7955,44 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
            }
        }
    }
-
+    
    // Custom scripted damage
-    // Ice Lance
-    if (spellProto->SpellFamilyName == SPELLFAMILY_MAGE && spellProto->SpellIconID == 186)
-    {
-        if (pVictim->isFrozen())
-            DoneTotalMod *= 3.0f;
-    }
+     switch(spellProto->SpellFamilyName)
+    {
+        case SPELLFAMILY_MAGE:
+        {
+            // Ice Lance
+            if (spellProto->SpellIconID == 186)
+            {
+                if (pVictim->isFrozen())
+                    DoneTotalMod *= 3.0f;
+            }
+            //Torment the weak
+            if ((spellProto->SpellIconID == 188 || //Frostbolt
+                spellProto->SpellIconID == 1485 || //Arcane Barrage
+                spellProto->SpellIconID == 2294 || //Arcane Blast
+                spellProto->SpellIconID == 2946 || //Frostfire Bolt
+                spellProto->SpellIconID == 225 || //Arcane Missle
+                spellProto->SpellIconID == 185) //Fireball
+                 && pVictim->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED))
+            {
+                //Search for Torment the weak dummy aura
+               Unit::AuraList const& ttw = pVictim->GetAurasByType(SPELL_AURA_DUMMY);
+                for(Unit::AuraList::const_iterator i = ttw.begin(); i != ttw.end(); ++i)
+                {
+                    if ((*i)->GetSpellProto()->SpellIconID == 2215)
+                    {
+                        DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f) / 100.0f;
+                        break;
+                    }
+                }
+            }
+            break;
+        }
+        default:
+            break;
+    }
+    

    // ..taken
    AuraList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);

i know the "if" under comment(//Torment the weak) looks kinda lame but im not familiar with spellfamilyflags, so anyone feel like translating these iconid into familyflags? i'd be greatful :D

plz test and share comments :)

Link to comment
Share on other sites

  • 39 years later...

nice, can you explain me a thing:

 DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f) / 100.0f;

what this should do...?

and as suggestion, you could for exemple

+ switch(spellProto->SpellFamilyName)
+    {
+        case SPELLFAMILY_MAGE:
+        {

you can just change it to

+if(spellProto->SpellFamilyName==SPELLFAMILY_MAGE)
+{

so you don't have the problem of default case :)

let me know what you think :)

Link to comment
Share on other sites

Code:

DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f) / 100.0f;

what this should do...?

This is the part where the factor of this aura is applied to the total mod, I think ;)

i know the "if" under comment(//Torment the weak) looks kinda lame but im not familiar with spellfamilyflags, so anyone feel like translating these iconid into familyflags? i'd be greatful

Don't be that lazy^^. This would be probably the biggest peace of work in this patch :-P. Looks horrible with those icon checks. (Maybe you can find it even in the EffectSpellClassMask of the dummy aura, so you don't have to care about that but that is quite unprobable)

Link to comment
Share on other sites

Spellname:        |  FamilyFlags2:  FamilyFlags1:  |  Combined:
------------------+--------------------------------+----------------------------
Frostbolt:        |  0x0            0x20           |  0x0000000000000020
Arcane Barrage:   |  0x8000         0x0            |  0x0000800000000000
Arcane Blast:     |  0x0            0x20000000     |  0x0000000020000000
Frostfire Bolt:   |  0x1000         0x0            |  0x0000100000000000
Arcane Missiles:  |  0x0            0x00200000     |  0x0000000000200000
Fireball:         |  0x0            0x1            |  0x0000000000000001
------------------+--------------------------------+----------------------------
Combined:         |                                |  0x0000900020200021

so, if i'm not mistaken, the line should read something like

if (spellProto->SpellFamilyFlags & UI64LIT(0x0000900020200021) && 
   (pVictim->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) ||
   pVictim->HasAuraType(SPELL_AURA_MELEE_SLOW)))
{
   // Itterate over Dummys and find icon 2215 to change DoneTotalMod 
}

/e: I've to admit, i'm confused about SpellFamilyFlags3. It doesn't matter in this case, but I'd appreciate some enlightenment ;)

But If I'm actually wrong (again) than the Flag would be "0x000000080000900020200021" as Fireball has 0x8 set for it.

Link to comment
Share on other sites

-edit-

after some more thoughts, if you are sure that family flags for all mage spells only have exclusive bits set (i.e. all pairs of flags combined with bitwise 'and' is zero), this should work.

It looks like every spell (with ranks) has only one bit set, but i never examined that further...

Link to comment
Share on other sites

I am afraid, that check for pVictim->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) wil not be sufficent:

From patch 3.0.8 notes

Torment the Weak: Now works with Arcane Blast and does bonus damage against targets afflicted with any type of slow (such as the combat slow from Thunder Clap).

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