diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index 8fc01030e0851b6571517b6d009260c5f11544b5..310bb52edb3fbb6ae98b032bd2c0d2d87474c110 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -4166,8 +4166,13 @@ function _M:suffocate(value, src, death_message) self.air = self.air - value local ae = game.level.map(self.x, self.y, Map.ACTOR) if self.air <= 0 then - game.logSeen(self, "%s suffocates to death!", self.name:capitalize()) - return self:die(src, {special_death_msg=death_message or "suffocated to death"}), true + self.air = 0 + if not self:hasEffect(self.EFF_SUFFOCATING) then + game.logSeen(self, "#LIGHT_RED#%s starts suffocating to death!", self.name:capitalize()) + self:setEffect(self.EFF_SUFFOCATING, 1, {dam=20}) + end + return false, true +-- return self:die(src, {special_death_msg=death_message or "suffocated to death"}), true end return false, true end diff --git a/game/modules/tome/data/gfx/effects/suffocating.png b/game/modules/tome/data/gfx/effects/suffocating.png new file mode 100644 index 0000000000000000000000000000000000000000..06dafac20bfb5d5c6b9c7cce8130a5c4b48a3e37 Binary files /dev/null and b/game/modules/tome/data/gfx/effects/suffocating.png differ diff --git a/game/modules/tome/data/timed_effects/other.lua b/game/modules/tome/data/timed_effects/other.lua index bf98cea88eb613e2ff20b31676f7a2ff88c9747c..b05e7e0ef69eef72d77370bec0592eb8558593b1 100644 --- a/game/modules/tome/data/timed_effects/other.lua +++ b/game/modules/tome/data/timed_effects/other.lua @@ -2193,3 +2193,29 @@ newEffect{ if self.player then engine.Map:setViewerFaction(self.faction) end end, } + +newEffect{ + name = "SUFFOCATING", + desc = "Suffocating", + long_desc = function(self, eff) return ("You are suffocating! Each turn you lose an ever increasing percent of your total life (currently %d%%)"):format(eff.dam) end, + type = "other", + subtype = { suffocating=true }, + status = "detrimental", + decrease = 0, no_remove = true, + parameters = { dam=20 }, + on_gain = function(self, err) return "#Target# is suffocating.", "+SUFFOCATING" end, + on_lose = function(self, err) return "#Target# can breathe again.", "-Suffocating" end, + on_timeout = function(self, eff) + if self.air > self.air_regen then -- We must be over our natural regen + self:removeEffect(self.EFF_SUFFOCATING, false, true) + return + end + + -- Bypass all shields & such + local old = self.onTakeHit + self.onTakeHit = nil + mod.class.interface.ActorLife.takeHit(self, self.max_life * eff.dam / 100, self, {special_death_msg="suffocated to death"}) + eff.dam = util.bound(eff.dam + 5, 20, 100) + self.onTakeHit = old + end, +}