From 6fda9a3c619957a43efe8aabe79f4963f40128d1 Mon Sep 17 00:00:00 2001
From: DarkGod <darkgod@net-core.org>
Date: Mon, 5 May 2014 02:01:50 +0200
Subject: [PATCH] fix some globals & such. bad shibari bad !

---
 game/modules/tome/class/interface/Combat.lua         |  3 +--
 .../tome/data/general/objects/egos/staves.lua        |  3 ++-
 .../tome/data/general/objects/world-artifacts.lua    |  2 +-
 .../modules/tome/data/talents/celestial/twilight.lua |  2 +-
 .../data/talents/chronomancy/spacetime-weaving.lua   |  2 +-
 .../data/talents/chronomancy/timeline-threading.lua  |  2 +-
 .../tome/data/talents/cunning/called-shots.lua       |  2 +-
 .../tome/data/talents/cursed/endless-hunt.lua        |  3 ++-
 game/modules/tome/data/talents/cursed/gloom.lua      |  4 ----
 .../modules/tome/data/talents/cursed/punishments.lua |  3 ---
 game/modules/tome/data/talents/cursed/shadows.lua    |  2 +-
 game/modules/tome/data/talents/cursed/slaughter.lua  |  8 ++++----
 game/modules/tome/data/talents/gifts/mucus.lua       |  2 +-
 game/modules/tome/data/talents/misc/inscriptions.lua |  2 +-
 game/modules/tome/data/talents/misc/npcs.lua         |  4 +---
 game/modules/tome/data/talents/misc/objects.lua      |  4 ++--
 game/modules/tome/data/talents/psionic/other.lua     |  2 +-
 .../modules/tome/data/talents/psionic/possession.lua |  2 +-
 .../modules/tome/data/talents/psionic/projection.lua |  1 -
 .../tome/data/talents/psionic/psi-archery.lua        |  2 +-
 game/modules/tome/data/talents/spells/air.lua        |  1 -
 game/modules/tome/data/talents/spells/divination.lua |  2 +-
 .../tome/data/talents/techniques/finishing-moves.lua | 12 +++---------
 .../tome/data/talents/techniques/pugilism.lua        |  7 ++-----
 .../talents/techniques/strength-of-the-berserker.lua |  2 +-
 .../data/talents/techniques/unarmed-discipline.lua   |  4 +---
 26 files changed, 31 insertions(+), 52 deletions(-)

diff --git a/game/modules/tome/class/interface/Combat.lua b/game/modules/tome/class/interface/Combat.lua
index 1bc9f109b2..f751bf6906 100644
--- a/game/modules/tome/class/interface/Combat.lua
+++ b/game/modules/tome/class/interface/Combat.lua
@@ -1811,7 +1811,6 @@ end
 --- Gets damage based on talent, stat, and interval
 function _M:combatStatTalentIntervalDamage(t, stat, min, max, stat_weight)
 	local stat_weight = stat_weight or 0.5
-	scaled_stat = self[stat](self)
 	return self:rescaleDamage(min + (max - min)*((stat_weight * self[stat](self)/100) + (1 - stat_weight) * self:getTalentLevel(t)/6.5))
 end
 
@@ -2258,7 +2257,7 @@ end
 
 -- grapple size check; compares attackers size and targets size
 function _M:grappleSizeCheck(target)
-	size = target.size_category - self.size_category
+	local size = target.size_category - self.size_category
 	if size > 1 then
 		self:logCombat(target, "#Source#'s grapple fails because #Target# is too big!")
 		return true
