For example, if you're STUNNED for 5 turns, and then are hit with another stunning effect which you shrug off, the first effect is removed. You actually benefit from getting hit with another stun attack!
Here is a patch to fix this:
Code: Select all
Index: game/engines/default/engine/interface/ActorTemporaryEffects.lua
===================================================================
--- game/engines/default/engine/interface/ActorTemporaryEffects.lua (revision 6781)
+++ game/engines/default/engine/interface/ActorTemporaryEffects.lua (working copy)
@@ -104,6 +104,7 @@
end
p.dur = dur
self:check("on_set_temporary_effect", eff_id, _M.tempeffect_def[eff_id], p)
+ if p.no_effect then return end -- Negated by on_set_temporary_effect
if p.dur <= 0 then return self:removeEffect(eff_id) end
-- If we already have it, we check if it knows how to "merge", or else we remove it and re-add it
Index: game/modules/tome/class/Actor.lua
===================================================================
--- game/modules/tome/class/Actor.lua (revision 6781)
+++ game/modules/tome/class/Actor.lua (working copy)
@@ -4443,6 +4454,8 @@
--- Adjust temporary effects
function _M:on_set_temporary_effect(eff_id, e, p)
+ local olddur = self:hasEffect(eff_id)
+ olddur = olddur and olddur.dur or 0 --Duration of existing effect
if p.apply_power and (save_for_effects[e.type] or p.apply_save) then
local save = 0
p.maximum = p.dur
@@ -4516,6 +4529,10 @@
if self.player then
p.__set_time = core.game.getTime()
end
+ if p.dur <= 0 then
+ p.no_effect = true --If the effect failed, don't merge or trigger on_gain or activate effects
+ end
+ p.dur = math.max(p.dur, olddur)
end
--- Called when we are initiating a projection
Index: game/modules/tome/data/timed_effects/physical.lua
===================================================================
--- game/modules/tome/data/timed_effects/physical.lua (revision 6781)
+++ game/modules/tome/data/timed_effects/physical.lua (working copy)
@@ -1739,7 +1739,7 @@
if shield then shield:check("on_block", self, src, type, dam, eff) end
if eff.properties.br then self:heal(blocked) end
if eff.properties.ref and src.life then DamageType.defaultProjector(src, src.x, src.y, type, blocked, tmp, true) end
- if (self:knowTalent(self.T_RIPOSTE) or amt == 0) and src.life then src:setEffect(src.EFF_COUNTERSTRIKE, 1 + dur_inc, {power=eff.power, no_ct_effect=true, src=self, crit_inc=crit_inc, nb=nb}) end
+ if (self:knowTalent(self.T_RIPOSTE) or amt == 0) and src.life then src:setEffect(src.EFF_COUNTERSTRIKE, (1 + dur_inc) * (src.global_speed or 1), {power=eff.power, no_ct_effect=true, src=self, crit_inc=crit_inc, nb=nb}) end
return amt
end,
activate = function(self, eff)
@@ -1770,7 +1770,6 @@
eff.tmpid = self:addTemporaryValue("counterstrike", 1)
eff.def = self:addTemporaryValue("combat_def", -eff.power)
eff.crit = self:addTemporaryValue("combat_crit_vulnerable", eff.crit_inc or 0)
- eff.dur = math.ceil(eff.dur * (self.global_speed or 1))
end,
deactivate = function(self, eff)
self:removeTemporaryValue("counterstrike", eff.tmpid)
Edit: Updated the patch to eliminate recursive stacking of the COUNTERSTRIKE debuff.