From ed3a765128bdec304ecd59ac3a6ea389af73eb8b Mon Sep 17 00:00:00 2001
From: Eric Wykoff <ericwykoff@yahoo.com>
Date: Fri, 23 Jan 2015 17:20:37 -0600
Subject: [PATCH] fix threadwalk (thanks electronicru)

---
 .../data/talents/chronomancy/threaded-combat.lua  | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/game/modules/tome/data/talents/chronomancy/threaded-combat.lua b/game/modules/tome/data/talents/chronomancy/threaded-combat.lua
index 0b04757785..65aee35855 100644
--- a/game/modules/tome/data/talents/chronomancy/threaded-combat.lua
+++ b/game/modules/tome/data/talents/chronomancy/threaded-combat.lua
@@ -24,7 +24,7 @@ newTalent{
 	type = {"chronomancy/threaded-combat", 1},
 	require = chrono_req_high1,
 	points = 5,
-	cooldown = 6,
+	--cooldown = 6,
 	paradox = function (self, t) return getParadoxCost(self, t, 10) end,
 	tactical = { ATTACK = {weapon = 2}, CLOSEIN = 2, ESCAPE = 2 },
 	requires_target = true,
@@ -66,16 +66,15 @@ newTalent{
 				
 			if hitted then
 				-- Find our teleport location
-				local block_move = function(_, bx, by) return game.level.map:checkEntity(bx, by, Map.TERRAIN, "block_move", self) end
-				local l = core.fov.line(x, y, self.x, self.y, block_move, true)
-				local lx, ly, is_corner_blocked = l:step(true)
+				local dist = t.getTeleportRange(self, t) / core.fov.distance(x, y, self.x, self.y)
+				local destx, desty = math.floor((self.x - x) * dist + x), math.floor((self.y - y) * dist + y)
+				local l = core.fov.line(x, y, destx, desty, false)
+				local lx, ly, is_corner_blocked = l:step()
 				local ox, oy
-				local dist = t.getTeleportRange(self, t) - 1
 				
-				while game.level.map:isBound(lx, ly) and not is_corner_blocked and dist > 0 do
-					dist = dist - 1
+				while game.level.map:isBound(lx, ly) and not game.level.map:checkEntity(lx, ly, Map.TERRAIN, "block_move") and not is_corner_blocked do
 					if not game.level.map(lx, ly, Map.ACTOR) then ox, oy = lx, ly end
-					lx, ly, is_corner_blocked = l:step(true)
+					lx, ly, is_corner_blocked = l:step()
 				end
 				
 				game.level.map:particleEmitter(self.x, self.y, 1, "temporal_teleport")
-- 
GitLab