diff --git a/game/modules/tome/data/general/objects/egos/staves.lua b/game/modules/tome/data/general/objects/egos/staves.lua
index 73a79003bd..d9460eeea9 100644
--- a/game/modules/tome/data/general/objects/egos/staves.lua
+++ b/game/modules/tome/data/general/objects/egos/staves.lua
@@ -256,6 +256,7 @@ newEntity{
 				return
 			end
 			local combat = weapon.combat
+			local explosion, particle, trail
 
 			local DamageType = require "engine.DamageType"
 			local damtype = combat.damtype
@@ -281,7 +282,7 @@ newEntity{
 			dam = rng.range(dam, dam * damrange)
 			dam = who:spellCrit(dam)
 
-			who:projectile(tg, x, y, damtype, dam, {type=explosion})
+			who:projectile(tg, x, y, damtype, dam, {type=explosion, particle=particle, trail=trail})
 
 			game.logSeen(who, "%s fires a bolt from %s!", who.name:capitalize(), self.name)
 			game:playSoundNear(who, "talents/arcane")
diff --git a/game/modules/tome/data/general/objects/world-artifacts.lua b/game/modules/tome/data/general/objects/world-artifacts.lua
index 62d2dc3731..950323fdea 100644
--- a/game/modules/tome/data/general/objects/world-artifacts.lua
+++ b/game/modules/tome/data/general/objects/world-artifacts.lua
@@ -3637,7 +3637,7 @@ newEntity{ base = "BASE_LEATHER_BOOT", --Thanks Grayswandir!
 	use_power = { name = "phase door in range 6, radius 2", power = 24,
 		use = function(self, who)
 			local tg = {type="ball", nolock=true, pass_terrain=true, nowarning=true, range=6, radius=2, requires_knowledge=false}
-			x, y = who:getTarget(tg)
+			local x, y = who:getTarget(tg)
 			if not x then return nil end
 			-- Target code does not restrict the target coordinates to the range, it lets the project function do it
 			-- but we cant ...
diff --git a/game/modules/tome/data/talents/celestial/twilight.lua b/game/modules/tome/data/talents/celestial/twilight.lua
index 4fa2205251..d8b788cec6 100644
--- a/game/modules/tome/data/talents/celestial/twilight.lua
+++ b/game/modules/tome/data/talents/celestial/twilight.lua
@@ -216,7 +216,7 @@ newTalent{
 			return
 		end
 
-		allowed = 2 + math.ceil(self:getTalentLevelRaw(t) / 2 )
+		local allowed = 2 + math.ceil(self:getTalentLevelRaw(t) / 2 )
 
 		if target.rank >= 3.5 or -- No boss
 			target:reactionToward(self) >= 0 or -- No friends
diff --git a/game/modules/tome/data/talents/chronomancy/spacetime-weaving.lua b/game/modules/tome/data/talents/chronomancy/spacetime-weaving.lua
index a95babc6f9..3fbf1fb201 100644
--- a/game/modules/tome/data/talents/chronomancy/spacetime-weaving.lua
+++ b/game/modules/tome/data/talents/chronomancy/spacetime-weaving.lua
@@ -184,7 +184,7 @@ newTalent{
 		end
 		if #poss == 0 then game.logPlayer(self, "No exit location could be found.")	return false end
 		local pos = poss[rng.range(1, #poss)]
-		exit_x, exit_y = pos[1], pos[2]
+		local exit_x, exit_y = pos[1], pos[2]
 		print("[[wormhole]] entrance ", entrance_x, " :: ", entrance_y)
 		print("[[wormhole]] exit ", exit_x, " :: ", exit_y)
 
diff --git a/game/modules/tome/data/talents/chronomancy/timeline-threading.lua b/game/modules/tome/data/talents/chronomancy/timeline-threading.lua
index 932f2aeb30..c31541d716 100644
--- a/game/modules/tome/data/talents/chronomancy/timeline-threading.lua
+++ b/game/modules/tome/data/talents/chronomancy/timeline-threading.lua
@@ -108,7 +108,7 @@ newTalent{
 			return
 		end
 
-		allowed = t.getSize(self, t)
+		local allowed = t.getSize(self, t)
 
 		if target.rank >= 3.5 or -- No boss
 			target:reactionToward(self) >= 0 or -- No friends
diff --git a/game/modules/tome/data/talents/cunning/called-shots.lua b/game/modules/tome/data/talents/cunning/called-shots.lua
index 2e80830e8e..dc985affe6 100644
--- a/game/modules/tome/data/talents/cunning/called-shots.lua
+++ b/game/modules/tome/data/talents/cunning/called-shots.lua
@@ -235,7 +235,7 @@ newTalent {
 	no_energy = "fake",
 	mode = "passive",
 	info = function(self, t)
-	bonuses = sniper_bonuses(self, true)
+		local bonuses = sniper_bonuses(self, true)
 		return ([[Your mastery of called shots is unparalleled. Gain %d%% bonus critical chance and %d%% critical damage on your Called Shots. At rank 3 lowers the cooldowns of your Called Shots by 2 each. At rank 5 gain %d%% physical resist piercing with all Called Shot attacks.]])
 		:format(bonuses.crit_chance,
 			bonuses.crit_power * 100,
diff --git a/game/modules/tome/data/talents/cursed/endless-hunt.lua b/game/modules/tome/data/talents/cursed/endless-hunt.lua
index b2ded74824..b9e62c77b2 100644
--- a/game/modules/tome/data/talents/cursed/endless-hunt.lua
+++ b/game/modules/tome/data/talents/cursed/endless-hunt.lua
@@ -41,7 +41,8 @@ newTalent{
 	getDuration = function(self, t)
 		return 40
 	end,
-	getHitHateChange = function(self, t, bonus)Patbonus = math.min(bonus, 3)
+	getHitHateChange = function(self, t, bonus)
+		bonus = math.min(bonus, 3)
 		return 0.5 * bonus
 	end,
 	getAttackChange = function(self, t, bonus)
diff --git a/game/modules/tome/data/talents/cursed/gloom.lua b/game/modules/tome/data/talents/cursed/gloom.lua
index 68cd723749..ca1913455f 100644
--- a/game/modules/tome/data/talents/cursed/gloom.lua
+++ b/game/modules/tome/data/talents/cursed/gloom.lua
@@ -87,19 +87,16 @@ newTalent{
 							-- confusion
 							if target:canBe("confusion") and not target:hasEffect(target.EFF_GLOOM_CONFUSED) then
 								target:setEffect(target.EFF_GLOOM_CONFUSED, 2, {power=70})
-								hit = true
 							end
 						elseif effect == 2 then
 							-- stun
 							if target:canBe("stun") and not target:hasEffect(target.EFF_GLOOM_STUNNED) then
 								target:setEffect(target.EFF_GLOOM_STUNNED, 2, {})
-								hit = true
 							end
 						elseif effect == 3 then
 							-- slow
 							if target:canBe("slow") and not target:hasEffect(target.EFF_GLOOM_SLOW) then
 								target:setEffect(target.EFF_GLOOM_SLOW, 2, {power=0.3})
-								hit = true
 							end
 						end
 					end
@@ -111,7 +108,6 @@ newTalent{
 							local incDamageChange = tWeakness.getIncDamageChange(self, tWeakness)
 							local hateBonus = tWeakness.getHateBonus(self, tWeakness)
 							target:setEffect(target.EFF_GLOOM_WEAKNESS, duration, {incDamageChange=incDamageChange,hateBonus=hateBonus})
-							hit = true
 						end
 					end
 
diff --git a/game/modules/tome/data/talents/cursed/punishments.lua b/game/modules/tome/data/talents/cursed/punishments.lua
index 85f09c5075..c19b7fc466 100644
--- a/game/modules/tome/data/talents/cursed/punishments.lua
+++ b/game/modules/tome/data/talents/cursed/punishments.lua
@@ -322,19 +322,16 @@ newTalent{
 				-- confusion
 				if target:canBe("confusion") and not target:hasEffect(target.EFF_MADNESS_CONFUSED) then
 					target:setEffect(target.EFF_MADNESS_CONFUSED, 3, {power=50, mindResistChange=mindResistChange}) -- Consistent with other confusion
-					hit = true
 				end
 			elseif effect == 2 then
 				-- stun
 				if target:canBe("stun") and not target:hasEffect(target.EFF_MADNESS_STUNNED) then
 					target:setEffect(target.EFF_MADNESS_STUNNED, 3, {mindResistChange=mindResistChange})
-					hit = true
 				end
 			elseif effect == 3 then
 				-- slow
 				if target:canBe("slow") and not target:hasEffect(target.EFF_MADNESS_SLOW) then
 					target:setEffect(target.EFF_MADNESS_SLOW, 3, {power=0.3, mindResistChange=mindResistChange})
-					hit = true
 				end
 			end
 		end
diff --git a/game/modules/tome/data/talents/cursed/shadows.lua b/game/modules/tome/data/talents/cursed/shadows.lua
index 2dd35a1ebf..f36b4799d0 100644
--- a/game/modules/tome/data/talents/cursed/shadows.lua
+++ b/game/modules/tome/data/talents/cursed/shadows.lua
@@ -391,7 +391,7 @@ newTalent{
 		end
 		self:incHate(-6)
 
-		level = t.getLevel(self, t)
+		local level = t.getLevel(self, t)
 		local tShadowWarriors = self:knowTalent(self.T_SHADOW_WARRIORS) and self:getTalentFromId(self.T_SHADOW_WARRIORS) or nil
 		local tShadowMages = self:knowTalent(self.T_SHADOW_MAGES) and self:getTalentFromId(self.T_SHADOW_MAGES) or nil
 
diff --git a/game/modules/tome/data/talents/cursed/slaughter.lua b/game/modules/tome/data/talents/cursed/slaughter.lua
index 0ae43c5210..6596840224 100644
--- a/game/modules/tome/data/talents/cursed/slaughter.lua
+++ b/game/modules/tome/data/talents/cursed/slaughter.lua
@@ -329,8 +329,8 @@ newTalent{
 		return true
 	end,
 	on_attackTarget = function(self, t, target)
-		if inCleave then return end
-		inCleave = true
+		if self.inCleave then return end
+		self.inCleave = true
 
 		local chance = t.getChance(self, t)
 		if rng.percent(chance) then
@@ -343,12 +343,12 @@ newTalent{
 					local damageMultiplier = t.getDamageMultiplier(self, t)
 					self:logCombat(secondTarget, "#Source# cleaves through #Target#!")
 					self:attackTarget(secondTarget, nil, damageMultiplier, true)
-					inCleave = false
+					self.inCleave = false
 					return
 				end
 			end
 		end
-		inCleave = false
+		self.inCleave = false
 	end,
 	info = function(self, t)
 		local chance = t.getChance(self, t, 0)
diff --git a/game/modules/tome/data/talents/gifts/mucus.lua b/game/modules/tome/data/talents/gifts/mucus.lua
index 0d8dade30d..a4b97c331a 100644
--- a/game/modules/tome/data/talents/gifts/mucus.lua
+++ b/game/modules/tome/data/talents/gifts/mucus.lua
@@ -285,7 +285,7 @@ newTalent{
 	end,
 	action = function(self, t)
 		local tg = {type="hit", nolock=true, pass_terrain=true, nowarning=true, range=self:getTalentRange(t), requires_knowledge=false}
-		x, y = self:getTarget(tg)
+		local x, y = self:getTarget(tg)
 		if not x then return nil end
 		-- Target code does not restrict the target coordinates to the range, it lets the project function do it
 		-- but we cant ...
diff --git a/game/modules/tome/data/talents/misc/inscriptions.lua b/game/modules/tome/data/talents/misc/inscriptions.lua
index cdec817fd8..decffa4ca3 100644
--- a/game/modules/tome/data/talents/misc/inscriptions.lua
+++ b/game/modules/tome/data/talents/misc/inscriptions.lua
@@ -470,7 +470,7 @@ newInscription{
 	action = function(self, t)
 		local data = self:getInscriptionData(t.short_name)
 		local tg = {type="ball", nolock=true, pass_terrain=true, nowarning=true, range=data.range + data.inc_stat, radius=3, requires_knowledge=false}
-		x, y = self:getTarget(tg)
+		local x, y = self:getTarget(tg)
 		if not x then return nil end
 		-- Target code does not restrict the target coordinates to the range, it lets the project function do it
 		-- but we cant ...
diff --git a/game/modules/tome/data/talents/misc/npcs.lua b/game/modules/tome/data/talents/misc/npcs.lua
index 41ea8c596c..52e7866942 100644
--- a/game/modules/tome/data/talents/misc/npcs.lua
+++ b/game/modules/tome/data/talents/misc/npcs.lua
@@ -2091,9 +2091,7 @@ newTalent{
 		if core.fov.distance(self.x, self.y, x, y) > 1 then return nil end
 
 		-- breaks active grapples if the target is not grappled
-		if target:isGrappled(self) then
-			grappled = true
-		else
+		if not target:isGrappled(self) then
 			self:breakGrapples()
 		end
 
diff --git a/game/modules/tome/data/talents/misc/objects.lua b/game/modules/tome/data/talents/misc/objects.lua
index 0e852182d4..4cf2019d20 100644
--- a/game/modules/tome/data/talents/misc/objects.lua
+++ b/game/modules/tome/data/talents/misc/objects.lua
@@ -313,8 +313,8 @@ newTalent{
 		local tg = self:getTalentTarget(t)
 		local x, y, target = self:getTarget(tg)
 		if not x or not y then return nil end
-		dispower = t.getpower(self,t)
-		dismax = t.maxpower(self, t)
+		local dispower = t.getpower(self,t)
+		local dismax = t.maxpower(self, t)
 		self:project(tg, x, y, function(px, py)
 			target:setEffect(target.EFF_SPELL_DISRUPTION, 8, {src=self, power = dispower, max = dismax, apply_power=self:combatMindpower()})
 			if rng.percent(30) and self:getTalentLevel(t)>2 then
diff --git a/game/modules/tome/data/talents/psionic/other.lua b/game/modules/tome/data/talents/psionic/other.lua
index 2c7bb6662f..d2ffce420e 100644
--- a/game/modules/tome/data/talents/psionic/other.lua
+++ b/game/modules/tome/data/talents/psionic/other.lua
@@ -133,7 +133,7 @@ newTalent{
 						hit = hit or h
 						if hit and not sound then sound = o.combat.sound
 						elseif not hit and not sound_miss then sound_miss = o.combat.sound_miss end
---FIXME						if not o.combat.no_stealth_break then break_stealth = true end
+						if not o.combat.no_stealth_break then self:breakStealth() end
 						self:breakStepUp()
 					end
 				end
diff --git a/game/modules/tome/data/talents/psionic/possession.lua b/game/modules/tome/data/talents/psionic/possession.lua
index 8b2f92096a..a59d3a6bdf 100644
--- a/game/modules/tome/data/talents/psionic/possession.lua
+++ b/game/modules/tome/data/talents/psionic/possession.lua
@@ -40,7 +40,7 @@ newTalent{
 		local tx, ty = self:getTarget(tg)
 		if not tx or not ty then return nil end
 		local _ _, tx, ty = self:canProject(tg, tx, ty)
-		target = game.level.map(tx, ty, Map.ACTOR)
+		local target = game.level.map(tx, ty, Map.ACTOR)
 		if not target or target == self then return nil end
 
 		if target == self.summoner then
diff --git a/game/modules/tome/data/talents/psionic/projection.lua b/game/modules/tome/data/talents/psionic/projection.lua
index aef9543060..33449dd5d5 100644
--- a/game/modules/tome/data/talents/psionic/projection.lua
+++ b/game/modules/tome/data/talents/psionic/projection.lua
@@ -397,7 +397,6 @@ newTalent{
 			print("[Chain lightning] targetting", fx, fy, "from", self.x, self.y)
 			local actor = game.level.map(dx, dy, Map.ACTOR)
 			if actor and not affected[actor] then
-				ignored = false
 				affected[actor] = true
 				first = actor
 
diff --git a/game/modules/tome/data/talents/psionic/psi-archery.lua b/game/modules/tome/data/talents/psionic/psi-archery.lua
index c51700059f..9d667f88db 100644
--- a/game/modules/tome/data/talents/psionic/psi-archery.lua
+++ b/game/modules/tome/data/talents/psionic/psi-archery.lua
@@ -192,7 +192,7 @@ newTalent{
 						--hit = hit or h
 						--if hit and not sound then sound = o.combat.sound
 						--elseif not hit and not sound_miss then sound_miss = o.combat.sound_miss end
-						if not o.combat.no_stealth_break then break_stealth = true end
+						if not o.combat.no_stealth_break then self:breakStealth() end
 						self:breakStepUp()
 					end
 				end
diff --git a/game/modules/tome/data/talents/spells/air.lua b/game/modules/tome/data/talents/spells/air.lua
index b2c7e0cf8e..3905349e67 100644
--- a/game/modules/tome/data/talents/spells/air.lua
+++ b/game/modules/tome/data/talents/spells/air.lua
@@ -84,7 +84,6 @@ newTalent{
 			print("[Chain lightning] targetting", fx, fy, "from", self.x, self.y)
 			local actor = game.level.map(dx, dy, Map.ACTOR)
 			if actor and not affected[actor] then
-				ignored = false
 				affected[actor] = true
 				first = actor
 
diff --git a/game/modules/tome/data/talents/spells/divination.lua b/game/modules/tome/data/talents/spells/divination.lua
index faa4938401..bc48fe834f 100644
--- a/game/modules/tome/data/talents/spells/divination.lua
+++ b/game/modules/tome/data/talents/spells/divination.lua
@@ -31,7 +31,7 @@ newTalent{
 	getRadius = function(self, t) return math.floor(self:combatTalentScale(t, 5, 9)) end,
 	action = function(self, t)
 		local tg = {type="hit", nolock=true, pass_terrain=true, nowarning=true, range=100, requires_knowledge=false}
-		x, y = self:getTarget(tg)
+		local x, y = self:getTarget(tg)
 		if not x then return nil end
 		-- Target code does not restrict the target coordinates to the range, it lets the project function do it
 		-- but we cant ...
diff --git a/game/modules/tome/data/talents/techniques/finishing-moves.lua b/game/modules/tome/data/talents/techniques/finishing-moves.lua
index b39b97de9d..c25f68d783 100644
--- a/game/modules/tome/data/talents/techniques/finishing-moves.lua
+++ b/game/modules/tome/data/talents/techniques/finishing-moves.lua
@@ -38,9 +38,7 @@ newTalent{
 		if core.fov.distance(self.x, self.y, x, y) > 1 then return nil end
 
 		-- breaks active grapples if the target is not grappled
-		if target:isGrappled(self) then
-			grappled = true
-		else
+		if not target:isGrappled(self) then
 			self:breakGrapples()
 		end
 
@@ -93,9 +91,7 @@ newTalent{
 		if core.fov.distance(self.x, self.y, x, y) > 1 then return nil end
 
 		-- breaks active grapples if the target is not grappled
-		if target:isGrappled(self) then
-			grappled = true
-		else
+		if not target:isGrappled(self) then
 			self:breakGrapples()
 		end
 
@@ -215,9 +211,7 @@ newTalent{
 		if core.fov.distance(self.x, self.y, x, y) > 1 then return nil end
 
 		-- breaks active grapples if the target is not grappled
-		if target:isGrappled(self) then
-			grappled = true
-		else
+		if not target:isGrappled(self) then
 			self:breakGrapples()
 		end
 
diff --git a/game/modules/tome/data/talents/techniques/pugilism.lua b/game/modules/tome/data/talents/techniques/pugilism.lua
index 45cd64fc9d..4fbb543520 100644
--- a/game/modules/tome/data/talents/techniques/pugilism.lua
+++ b/game/modules/tome/data/talents/techniques/pugilism.lua
@@ -97,6 +97,7 @@ newTalent{
 		end
 
 		-- breaks active grapples if the target is not grappled
+		local grappled
 		if target:isGrappled(self) then
 			grappled = true
 		else
@@ -267,9 +268,7 @@ newTalent{
 		if core.fov.distance(self.x, self.y, x, y) > 1 then return nil end
 
 		-- breaks active grapples if the target is not grappled
-		if target:isGrappled(self) then
-			grappled = true
-		else
+		if not target:isGrappled(self) then
 			self:breakGrapples()
 		end
 
@@ -317,8 +316,6 @@ newTalent{
 
 		-- breaks active grapples if the target is not grappled
 		if target:isGrappled(self) then
-			grappled = true
-		else
 			self:breakGrapples()
 		end
 
diff --git a/game/modules/tome/data/talents/techniques/strength-of-the-berserker.lua b/game/modules/tome/data/talents/techniques/strength-of-the-berserker.lua
index b20bfe5c74..5de1bee810 100644
--- a/game/modules/tome/data/talents/techniques/strength-of-the-berserker.lua
+++ b/game/modules/tome/data/talents/techniques/strength-of-the-berserker.lua
@@ -73,7 +73,7 @@ newTalent{
 	getImmune = function(self, t) return self:combatTalentLimit(t, 1, 0.17, 0.5) end,
 	hasFoes = function(self)
 		for i = 1, #self.fov.actors_dist do
-			act = self.fov.actors_dist[i]
+			local act = self.fov.actors_dist[i]
 			if act and self:reactionToward(act) < 0 and self:canSee(act) then return true end
 		end
 		return false
diff --git a/game/modules/tome/data/talents/techniques/unarmed-discipline.lua b/game/modules/tome/data/talents/techniques/unarmed-discipline.lua
index 500a8a4caf..61293b9d3d 100644
--- a/game/modules/tome/data/talents/techniques/unarmed-discipline.lua
+++ b/game/modules/tome/data/talents/techniques/unarmed-discipline.lua
@@ -51,9 +51,7 @@ newTalent{
 		if core.fov.distance(self.x, self.y, x, y) > 1 then return nil end
 
 		-- breaks active grapples if the target is not grappled
-		if target:isGrappled(self) then
-			grappled = true
-		else
+		if not target:isGrappled(self) then
 			self:breakGrapples()
 		end
 
-- 
GitLab