Untitled
unknown
lua
2 years ago
905 B
11
Indexable
local criticalStorage = 48913
local criticalMultiplier = 1.20
local creature = {}
function onStatsChange(cid, attacker, type, combat, value)
if creature[cid] then
creature[cid] = nil
return true
end
creature[cid] = 1
if not isPlayer(attacker) or attacker == cid or (type ~= STATSCHANGE_HEALTHLOSS and type ~= STATSCHANGE_MANALOSS) then
return true
end
local critLevel = math.max(0, tonumber(getPlayerStorageValue(attacker, criticalStorage)) or 0)
if critLevel == 0 then
return true
end
if critLevel * 3 >= math.random(1000) then
local damage = math.floor(value * criticalMultiplier) * 2
doTargetCombatHealth(attacker, cid, combat, -damage, -damage, 255)
doSendAnimatedText(getCreaturePos(attacker), "Critical", 198)
return false
end
return true
endEditor is loading...
Leave a Comment