From 8d9365dfddc12d1e65555f5e653d9511a1212816 Mon Sep 17 00:00:00 2001
From: DarkGod <darkgod@net-core.org>
Date: Sat, 8 Apr 2017 12:50:04 +0200
Subject: [PATCH] Fixed Infestation's carrion worms poping over npcs/you
 sometimes

---
 game/modules/tome/data/talents/corruptions/rot.lua | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/game/modules/tome/data/talents/corruptions/rot.lua b/game/modules/tome/data/talents/corruptions/rot.lua
index 6b54fd2e1d..8f3095a51b 100644
--- a/game/modules/tome/data/talents/corruptions/rot.lua
+++ b/game/modules/tome/data/talents/corruptions/rot.lua
@@ -197,16 +197,9 @@ newTalent{
 			if not self.turn_procs.infestation then
 				self.turn_procs.infestation = true
 				
-				local nb = 0
-
-				local grids = {}
-				self:project({type="ball", range=0, radius=2, talent=t}, self.x, self.y, function(px, py)
-					if not ((px == x and py == y) or game.level.map:checkEntity(px, py, Map.TERRAIN, "block_move") or game.level.map(px, py, Map.TRAP)) then grids[#grids+1] = {x=px, y=py} end
-				end)
-		
-				local g = rng.tableRemove(grids)
-				if g then 
-					carrionworm(self, self, 5, g.x, g.y)
+				local gx, gy = util.findFreeGrid(self.x, self.y, 2, true, {[Map.ACTOR]=true})
+				if gx and gy then 
+					carrionworm(self, self, 5, gx, gy)
 				end
 			end
 			return cb.value
-- 
GitLab