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

26 lines
828 B
Lua

-----------------------------------
-- ID: 15817
-- Item: Ecphoria Ring
-- Item Effect: This item remedies amnesia.
-----------------------------------
---@type TItem
local itemObject = {}
itemObject.onItemCheck = function(target, item, param, caster)
return 0
end
itemObject.onItemUse = function(target)
local statusEffect = xi.effect.AMNESIA
if target:hasStatusEffect(statusEffect) then
local effectSubPower = target:getStatusEffect(statusEffect):getSubPower()
-- If the amnesia is too strong, do not remove it. By default this would be zero allowing removal.
-- (Ladybugs, Rafflesia, Promathia, certain NMs, low chance vs Disorienting Waul)
if effectSubPower < math.random(1, 100) then
target:delStatusEffect(statusEffect)
end
end
end
return itemObject