Skip to content
Snippets Groups Projects
Commit f3b072f0 authored by dg's avatar dg
Browse files

Time Prison now completly removes the target from the timeflow, no turns will...

Time Prison now completly removes the target from the timeflow, no turns will pass for it (no cooldowns, regen, ... will happen)


git-svn-id: http://svn.net-core.org/repos/t-engine4@4595 51575b47-30f0-44d4-a5cc-537603b46e54
parent d664a81c
No related branches found
No related tags found
No related merge requests found
......@@ -61,22 +61,24 @@ function _M:init(t)
end
--- Counts down timed effects, call from your actors "act" method
--
function _M:timedEffects()
-- @param filter if not nil a function that gets passed the effect and its parameters, must return true to handle the effect
function _M:timedEffects(filter)
local todel = {}
local def
for eff, p in pairs(self.tmp) do
def = _M.tempeffect_def[eff]
if p.dur <= 0 then
todel[#todel+1] = eff
else
if def.on_timeout then
if def.on_timeout(self, p) then
todel[#todel+1] = eff
if not filter or filter(def, p) then
if p.dur <= 0 then
todel[#todel+1] = eff
else
if def.on_timeout then
if def.on_timeout(self, p) then
todel[#todel+1] = eff
end
end
end
p.dur = p.dur - def.decrease
end
p.dur = p.dur - def.decrease
end
while #todel > 0 do
......
......@@ -284,7 +284,11 @@ end
function _M:actBase()
self.energyBase = self.energyBase - game.energy_to_act
if self:attr("no_timeflow") then return end
if self:attr("no_timeflow") then
-- Compute timed effects that can happen even in timeless mode
self:timedEffects(function(e, p) if e.tick_on_timeless then return true end end)
return
end
if self:isTalentActive (self.T_DARKEST_LIGHT) and self.positive > self.negative then
self:forceUseTalent(self.T_DARKEST_LIGHT, {ignore_energy=true})
......
......@@ -98,6 +98,7 @@ newTalent{
info = function(self, t)
local duration = t.getDuration(self, t)
return ([[Removes the target from the flow of time for %d turns. In this state the target can neither act nor be harmed.
Time does not pass at all for the target, no talents will cooldown, no resources will regen, ...
The duration will increase with your Spellpower.]]):
format(duration)
end,
......
......@@ -75,22 +75,25 @@ newEffect{
newEffect{
name = "TIME_PRISON", image = "talents/time_prison.png",
desc = "Time Prison",
long_desc = function(self, eff) return "The target is removed from the normal time stream, unable to act but unable to take any damage." end,
long_desc = function(self, eff) return "The target is removed from the normal time stream, unable to act but unable to take any damage. Time does not pass for this creature." end,
type = "other",
subtype = { time=true },
status = "detrimental",
tick_on_timeless = true,
parameters = {},
on_gain = function(self, err) return "#Target# is removed from time!", "+Out of Time" end,
on_lose = function(self, err) return "#Target# is returned to normal time.", "-Out of Time" end,
activate = function(self, eff)
eff.iid = self:addTemporaryValue("invulnerable", 1)
eff.sid = self:addTemporaryValue("time_prison", 1)
eff.tid = self:addTemporaryValue("no_timeflow", 1)
eff.particle = self:addParticles(Particles.new("time_prison", 1))
self.energy.value = 0
end,
deactivate = function(self, eff)
self:removeTemporaryValue("invulnerable", eff.iid)
self:removeTemporaryValue("time_prison", eff.sid)
self:removeTemporaryValue("no_timeflow", eff.tid)
self:removeParticles(eff.particle)
end,
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment