Srd.Rules.DeathSaves (srd_5e v0.2.0)

Copy Markdown View Source

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

Types

t()

The state of a death-save sequence

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

t()

@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 - :dying while still rolling, then a terminal :stable (three successes), :dead (three failures), or :revived (a natural 20, which regains 1 hit point)

Functions

new()

@spec new() :: t()

A fresh death-save sequence for a creature that has just dropped to 0 HP.

record_damage(state, opts \\ [])

@spec record_damage(
  t(),
  keyword()
) :: t()

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_save(state, roll)

@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.