landsandboat/scripts/items/magic_slacks.lua

29 lines
651 B
Lua
Raw Permalink Normal View History

2021-01-18 12:51:02 -05:00
-----------------------------------
-- ID: 15372
-- Item: Magic Slacks
-- Item Effect: Restores 30-39 MP
2021-01-18 12:51:02 -05:00
-----------------------------------
---@type TItem
local itemObject = {}
itemObject.onItemCheck = function(target, item, caster)
if target:getMP() == target:getMaxMP() then
2021-04-01 15:10:15 -04:00
return xi.msg.basic.ITEM_UNABLE_TO_USE
2017-11-11 00:34:58 -05:00
end
return 0
end
itemObject.onItemUse = function(target)
local mpHeal = math.random(30, 40)
local dif = target:getMaxMP() - target:getMP()
if mpHeal > dif then
mpHeal = dif
end
target:addMP(mpHeal)
2021-04-01 15:10:15 -04:00
target:messageBasic(xi.msg.basic.RECOVERS_MP, 0, mpHeal)
end
2021-01-17 11:55:03 -05:00
return itemObject