Jump to content

[patch][8947] SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS


Auntie Mangos

Recommended Posts

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

implements harmful magic effects duration reduce

For which repository revision was the patch created?

8912

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=7393

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

me

diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 00ade17..ff2e4aa 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -295,7 +295,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
    &Aura::HandleUnused,                                    //242 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING (only 2 test spels in 3.2.2a)
    &Aura::HandleNULL,                                      //243 faction reaction override spells
    &Aura::HandleComprehendLanguage,                        //244 SPELL_AURA_COMPREHEND_LANGUAGE
-    &Aura::HandleNULL,                                      //245 SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS
+    &Aura::HandleNoImmediateEffect,                         //245 SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS implemented in Unit::CalculateSpellDuration
    &Aura::HandleNoImmediateEffect,                         //246 SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL implemented in Unit::CalculateSpellDuration
    &Aura::HandleNULL,                                      //247 target to become a clone of the caster
    &Aura::HandleNoImmediateEffect,                         //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE         implemented in Unit::RollMeleeOutcomeAgainst
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 7414823..1fc1391 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -10962,6 +10962,11 @@ int32 Unit::CalculateSpellDuration(SpellEntry const* spellProto, uint8 effect_in
        durationMod_always+=target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL, spellProto->Dispel);
        // Find max mod (negative bonus)
        int32 durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, mechanic);
+        
+        if (!IsPositiveSpell(spellProto->Id))
+        {
+            // only for harmful effects
+            Unit::AuraList const& modAuras = target->GetAurasByType(SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS);
+            for(Unit::AuraList::const_iterator itr = modAuras.begin(); itr != modAuras.end(); ++itr)
+                if(spellProto->DmgClass == (*itr)->GetMiscValue())
+                    durationMod_always += (*itr)->GetModifier()->m_amount;
+        }

        int32 durationMod = 0;
        // Select strongest negative mod

or

diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 00ade17..ff2e4aa 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -295,7 +295,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
    &Aura::HandleUnused,                                    //242 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING (only 2 test spels in 3.2.2a)
    &Aura::HandleNULL,                                      //243 faction reaction override spells
    &Aura::HandleComprehendLanguage,                        //244 SPELL_AURA_COMPREHEND_LANGUAGE
-    &Aura::HandleNULL,                                      //245 SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS
+    &Aura::HandleNoImmediateEffect,                         //245 SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS implemented in Unit::CalculateSpellDuration
    &Aura::HandleNoImmediateEffect,                         //246 SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL implemented in Unit::CalculateSpellDuration
    &Aura::HandleNULL,                                      //247 target to become a clone of the caster
    &Aura::HandleNoImmediateEffect,                         //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE         implemented in Unit::RollMeleeOutcomeAgainst
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 7414823..1fc1391 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -10962,6 +10962,11 @@ int32 Unit::CalculateSpellDuration(SpellEntry const* spellProto, uint8 effect_in
        durationMod_always+=target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL, spellProto->Dispel);
        // Find max mod (negative bonus)
        int32 durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, mechanic);
+        
+        if (!IsPositiveSpell(spellProto->Id))
+             durationMod_always += target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS, spellProto->DmgClass);

        int32 durationMod = 0;
        // Select strongest negative mod

idk if it should reduce duration of auras that are already on player and if it should restore back original duration if it is removed before harmful effect is expired.(I will add this part if it does)

also IsPositiveSpell can be replaced by IsPositiveEffect but i haven't tested it enough to say that it is ok

Link to comment
Share on other sites

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