Commit 905a4a6d34cfd7ff77bad7f9cb68de7f48db3f74

Authored by DarkGod
2 parents c6ecacc1 1937f5e9

Merge branch 'no-infinite-heroism' into 'master'

Prevent Heroism lost life bonus from chaining infinitely.



See merge request !757
... ... @@ -233,18 +233,18 @@ newInscription{
233 233 tactical = { DEFEND = 1 },
234 234 action = function(self, t)
235 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 237 self:setEffect(self.EFF_HEROISM, math.floor(data.dur * bonus), {die_at=(data.die_at + data.inc_stat * 30) * bonus})
238 238 return true
239 239 end,
240 240 info = function(self, t)
241 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 243 local bonus1 = (data.die_at + data.inc_stat * 30) * bonus
244 244 local bonus2 = math.floor(data.dur * bonus)
245 245 return ([[Activate the infusion to endure even the most grievous of wounds for %d turns.
246 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 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 249 end,
250 250 short_info = function(self, t)
... ...