// Ok first off, Roots and Fear have a chance to break based on the damage
// caused by each direct damage run.
// Roots can never be broken by the roots DoT either
// so first off is the function for determining the chance and aura
// removal
void Unit::RemoveSpellbyDamageTaken(uint32 auraType, uint32 damage)
{
if(!HasAuraType(auraType))
return;
float rel_dmg = (float)damage / GetMaxHealth();
// <- damage over 75% of max health is a definite removal of aura
if (roll_chance_f(rel_dmg / 0.75 * 100.0))
RemoveSpellsCausingAura(auraType);
}
// and then in the deal damage function
pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_FEAR, damage);
if(!spellProto || spellProto->Mechanic != MECHANIC_ROOT)
pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_ROOT, damage);