Jump to content

[fix]damage taken increase glyphs (for effects that need to be broken on dmg)


Guest laise

Recommended Posts

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

fixes

54760 Glyph of Entangling Roots

56244 Glyph of Fear

56376 Glyph of Frost Nova

63291 Glyph of Hex

For which repository revision was the patch created?

9061

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

haven't found any

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

me

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 0715d5b..1bee202 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -381,6 +381,23 @@ void Unit::RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage)

    // The chance to dispel an aura depends on the damage taken with respect to the casters level.
    uint32 max_dmg = getLevel() > 8 ? 25 * getLevel() - 150 : 50;
+
+    AuraList const& typeAuras = GetAurasByType(auraType);
+    for (AuraList::const_iterator iter = typeAuras.begin(); iter != typeAuras.end(); ++iter)
+    {
+        Unit *caster = (*iter)->GetCaster();
+
+        if (!caster)
+            continue;
+
+        AuraList const& mOverrideClassScript = caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+        for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
+        {
+            if ((*i)->GetModifier()->m_miscvalue == 7801 && (*i)->isAffectedOnSpell((*iter)->GetSpellProto()))
+                max_dmg += (*i)->GetModifier()->m_amount * max_dmg / 100;
+        }
+    }
+
    float chance = float(damage) / max_dmg * 100.0f;
    if (roll_chance_f(chance))
        RemoveSpellsCausingAura(auraType);

Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...
  • 2 weeks later...

A bit different in the mechanics - this now depends only on the aura that might be removed, not only on all auras (and all casters) of this aura's type.

I think this is more logical.

UNTESTED

diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp
index 0080e5a..3b6ad70 100644
--- a/src/game/UnitAuraProcHandler.cpp
+++ b/src/game/UnitAuraProcHandler.cpp
@@ -4073,6 +4073,16 @@ SpellAuraProcResult Unit::HandleRemoveByDamageChanceProc(Unit* pVictim, uint32 d
{
    // The chance to dispel an aura depends on the damage taken with respect to the casters level.
    uint32 max_dmg = getLevel() > 8 ? 25 * getLevel() - 150 : 50;
+
+    // Also the chance depends on modifiers on the caster
+    if (Unit* caster = triggeredByAura->GetCaster())
+    {
+        AuraList const& mOverrideClassScript = caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+        for (AuraList::const_iterator itr = mOverrideClassScript.begin(); itr != mOverrideClassScript.end(); ++itr)
+            if ((*itr)->GetModifier()->m_miscvalue == 7801 && (*itr)->isAffectedOnSpell(triggeredByAura->GetSpellProto()))
+                max_dmg += (*itr)->GetModifier()->m_amount * max_dmg / 100;
+    }
+
    float chance = float(damage) / max_dmg * 100.0f;
    if (roll_chance_f(chance))
    {

Link to comment
Share on other sites

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