From 42798821e2f747dbb3930c37be58b9fd63d0ff41 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Wed, 5 Dec 2012 11:28:13 +0000
Subject: [PATCH] Spell Feedback now also adds a 30% spell failure chance to
 the caster

git-svn-id: http://svn.net-core.org/repos/t-engine4@5934 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/data/damage_types.lua         |  2 +-
 game/modules/tome/data/talents/uber/wil.lua     | 11 +++++++++--
 game/modules/tome/data/timed_effects/mental.lua | 15 +++++++++++++++
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/game/modules/tome/data/damage_types.lua b/game/modules/tome/data/damage_types.lua
index a4e88a3905..1c534f95ae 100644
--- a/game/modules/tome/data/damage_types.lua
+++ b/game/modules/tome/data/damage_types.lua
@@ -407,7 +407,7 @@ setDefaultProjector(function(src, x, y, type, dam, tmp, no_martyr)
 				end
 
 				if not target.dead and t.is_spell and target.knowTalent and target:knowTalent(src.T_SPELL_FEEDBACK) then
-					target:triggerTalent(target.T_SPELL_FEEDBACK, nil, src)
+					target:triggerTalent(target.T_SPELL_FEEDBACK, nil, src, t)
 				end
 			end
 		end
diff --git a/game/modules/tome/data/talents/uber/wil.lua b/game/modules/tome/data/talents/uber/wil.lua
index 5b441b95ca..27628b75ee 100644
--- a/game/modules/tome/data/talents/uber/wil.lua
+++ b/game/modules/tome/data/talents/uber/wil.lua
@@ -196,14 +196,21 @@ uberTalent{
 	mode = "passive",
 	cooldown = 3,
 	require = { special={desc="Antimagic", fct=function(self) return self:knowTalentType("wild-gift/antimagic") end} },
-	trigger = function(self, t, target)
+	trigger = function(self, t, target, source_t)
 		self:startTalentCooldown(t)
 		game.logSeen(self, "#LIGHT_BLUE#%s punishes %s for casting a spell!", self.name:capitalize(), target.name)
 		DamageType:get(DamageType.MIND).projector(self, target.x, target.y, DamageType.MIND, 20 + self:getWil() * 2)
+
+		local dur = target:getTalentCooldown(source_t)
+		if dur and dur > 0 then
+			target:setEffect(target.EFF_SPELL_FEEDBACK, dur, {power=30})
+		end
 		return true
 	end,
 	info = function(self, t)
-		return ([[Your will is a shield against the assault of crazy arcane users. Each time you take damage from a spell you punish the spellcaster with %0.2f mind damage.]])
+		return ([[Your will is a shield against the assault of crazy arcane users.
+		Each time you take damage from a spell you punish the spellcaster with %0.2f mind damage.
+		Also they will suffer a 30%% spell failure chance for the durtion of the spell cooldown they used on you.]])
 		:format(damDesc(self, DamageType.MIND, 20 + self:getWil() * 2))
 	end,
 }
diff --git a/game/modules/tome/data/timed_effects/mental.lua b/game/modules/tome/data/timed_effects/mental.lua
index 7e0bb11962..269d88bce5 100644
--- a/game/modules/tome/data/timed_effects/mental.lua
+++ b/game/modules/tome/data/timed_effects/mental.lua
@@ -2802,3 +2802,18 @@ newEffect{
 		self:effectTemporaryValue(eff, "force_talent_ignore_ressources", 1)
 	end,
 }
+
+newEffect{
+	name = "SPELL_FEEDBACK", image = "talents/spell_feedback.png",
+	desc = "Spell Feedback",
+	long_desc = function(self, eff) return ("The target suffers %d%% spell failue."):format(eff.power) end,
+	type = "mental",
+	subtype = { nature=true },
+	status = "detrimental",
+	on_gain = function(self, err) return "#Target#'s is surrounded by antimagic forces.", "+Spell Feedback" end,
+	on_lose = function(self, err) return "#Target#'s antimagic forces vanishes.", "-Spell Feedback" end,
+	parameters = { power=30 },
+	activate = function(self, eff)
+		self:effectTemporaryValue(eff, "spell_failure", eff.power)
+	end,
+}
-- 
GitLab