Code: Select all
newTalent{
name = "Switch Place",
type = {"cunning/dirty", 3},
points = 5,
random_ego = "defensive",
cooldown = 10,
stamina = 15,
require = cuns_req3,
requires_target = true,
tactical = { DISABLE = 2 },
getDuration = function(self, t) return 1 + self:getTalentLevel(t) end,
action = function(self, t)
local tg = {type="hit", range=self:getTalentRange(t)}
local x, y, target = self:getTarget(tg)
if not x or not y or not target then return nil end
if core.fov.distance(self.x, self.y, x, y) > 1 then return nil end
local tx, ty, sx, sy = target.x, target.y, self.x, self.y
local hitted = self:attackTarget(target, nil, 0, true)
if hitted and not self.dead then
self:setEffect(self.EFF_EVASION, t.getDuration(self, t), {chance=50})
-- Displace
-- if not target.dead then
if not target.dead and target.x == tx and target.y == ty then -- EXTRA CHECK
self.x = nil self.y = nil
self:move(tx, ty, true)
target.x = nil target.y = nil
target:move(sx, sy, true)
end
end
return true
end,
info = function(self, t)
local duration = t.getDuration(self, t)
return ([[Using a series of tricks and maneuvers, you switch places with your target.
Switching places will confuse your foes, granting you evasion(50%%) for %d turns.
While switching places your weapon(s) will connect with the target, not damaging it but on hit effects can trigger.]]):
format(duration)
end,
}