landsandboat/scripts/items/jesters_hat.lua
claywar 6e4fa2af25
[type] Add type annotations to Item scripts
rename to reflect type definition

Annotate xi.itemUtils.foodOnItemCheck

Make TItemFood functions optional, since the definition does not include types
2024-08-24 18:25:26 -04:00

25 lines
581 B
Lua

-----------------------------------
-- ID: 11788
-- Item: Jester's Hat
-- Item Effect: Casts Cure II
-----------------------------------
---@type TItem
local itemObject = {}
itemObject.onItemCheck = function(target, item, param, caster)
return 0
end
itemObject.onItemUse = function(target)
local hpHeal = 90
local dif = target:getMaxHP() - target:getHP()
if hpHeal > dif then
hpHeal = dif
end
target:addHP(hpHeal)
target:updateEnmityFromCure(target, hpHeal)
target:messageBasic(xi.msg.basic.RECOVERS_HP, 0, hpHeal)
end
return itemObject