From c111e1a9cead1d7cb5ceff7bacaed4fb24edd7d7 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Mon, 12 Mar 2012 17:54:36 +0000
Subject: [PATCH] Time Prison mana cost reduced by 20 Time Shield is now
 instant cast, the dot duration increases with talent level and while active
 all newly applied status effects are reduced by a %

git-svn-id: http://svn.net-core.org/repos/t-engine4@4964 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/Actor.lua                  | 10 +++++++---
 game/modules/tome/data/talents/spells/temporal.lua | 14 +++++++++-----
 game/modules/tome/data/timed_effects/other.lua     | 11 +++++++----
 3 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua
index b78db10a20..c5b29e771d 100644
--- a/game/modules/tome/class/Actor.lua
+++ b/game/modules/tome/class/Actor.lua
@@ -3283,14 +3283,18 @@ function _M:on_set_temporary_effect(eff_id, e, p)
 	end
 
 	if e.status == "detrimental" and self:knowTalent(self.T_RESILIENT_BONES) then
-		p.dur = math.ceil(p.dur * (1 - (self:getTalentLevel(self.T_RESILIENT_BONES) / 12)))
+		p.dur = math.ceil(p.dur * (1 - util.bound(self:getTalentLevel(self.T_RESILIENT_BONES) / 12, 0, 1)))
 	end
 	if e.status == "detrimental" and e.type ~= "other" and self:hasEffect(self.EFF_FADE_FROM_TIME) then
-		local fft = self:hasEffect(self.EFF_FADE_FROM_TIME)
+		local fft = util.bound(self:hasEffect(self.EFF_FADE_FROM_TIME), 0, 100)
 		p.dur = math.ceil(p.dur * (1 - (fft.power/100)))
 	end
+	if e.type ~= "other" and self:attr("reduce_status_effects_time") then
+		local power = util.bound(self.reduce_status_effects_time, 0, 100)
+		p.dur = math.ceil(p.dur * (1 - (power/100)))
+	end
 	if self:knowTalent(self.T_VITALITY) and e.status == "detrimental" and (e.subtype.wound or e.subtype.poison or e.subtype.disease) then
-		local t = self:getTalentFromId(self.T_VITALITY)
+		local t = util.bound(self:getTalentFromId(self.T_VITALITY), 0, 1)
 		p.dur = math.ceil(p.dur * (1 - t.getWoundReduction(self, t)))
 	end
 	if self:hasEffect(self.EFF_HAUNTED) and e.subtype and e.subtype.fear then
