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

30 lines
757 B
Lua

-----------------------------------
-- ID: 15838
-- Item: Protect Earring
-- Item Effect: Protect
-----------------------------------
---@type TItem
local itemObject = {}
itemObject.onItemCheck = function(target, item, param, caster)
return 0
end
itemObject.onItemUse = function(target)
local power = 20
local tier = 1
local bonus = 0
if target:getMod(xi.mod.ENHANCES_PROT_SHELL_RCVD) > 0 then
bonus = 2 -- 2x Tier from MOD
end
power = power + (bonus * tier)
if target:addStatusEffect(xi.effect.PROTECT, power, 0, 1800, 0, 0, tier) then
target:messageBasic(xi.msg.basic.GAINS_EFFECT_OF_STATUS, xi.effect.PROTECT)
else
target:messageBasic(xi.msg.basic.NO_EFFECT)
end
end
return itemObject