landsandboat/scripts/items/rabbit_cap.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

21 lines
592 B
Lua

-----------------------------------
-- ID: 26788
-- Item: Rabbit Cap
-- When used, you will obtain 1-2 random initial eggs
-----------------------------------
---@type TItem
local itemObject = {}
itemObject.onItemCheck = function(target, item, param, caster)
return xi.itemUtils.itemBoxOnItemCheck(target)
end
itemObject.onItemUse = function(target)
npcUtil.giveItem(target, { { math.random(xi.item.A_EGG, xi.item.Z_EGG), 1 } })
if math.random(1, 5) > 4 then
npcUtil.giveItem(target, { { math.random(xi.item.A_EGG, xi.item.Z_EGG), 1 } })
end
end
return itemObject