From 25eb372a51a66be8b48326104eae89a29a12eb7a Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Wed, 27 Jun 2012 20:02:06 +0000
Subject: [PATCH] Reavers's Corrupted Strength talent now also provides a free
 melee attack on spellcast

git-svn-id: http://svn.net-core.org/repos/t-engine4@5305 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/Actor.lua                      | 10 ++++++++++
 .../tome/data/talents/corruptions/reaving-combat.lua   |  4 +++-
 game/profile-thread/UserChat.lua                       |  2 ++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua
index 5bc38dd5d9..6a1cfe7581 100644
--- a/game/modules/tome/class/Actor.lua
+++ b/game/modules/tome/class/Actor.lua
@@ -3099,6 +3099,16 @@ function _M:postUseTalent(ab, ret)
 		else
 			self:useEnergy()
 		end
+
+		-- Free melee blow
+		if self:knowTalent(self.T_CORRUPTED_STRENGTH) then
+			local tgts = {}
+			for _, c in pairs(util.adjacentCoords(self.x, self.y)) do
+				local target = game.level.map(c[1], c[2], Map.ACTOR)
+				if target and self:reactionToward(target) < 0 then tgts[#tgts+1] = target end
+			end
+			if #tgts > 0 then self:attackTarget(rng.table(tgts), DamageType.BLIGHT, self:combatTalentWeaponDamage(self.T_CORRUPTED_STRENGTH, 0.5, 1.1), true) end
+		end
 	end
 
 	local trigger = false
diff --git a/game/modules/tome/data/talents/corruptions/reaving-combat.lua b/game/modules/tome/data/talents/corruptions/reaving-combat.lua
index 7d2433b171..ab210f5c6a 100644
--- a/game/modules/tome/data/talents/corruptions/reaving-combat.lua
+++ b/game/modules/tome/data/talents/corruptions/reaving-combat.lua
@@ -32,7 +32,9 @@ newTalent{
 		end
 	end,
 	info = function(self, t)
-		return ([[Allows you to dual wield any type of one handed weapons and increases the damage of the off-hand weapon to %d%%.]]):format(100 / (2 - self:getTalentLevel(t) / 9))
+		return ([[Allows you to dual wield any type of one handed weapons and increases the damage of the off-hand weapon to %d%%.
+		Also casting a spell (which uses a turn) will give a free melee attack at a random target in melee range for %d%% blight damage.]]):
+		format(100 / (2 - self:getTalentLevel(t) / 9), 100 * self:combatTalentWeaponDamage(t, 0.5, 1.1))
 	end,
 }
 
diff --git a/game/profile-thread/UserChat.lua b/game/profile-thread/UserChat.lua
index eee64d64e1..0a032d5249 100644
--- a/game/profile-thread/UserChat.lua
+++ b/game/profile-thread/UserChat.lua
@@ -69,6 +69,8 @@ function _M:parted(channel)
 end
 
 function _M:reconnect()
+	if not self.client.sock then return end
+
 	-- Rejoin every channels
 	print("[ONLINE PROFILE] reconnecting to channels")
 	for chan, _ in pairs(self.cjoined) do
-- 
GitLab