All pastes #935270 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-03-09 14:30 UTC
rendered paste body
Index: src/game/Unit.cpp
===================================================================
--- src/game/Unit.cpp	(revision 5393)
+++ src/game/Unit.cpp	(working copy)
@@ -409,14 +410,16 @@
 }
 
 /* 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, uint32 casterLevel)
 {
     if(!HasAuraType(auraType))
         return;
 
     // The chance to dispell an aura depends on the damage taken with respect to the casters level.
     uint32 max_dmg = getLevel() > 8 ? 25 * getLevel() - 150 : 50;
-    float chance = float(damage) / max_dmg * 100.0f;
+    float chanceDamage = float(damage) / max_dmg * 100.0f * 0.67f;
+    float chanceLevel = float(casterLevel) / getLevel() * 100 * 0.33f;
+    float chance = chanceDamage + chanceLevel;
     if (roll_chance_f(chance))
         RemoveSpellsCausingAura(auraType);
 }
@@ -465,10 +468,10 @@
         return;
     }
 
-    pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_FEAR, damage);
+    pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_FEAR, damage, getLevel());
     // root type spells do not dispell the root effect
     if(!spellProto || spellProto->Mechanic != MECHANIC_ROOT)
-        pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_ROOT, damage);
+        pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_ROOT, damage, getLevel());
 
     if(pVictim->GetTypeId() != TYPEID_PLAYER)
     {
Index: src/game/Unit.h
===================================================================
--- src/game/Unit.h	(revision 5393)
+++ src/game/Unit.h	(working copy)
@@ -751,7 +752,7 @@
 
         bool isFrozen() const;
 
-        void RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage);
+        void RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage, uint32 casterLevel);
 
         bool isTargetableForAttack() const;
         virtual bool IsInWater() const;