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

28 lines
721 B
Lua

-----------------------------------
-- ID: 15542
-- Teleport Return Ring
-- Enchantment: "Outpost Warp"
-----------------------------------
---@type TItem
local itemObject = {}
itemObject.onItemCheck = function(target, item, param, caster)
local result = 0
local region = target:getCurrentRegion()
if
not xi.conq.canTeleportToOutpost(target, region) or
GetRegionOwner(region) ~= target:getNation()
then
result = xi.msg.basic.CANT_BE_USED_IN_AREA
end
return result
end
itemObject.onItemUse = function(target)
local region = target:getCurrentRegion()
target:addStatusEffectEx(xi.effect.TELEPORT, 0, xi.teleport.id.OUTPOST, 0, 4, 0, region)
end
return itemObject