landsandboat/scripts/items/homing_ring.lua

28 lines
772 B
Lua

-----------------------------------
-- ID: 15541
-- Teleport Homing Ring
-- Enchantment: "Outpost Warp"
-----------------------------------
---@type TItem
local itemObject = {}
itemObject.onItemCheck = function(target, item, caster)
local result = 0
local region = target:getCurrentRegion()
if
not xi.conquest.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, user)
local region = target:getCurrentRegion()
target:addStatusEffect(xi.effect.TELEPORT, { power = xi.teleport.id.OUTPOST, duration = 4, origin = user, icon = 0, subPower = region })
end
return itemObject