28 lines
654 B
Lua
28 lines
654 B
Lua
-----------------------------------
|
|
-- ID: 14495
|
|
-- Item: Healing Harness
|
|
-- Item Effect: Restores 50-75 HP
|
|
-----------------------------------
|
|
---@type TItem
|
|
local itemObject = {}
|
|
|
|
itemObject.onItemCheck = function(target, item, caster)
|
|
if target:getHP() == target:getMaxHP() then
|
|
return xi.msg.basic.ITEM_UNABLE_TO_USE
|
|
end
|
|
|
|
return 0
|
|
end
|
|
|
|
itemObject.onItemUse = function(target)
|
|
local hpHeal = math.random(50, 75)
|
|
local dif = target:getMaxHP() - target:getHP()
|
|
if hpHeal > dif then
|
|
hpHeal = dif
|
|
end
|
|
|
|
target:addHP(hpHeal)
|
|
target:messageBasic(xi.msg.basic.RECOVERS_HP, 0, hpHeal)
|
|
end
|
|
|
|
return itemObject
|