DnD_5e.combatant.character module

class DnD_5e.combatant.character.Character(**kwargs)[source]

Bases: Combatant

This is for characters (PC, NPC, whatever)

validate_death_saves(death_saves)[source]
get_level() int[source]
Returns:

level

Return type:

int

get_hit_dice() Tuple[int, int][source]
Returns:

hit dice

Return type:

TYPE_DICE_TUPLE

get_death_saves()[source]
Returns:

death saves

reset_death_saves()[source]

Reset death saves to 0 failures and 0 successes.

Returns:

None

take_damage(damage: int, damage_type: str | None = None, is_critical: bool = False) int[source]

Take damage, applying vulnerabilities, resistances, and immunities as necessary

Parameters:
  • damage (positive integer) – the number of hit points of damage to take

  • damage_type (str) – the type of damage

  • is_critical (bool) – whether the damage is from a critical hit

Returns:

the actual damage taken

Return type:

int

should_die_from_damage(damage_taken: int, damage_type: str | None = None)[source]

Return whether taking the specified amount of damage should result in self dying :param damage_taken: the total amount of damage taken :param damage_type: the damage type :return:

become_unconscious()[source]

Add unconscious condition and set current_hp to 0

Returns:

None

become_conscious()[source]

Become conscious (removing unconcsious, unstable, and stable conditions)

Returns:

None

fail_death_save()[source]

Record that self failed a death save, die if this is the third failed death save

Returns:

None

succeed_death_save()[source]

Record that self succeeded a death save, stabilize if this is the third successful death save

Returns:

None

take_turn_unconscious()[source]

If unstable, make a death saving throw. If stable, do nothing.

Returns:

None (no damage was dealt)

reset()[source]

Reset attributes. Used to prepare to run an Encounter again, if the Encounter is simple enough.

Returns:

None