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

33 lines
898 B
Lua

-----------------------------------
-- ID: 4394
-- Item: ginger_cookie
-- Food Effect: 3Min, All Races
-----------------------------------
-- Magic Regen While Healing 5
-- Plantoid Killer 10
-- Slow Resist 10
-----------------------------------
---@type TItemFood
local itemObject = {}
itemObject.onItemCheck = function(target, item, param, caster)
return xi.itemUtils.foodOnItemCheck(target, xi.foodType.BASIC)
end
itemObject.onItemUse = function(target)
target:addStatusEffect(xi.effect.FOOD, 0, 0, 180, 4394)
end
itemObject.onEffectGain = function(target, effect)
target:addMod(xi.mod.MPHEAL, 5)
target:addMod(xi.mod.PLANTOID_KILLER, 10)
target:addMod(xi.mod.SLOWRES, 10)
end
itemObject.onEffectLose = function(target, effect)
target:delMod(xi.mod.MPHEAL, 5)
target:delMod(xi.mod.PLANTOID_KILLER, 10)
target:delMod(xi.mod.SLOWRES, 10)
end
return itemObject