[COLOR=#000000][COLOR=#0000BB]local combat [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]createCombatObject[/COLOR][COLOR=#007700]()
[/COLOR][COLOR=#0000BB]setCombatParam[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]combat[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]COMBAT_PARAM_EFFECT[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]CONST_ME_MAGIC_BLUE[/COLOR][COLOR=#007700])
[/COLOR][COLOR=#0000BB]setCombatParam[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]combat[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]COMBAT_PARAM_TARGETCASTERORTOPMOST[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700])
[/COLOR][COLOR=#0000BB]setCombatParam[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]combat[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]COMBAT_PARAM_AGGRESSIVE[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700])
function [/COLOR][COLOR=#0000BB]onCastSpell[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]cid[/COLOR][COLOR=#007700], var)
[/COLOR][COLOR=#0000BB]local mana [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]math[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]random[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]200[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]300[/COLOR][COLOR=#007700])
[/COLOR][COLOR=#0000BB]doPlayerAddMana[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]cid[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]mana[/COLOR][COLOR=#007700])
--[/COLOR][COLOR=#0000BB]doSendAnimatedText[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]getPlayerPosition[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]cid[/COLOR][COLOR=#007700]), [/COLOR][COLOR=#DD0000]'+' [/COLOR][COLOR=#007700].. [/COLOR][COLOR=#0000BB]mana[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]TEXTCOLOR_GOLD[/COLOR][COLOR=#007700])
return [/COLOR][COLOR=#0000BB]doCombat[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]cid[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]combat[/COLOR][COLOR=#007700], var)
[/COLOR][COLOR=#0000BB]end
-- Mana Rune - by Killavus. --
-- Feel free to edit! --
function onUse(cid, item, frompos, item2, topos)
local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
-- Exhausted Settings --
local exhausted_seconds = 1 -- How many seconds manarune will be unavailible to use. --
local exhausted_storagevalue = 7000 -- Storage Value to store exhaust. It MUST be unused! --
-- Exhausted Settings END --
-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 2) + (mlevel * 2) - 50
local mana_maximum = (level * 2) + (mlevel * 2)
-- Mana Formula Settings END --
local mana_add = math.random(mana_minimum, mana_maximum)
-- We check the charges. --
if(item.type > 1) then
-- Exhausted check. --
if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
-- Entity is player? --
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(frompos, CONST_ME_MAGIC_RED)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doChangeTypeItem(item.uid, item.type - 1)
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You can use this rune only on players.")
end
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
end
else
if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
else
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(frompos, CONST_ME_MAGIC_RED)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doRemoveItem(item.uid, 0)
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You can use this rune only on players.")
end
end
end
return 1