From 3fcae94edebb77f4ace213c975615769be4b6d7e Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Wed, 6 Feb 2013 23:27:19 +0000
Subject: [PATCH] Drain does not restore vim from your own summons

git-svn-id: http://svn.net-core.org/repos/t-engine4@6384 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/Actor.lua       | 21 +++++++++++++++++++++
 game/modules/tome/data/damage_types.lua |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua
index e552196cb1..44266b5b00 100644
--- a/game/modules/tome/class/Actor.lua
+++ b/game/modules/tome/class/Actor.lua
@@ -1066,6 +1066,12 @@ function _M:move(x, y, force)
 		end
 	end
 
+	if self.talents_on_move and next(self.talents_on_move) then
+		for tid, _ in pairs(self.talents_on_move) do
+			self:callTalent(tid, "callbackOnMove", moved, force, ox, oy)
+		end
+	end
+
 	self:triggerHook{"Actor:move", moved=moved, force=force, ox=ox, oy=oy}
 
 	return moved
@@ -3733,6 +3739,10 @@ function _M:postUseTalent(ab, ret, silent)
 				self.talents_on_act = self.talents_on_act or {}
 				self.talents_on_act[ab.id] = true
 			end
+			if ab.callbackOnMove then
+				self.talents_on_move = self.talents_on_move or {}
+				self.talents_on_move[ab.id] = true
+			end
 		else
 			if ab.sustain_mana then
 				self:incMaxMana(ab.sustain_mana)
@@ -3768,6 +3778,10 @@ function _M:postUseTalent(ab, ret, silent)
 				self.talents_on_act[ab.id] = nil
 				if not next(self.talents_on_act) then self.talents_on_act = nil end
 			end
+			if ab.callbackOnMove then
+				self.talents_on_move[ab.id] = nil
+				if not next(self.talents_on_move) then self.talents_on_move = nil end
+			end
 		end
 	elseif not self:attr("force_talent_ignore_ressources") then
 		if ab.mana and not self:attr("zero_resource_cost") then
@@ -3826,6 +3840,13 @@ function _M:postUseTalent(ab, ret, silent)
 	self:breakStepUp()
 	if not (ab.no_energy or ab.no_break_channel) and not (ab.mode == "sustained" and self:isTalentActive(ab.id)) then self:breakPsionicChannel(ab.id) end
 
+	for tid, _ in pairs(self.sustain_talents) do
+		local t = self:getTalentFromId(tid)
+		if t and t.callbackBreakOnTalent then
+			self:callTalent(tid, "callbackBreakOnTalent", ab)
+		end
+	end
+
 	if ab.id ~= self.T_REDUX and self:hasEffect(self.EFF_REDUX) and ab.type[1]:find("^chronomancy/") and ab.mode == "activated" and self:getTalentLevel(self.T_REDUX) >= self:getTalentLevel(ab.id) then
 		self:removeEffect(self.EFF_REDUX)
 		-- this still consumes energy but works as the talent suggests it does
diff --git a/game/modules/tome/data/damage_types.lua b/game/modules/tome/data/damage_types.lua
index 330de9cd5d..6acb6663f1 100644
--- a/game/modules/tome/data/damage_types.lua
+++ b/game/modules/tome/data/damage_types.lua
@@ -1555,7 +1555,7 @@ newDamageType{
 		if _G.type(dam) == "number" then dam = {dam=dam, vim=0.2} end
 		local target = game.level.map(x, y, Map.ACTOR)
 		local realdam = DamageType:get(DamageType.BLIGHT).projector(src, x, y, DamageType.BLIGHT, dam.dam)
-		if target and target ~= src and realdam > 0 then
+		if target and target ~= src and target.summoner ~= src and realdam > 0 then
 			src:incVim(realdam * dam.vim * target:getRankVimAdjust())
 		end
 		return realdam
-- 
GitLab