Damage resolution.
Resolves a completed damage roll into a final amount after applying the target's resistances, vulnerabilities, and immunities to the damage type.
Summary
Types
One of the SRD damage types.
A defense a target has against certain damage types. Each is a list of the
types it covers: :immune negates, :resist halves, :vulnerable doubles.
The result of resolving damage
Functions
Resolve a damage roll of the given type against a target's defenses.
The SRD damage types.
Types
@type damage_type() ::
:acid
| :bludgeoning
| :cold
| :fire
| :force
| :lightning
| :necrotic
| :piercing
| :poison
| :psychic
| :radiant
| :slashing
| :thunder
One of the SRD damage types.
@type option() :: {:immune, [damage_type()]} | {:resist, [damage_type()]} | {:vulnerable, [damage_type()]}
A defense a target has against certain damage types. Each is a list of the
types it covers: :immune negates, :resist halves, :vulnerable doubles.
@type options() :: [option()]
The defenses accepted by resolve/3.
@type t() :: %Srd.Rules.Damage{ final: non_neg_integer(), raw: non_neg_integer(), type: damage_type() }
The result of resolving damage:
:type- the damage type:raw- the amount rolled, before defenses:final- the amount after resistance, vulnerability, or immunity
Functions
@spec resolve(Srd.Dice.Roll.t(), damage_type(), options()) :: t()
Resolve a damage roll of the given type against a target's defenses.
Immunity yields no damage, resistance halves it (rounded down), and vulnerability doubles it.
@spec types() :: [damage_type()]
The SRD damage types.