Death saving throw rules.
A creature at 0 hit points makes a death saving throw at the start of each of its turns. This tracks the running tally of successes and failures and resolves it to stable, dead, or revived.
Summary
Functions
A fresh death-save sequence for a creature that has just dropped to 0 HP.
Record a hit taken while at 0 HP: one failure, or two on a critical hit. Recording against a settled sequence is a no-op.
Record one turn's death saving throw against a completed d20 roll.
Types
@type t() :: %Srd.Rules.DeathSaves{
failures: 0..3,
status: :dying | :stable | :dead | :revived,
successes: 0..3
}
The state of a death-save sequence:
:successes/:failures- the running tally (0..3):status-:dyingwhile still rolling, then a terminal:stable(three successes),:dead(three failures), or:revived(a natural 20, which regains 1 hit point)
Functions
@spec new() :: t()
A fresh death-save sequence for a creature that has just dropped to 0 HP.
Record a hit taken while at 0 HP: one failure, or two on a critical hit. Recording against a settled sequence is a no-op.
@spec record_save(t(), Srd.Dice.Roll.t()) :: t()
Record one turn's death saving throw against a completed d20 roll.
A natural 20 revives the creature (regain 1 HP); a natural 1 counts as two failures; otherwise a total of 10 or more is a success and anything lower is a failure. Three successes stabilize, three failures kill. Recording against a sequence that has already settled is a no-op.