diff --git a/game/modules/tome/data/talents/spells/temporal.lua b/game/modules/tome/data/talents/spells/temporal.lua
index 63b5de2f3e..7e38320548 100644
--- a/game/modules/tome/data/talents/spells/temporal.lua
+++ b/game/modules/tome/data/talents/spells/temporal.lua
@@ -56,20 +56,24 @@ newTalent{
 	cooldown = 18,
 	tactical = { DEFEND = 2 },
 	range = 10,
+	no_energy = true,
 	getMaxAbsorb = function(self, t) return 50 + self:combatTalentSpellDamage(t, 50, 450) end,
 	getDuration = function(self, t) return util.bound(5 + math.floor(self:getTalentLevel(t)), 5, 15) end,
+	getDotDuration = function(self, t) return util.bound(4 + math.floor(self:getTalentLevel(t)), 4, 12) end,
+	getTimeReduction = function(self, t) return util.bound(15 + math.floor(self:getTalentLevel(t) * 2), 15, 35) end,
 	action = function(self, t)
-		self:setEffect(self.EFF_TIME_SHIELD, t.getDuration(self, t), {power=t.getMaxAbsorb(self, t)})
+		self:setEffect(self.EFF_TIME_SHIELD, t.getDuration(self, t), {power=t.getMaxAbsorb(self, t), dot_dur=t.getDotDuraion(self, t), time_reducer=t.getTimeReduction(self, t)})
 		game:playSoundNear(self, "talents/spell_generic")
 		return true
 	end,
 	info = function(self, t)
 		local maxabsorb = t.getMaxAbsorb(self, t)
 		local duration = t.getDuration(self, t)
-		return ([[This intricate spell erects a time shield around the caster, preventing any incoming damage and sending it forward in time.
-		Once either the maximum damage (%d) is absorbed, or the time runs out (%d turns), the stored damage will return as self-damage over time (5 turns).
+		return ([[This intricate spell instantly erects a time shield around the caster, preventing any incoming damage and sending it forward in time.
+		Once either the maximum damage (%d) is absorbed, or the time runs out (%d turns), the stored damage will return as self-damage over time (%d turns).
+		While under the effect of Time Shield all newly applied magical, physical and mental effects will have their durations reduced by %d%%.
 		Max absorption will increase with your Spellpower.]]):
-		format(maxabsorb, duration)
+		format(maxabsorb, duration, dotdur, time_reduc)
 	end,
 }
 
@@ -79,7 +83,7 @@ newTalent{
 	require = spells_req3,
 	points = 5,
 	random_ego = "utility",
-	mana = 140,
+	mana = 120,
 	cooldown = 40,
 	tactical = { DISABLE = 1, ESCAPE = 3, PROTECT = 3 },
 	range = 10,
diff --git a/game/modules/tome/data/timed_effects/other.lua b/game/modules/tome/data/timed_effects/other.lua
index fee490fa37..65c9a3e510 100644
--- a/game/modules/tome/data/timed_effects/other.lua
+++ b/game/modules/tome/data/timed_effects/other.lua
@@ -103,11 +103,11 @@ newEffect{
 newEffect{
 	name = "TIME_SHIELD", image = "talents/time_shield.png",
 	desc = "Time Shield",
-	long_desc = function(self, eff) return ("The target is surrounded by a time distortion, absorbing %d/%d damage and sending it forward in time."):format(self.time_shield_absorb, eff.power) end,
+	long_desc = function(self, eff) return ("The target is surrounded by a time distortion, absorbing %d/%d damage and sending it forward in time. While active all newly applied status effects durations are reduced by %d%%."):format(self.time_shield_absorb, eff.power, eff.time_reducer) end,
 	type = "other",
 	subtype = { time=true, shield=true },
 	status = "beneficial",
-	parameters = { power=10 },
+	parameters = { power=10, dot_dur=5, time_reducer=20 },
 	on_gain = function(self, err) return "The very fabric of time alters around #target#.", "+Time Shield" end,
 	on_lose = function(self, err) return "The fabric of time around #target# stabilizes to normal.", "-Time Shield" end,
 	on_aegis = function(self, eff, aegis)
@@ -116,6 +116,7 @@ newEffect{
 	activate = function(self, eff)
 		if self:attr("shield_factor") then eff.power = eff.power * (100 + self:attr("shield_factor")) / 100 end
 		if self:attr("shield_dur") then eff.dur = eff.dur + self:attr("shield_dur") end
+		eff.durid = self:addTemporaryValue("reduce_status_effects_time", eff.time_reducer)
 		eff.tmpid = self:addTemporaryValue("time_shield", eff.power)
 		--- Warning there can be only one time shield active at once for an actor
 		self.time_shield_absorb = eff.power
@@ -123,11 +124,13 @@ newEffect{
 		eff.particle = self:addParticles(Particles.new("time_shield", 1))
 	end,
 	deactivate = function(self, eff)
+		self:removeTemporaryValue("reduce_status_effects_time", eff.durid)
+
 		self:removeParticles(eff.particle)
 		-- Time shield ends, setup a dot if needed
 		if eff.power - self.time_shield_absorb > 0 then
-			print("Time shield dot", eff.power - self.time_shield_absorb, (eff.power - self.time_shield_absorb) / 5)
-			self:setEffect(self.EFF_TIME_DOT, 5, {power=(eff.power - self.time_shield_absorb) / 5})
+			print("Time shield dot", eff.power - self.time_shield_absorb, (eff.power - self.time_shield_absorb) / eff.dot_dur)
+			self:setEffect(self.EFF_TIME_DOT, eff.dot_dur, {power=(eff.power - self.time_shield_absorb) / eff.dot_dur})
 		end
 
 		self:removeTemporaryValue("time_shield", eff.tmpid)
-- 
GitLab