Commit 1937f5e92bf7616e177b31ee59bcb23d53e094a7

Authored by K'van
1 parent 294e777b

Prevent Heroism lost life bonus from chaining infinitely.

@@ -233,18 +233,18 @@ newInscription{ @@ -233,18 +233,18 @@ newInscription{
233 tactical = { DEFEND = 1 }, 233 tactical = { DEFEND = 1 },
234 action = function(self, t) 234 action = function(self, t)
235 local data = self:getInscriptionData(t.short_name) 235 local data = self:getInscriptionData(t.short_name)
236 - local bonus = 1 + (1 - self.life / self.max_life) 236 + local bonus = 1 + (1 - math.max(0, self.life) / self.max_life)
237 self:setEffect(self.EFF_HEROISM, math.floor(data.dur * bonus), {die_at=(data.die_at + data.inc_stat * 30) * bonus}) 237 self:setEffect(self.EFF_HEROISM, math.floor(data.dur * bonus), {die_at=(data.die_at + data.inc_stat * 30) * bonus})
238 return true 238 return true
239 end, 239 end,
240 info = function(self, t) 240 info = function(self, t)
241 local data = self:getInscriptionData(t.short_name) 241 local data = self:getInscriptionData(t.short_name)
242 - local bonus = 1 + (1 - self.life / self.max_life) 242 + local bonus = 1 + (1 - math.max(0, self.life) / self.max_life)
243 local bonus1 = (data.die_at + data.inc_stat * 30) * bonus 243 local bonus1 = (data.die_at + data.inc_stat * 30) * bonus
244 local bonus2 = math.floor(data.dur * bonus) 244 local bonus2 = math.floor(data.dur * bonus)
245 return ([[Activate the infusion to endure even the most grievous of wounds for %d turns. 245 return ([[Activate the infusion to endure even the most grievous of wounds for %d turns.
246 While Heroism is active, you will only die when reaching -%d life. 246 While Heroism is active, you will only die when reaching -%d life.
247 - The duration and life will increase by 1%% for every 1%% life you have lost (currently %d life, %d duration) 247 + The duration and life will increase by 1%% for every 1%% life you have lost, to a maximum of 100%% at 0 life or less (currently %d life, %d duration)
248 If your life is below 0 when this effect wears off it will be set to 1.]]):tformat(data.dur, data.die_at + data.inc_stat * 30, bonus1, bonus2) 248 If your life is below 0 when this effect wears off it will be set to 1.]]):tformat(data.dur, data.die_at + data.inc_stat * 30, bonus1, bonus2)
249 end, 249 end,
250 short_info = function(self, t) 250 short_info = function(self, t)