Jump to content

[fix] Glyph of Fear and Glyph of Entangling Roots


Guest DonTomika

Recommended Posts

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

This patch implements two glyph spells: Glyph of Fear and Glyph of Entangling Roots.

For which repository revision was the patch created?

7842

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

Didn't find any.

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 7f150e1..f6f56e5 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -355,13 +355,31 @@ bool Unit::HasAuraType(AuraType auraType) const
}

/* Called by DealDamage for auras that have a chance to be dispelled on damage taken. */
-void Unit::RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage)
+void Unit::RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage, Unit *pCaster)
{
+    if (!pCaster)
+        return;
+
    if(!HasAuraType(auraType))
        return;

    // 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;
+    uint32 max_dmg = pCaster->getLevel() > 8 ? 25 * getLevel() - 150 : 50;
+
+    // Glyph of Fear and Glyph of Entangling Roots bonus
+    if (pCaster->GetTypeId() == TYPEID_PLAYER)
+    {
+        AuraList const& m_OverrideClassScript = pCaster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+        for (AuraList::const_iterator citr = m_OverrideClassScript.begin(); citr != m_OverrideClassScript.end(); ++citr)
+        {
+            if ((*citr)->GetModifier()->m_miscvalue == 7801)
+            {
+                max_dmg = int32(max_dmg * (100.0f + (*citr)->GetModifier()->m_amount) / 100.0f);
+                break;
+            }
+        }
+    }
+
    float chance = float(damage) / max_dmg * 100.0f;
    if (roll_chance_f(chance))
        RemoveSpellsCausingAura(auraType);
@@ -431,10 +449,10 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
        return 0;
    }
    if (!spellProto || !IsAuraAddedBySpell(SPELL_AURA_MOD_FEAR, spellProto->Id))
-        pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_FEAR, damage);
+        pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_FEAR, damage, this);
    // root type spells do not dispel the root effect
    if (!spellProto || !(spellProto->Mechanic == MECHANIC_ROOT || IsAuraAddedBySpell(SPELL_AURA_MOD_ROOT, spellProto->Id)))
-        pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_ROOT, damage);
+        pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_ROOT, damage, this);

    // no xp,health if type 8 /critters/
    if(pVictim->GetTypeId() != TYPEID_PLAYER && pVictim->GetCreatureType() == CREATURE_TYPE_CRITTER)
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 35ceb2f..c3cc85f 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1042,7 +1042,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject

        bool isFrozen() const;

-        void RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage);
+        void RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage, Unit *pCaster);

        bool isTargetableForAttack() const;
        virtual bool IsInWater() const;

Link to comment
Share on other sites

  • 2 weeks later...

RemoveSpellsByDamageTaken is outdated, on retail it always breaks on fixed amount of damage ( much like damage absorbtion shields ). This is done that way to smite "Fear and dots" rotations. Amount of damage it can take is based on base health of target. This aura should increase that number as well as getting this thing moved to procs ( to be honest, not all root/fear auras should break on damage ).

Link to comment
Share on other sites

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