Skip to content

Races API

races

Basic Fantasy race definitions and racial rule modifiers.

This module defines the supported races along with ability score restrictions, allowed classes, saving throw modifiers, and racial hit-die limits used during character generation.

RaceName = Literal['dwarf', 'elf', 'halfling', 'human'] module-attribute

Canonical lowercase identifiers for supported character races.

RaceData

Bases: TypedDict

Structured rule data describing racial modifiers and restrictions.

Attributes:

Name Type Description
ability_min dict[AbilityName, int]

Minimum ability score requirements for the race.

ability_max dict[AbilityName, int]

Maximum ability score limits for the race.

allowed_classes list[ClassName]

Classes available to the race.

saving_throw_modifiers dict[SavingThrowName, int]

Racial adjustments applied to saving throws.

hit_die_max int | None

Optional cap on the class hit die size.

Source code in src/rpgcharacters/races.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class RaceData(TypedDict):
    """Structured rule data describing racial modifiers and restrictions.

    Attributes:
        ability_min: Minimum ability score requirements for the race.
        ability_max: Maximum ability score limits for the race.
        allowed_classes: Classes available to the race.
        saving_throw_modifiers: Racial adjustments applied to saving throws.
        hit_die_max: Optional cap on the class hit die size.
    """

    ability_min: dict[AbilityName, int]  # e.g. {"CON": 9}
    ability_max: dict[AbilityName, int]  # e.g. {"CHA": 17}
    allowed_classes: list[ClassName]
    saving_throw_modifiers: dict[SavingThrowName, int]  # e.g. {"magic_wands": -4}
    hit_die_max: int | None