landsandboat/scripts/items/elixir.lua

30 lines
766 B
Lua
Raw Permalink Normal View History

2021-01-18 12:51:02 -05:00
-----------------------------------
2016-01-16 01:26:33 -05:00
-- ID: 4145
-- Item: Elixir
-- Item Effect: Instantly restores 25% of HP and MP
2021-01-18 12:51:02 -05:00
-----------------------------------
---@type TItem
local itemObject = {}
2016-01-16 01:26:33 -05:00
itemObject.onItemCheck = function(target, item, caster)
local result = 0
local mHP = target:getMaxHP()
local cHP = target:getHP()
local mMP = target:getMaxMP()
local cMP = target:getMP()
2016-01-16 01:26:33 -05:00
if mHP == cHP and mMP == cMP then
result = 56 -- Does not let player use item if their hp and mp are full
2017-01-04 20:52:03 -05:00
end
2016-01-16 01:26:33 -05:00
return result
end
2016-01-16 01:26:33 -05:00
itemObject.onItemUse = function(target)
target:addHP((target:getMaxHP() / 100) * 25)
target:addMP((target:getMaxMP() / 100) * 25)
2021-04-01 15:10:15 -04:00
target:messageBasic(xi.msg.basic.RECOVERS_HP_AND_MP)
end
2021-01-17 11:55:03 -05:00
return itemObject