testa esse
function onCastSpell(cid)
local formula = getPlayerLevel(cid) * getPlayerMagLevel(cid)
local target = getCreatureTarget(cid)
if target < 1 then
doPlayerSendCancel(cid, "You need a target.")
return false
end
if isPlayer(target) then
formula = formula / getPlayerLevel(target)
else
formula = formula / 15
end
local stealPercent = formula / 100 * 20
doCreatureAddHealth(cid, stealPercent)
doSendAnimatedText(getThingPos(cid), "+" .. stealPercent, 25)
doSendDistanceShoot(getThingPos(cid), getThingPos(target), 15)
doAreaCombatHealth(cid, COMBAT_PHYSICALDAMAGE, getThingPos(target), 0, - formula, - formula * 0.5, CONST_ME_MAGIC_RED)
return true
end