local LVL_CRIT_STORAGE = 48904
local MULTIPLIER = 1.001
function onStatsChange(cid, attacker, type, combat, value)
if type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS then
if isPlayer(attacker) and isCreature(cid) then
local playerLvlCrit = getPlayerStorageValue(attacker, LVL_CRIT_STORAGE)
local critThreshold = playerLvlCrit * 3
local randomValue = math.random(0, 1000)
if critThreshold >= randomValue then
local boostedDamage = math.ceil(value * (MULTIPLIER - 1)) -- Subtrair 1 para obter o valor percentual
doTargetCombatHealth(attacker, cid, combat, -boostedDamage, -boostedDamage, boostedDamage)
-- Verifique se o atacante é uma criatura antes de obter sua posição
if isCreature(attacker) then
doSendAnimatedText(getCreaturePos(attacker), "+BOOSTER", 1000)
end
return false
end
end
end
return true
end