Jump to content

[patch] Impurity


Guest KAPATEJIb

Recommended Posts

Hello. I was started to write a patch for DK's talent http://www.wowhead.com/?spell=49638 (all ranks)

here the code

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 7045353..75336d8 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -8068,6 +8068,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
    // Taken/Done total percent damage auras
    float DoneTotalMod = 1.0f;
    float TakenTotalMod = 1.0f;
+    int32 ImpurityMod = 0;
    int32 DoneTotal = 0;
    int32 TakenTotal = 0;

@@ -8212,6 +8213,18 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
        }
    }

+    // Impurity hack
+    if (HasAura(49220))
+        ImpurityMod = 4;
+    if (HasAura(49633))
+        ImpurityMod = 8;
+    if (HasAura(49635))
+        ImpurityMod = 12;
+    if (HasAura(49636))
+        ImpurityMod = 16;
+    if (HasAura(49638))
+        ImpurityMod = 20;
+
    // Custom scripted damage
    switch(spellProto->SpellFamilyName)
    {
@@ -8314,7 +8327,11 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
            coeff = bonus->direct_damage * LvlPenalty * stack;

        if (bonus->ap_bonus)
-            DoneTotal += int32(bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK) * stack);
+        {
+            int32 scrap = 0;
+            scrap = GetTotalAttackPowerValue(BASE_ATTACK) / 100 * ImpurityMod;
+            DoneTotal += int32(bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK) * stack) + scrap;
+        }

        DoneTotal  += int32(DoneAdvertisedBenefit * coeff * SpellModSpellDamage);
        TakenTotal += int32(TakenAdvertisedBenefit * coeff);

Code is too hacky but it works. If you can simplify the code - post it.

Link to comment
Share on other sites

Now AP bonus is applied to healing bonus too. Changed code style. Thanks to Shendor from getmangos.ru

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 03b34cb..ea5ae4f 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -8341,7 +8341,20 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
            coeff = bonus->direct_damage * LvlPenalty * stack;

        if (bonus->ap_bonus)
-            DoneTotal += int32(bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK) * stack);
+        {
+            float total_bonus = bonus->ap_bonus;
+            if (GetTypeId() == TYPEID_PLAYER && ((Player*)this)->getClass() == CLASS_DEATH_KNIGHT)
+            {
+                uint32 impurity_id[5] = {49220,49633,49635,49636,49638};
+                for (int i = 0; i < 5; ++i)
+                    if (((Player*)this)->HasSpell(impurity_id[i]))
+                    {
+                        total_bonus += bonus->ap_bonus * (sSpellStore.LookupEntry(impurity_id[i])->EffectBasePoints[0] + 1) / 100.0f;
+                        break;
+                    }
+            }
+            DoneTotal += int32(total_bonus * GetTotalAttackPowerValue(BASE_ATTACK) * stack);
+        }

        DoneTotal  += int32(DoneAdvertisedBenefit * coeff * SpellModSpellDamage);
        TakenTotal += int32(TakenAdvertisedBenefit * coeff);
@@ -8787,7 +8800,17 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
            coeff = bonus->direct_damage * LvlPenalty * stack;

        if (bonus->ap_bonus)
-            DoneTotal += int32(bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK) * stack);
+        {
+            float total_bonus = bonus->ap_bonus;
+            if (GetTypeId() == TYPEID_PLAYER && ((Player*)this)->getClass() == CLASS_DEATH_KNIGHT)
+            {
+                uint32 impurity_id[5] = {49220,49633,49635,49636,49638};
+                for (int i = 0; i < 5; ++i)
+                    if (((Player*)this)->HasSpell(impurity_id[i]))
+                        total_bonus += bonus->ap_bonus * (sSpellStore.LookupEntry(impurity_id[i])->EffectBasePoints[0] + 1) / 100.0f;
+            }
+            DoneTotal += int32(total_bonus * GetTotalAttackPowerValue(BASE_ATTACK) * stack);
+        }

        DoneTotal  += int32(DoneAdvertisedBenefit * coeff * SpellModSpellDamage);
        TakenTotal += int32(TakenAdvertisedBenefit * coeff);

if you expirenced some problems with patch appliyng - use QUOTE button and then copy (because forum bug)

Link to comment
Share on other sites

  • 2 weeks later...
×
×
  • 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