API Reference

sdark - Shadowdark tools.

class sdark.Alignment(*values)
CHAOTIC = 'chaotic'
LAWFUL = 'lawful'
NEUTRAL = 'neutral'
class sdark.Ancestry(name: str, languages: list[sdark.characters.language.Language], talent: sdark.characters.talents.talent.Talent)
languages: list[Language]
name: str
talent: Talent
class sdark.Armor(name: 'Word', unit_cost: 'Money', unit_slots: 'Slots', unit: 'Unit', free_to_carry: 'int', qty: 'int', base_ac: int, has_dex_mod: bool, properties: list[str])
base_ac: int
has_dex_mod: bool
properties: list[str]
class sdark.Attack(weapon: sdark.gear.weapon.Weapon, mode: sdark.gear.weapon_mode.WeaponMode, attack_roll: list[ndice.dice.Dice], damage_roll: sdark.characters.damage_roll.DamageRoll, range: sdark.mechanics.range.Range)
attack_roll: list[Dice]
damage_roll: DamageRoll
mode: WeaponMode
range: Range
weapon: Weapon
class sdark.Background(name: str, description: str)
description: str
name: str
class sdark.Character(name: 'str', ancestry: 'Ancestry', gender: 'Gender', alignment: 'Alignment', background: 'Background', deity: 'Deity', profession: 'Profession | None', level: 'int', stren: 'Stren', dex: 'Dex', con: 'Con', intel: 'Intel', wis: 'Wis', cha: 'Cha', hp: 'int', xp: 'int', languages: 'list[Language]', talents: 'list[Talent]', spells: 'list[Spell]', inventory: 'Inventory')
attacks() list[Attack]
mastered_weapons() list[Weapon]
property ac: int
alignment: Alignment
ancestry: Ancestry
background: Background
cha: Cha
con: Con
deity: Deity
dex: Dex
property gear_slots: Slots
gender: Gender
hp: int
intel: Intel
inventory: Inventory
languages: list[Language]
level: int
name: str
profession: Profession | None
spells: list[Spell]
stren: Stren
talents: list[Talent]
property title: str | None
wis: Wis
xp: int
property xp_to_level_up: int
class sdark.CharacterSheet(character: Character)
render() str
class sdark.Deity(name: str, alignment: sdark.characters.alignment.Alignment, description: str)
alignment: Alignment
description: str
name: str
class sdark.Gear(name: 'Word', unit_cost: 'Money', unit_slots: 'Slots', unit: 'Unit', free_to_carry: 'int', qty: 'int')
property cost: Money
free_to_carry: int
property kind: str
name: Word
qty: int
property slots: Slots
unit: Unit
unit_cost: Money
unit_slots: Slots
class sdark.Gender(*values)
FEMALE = 'female'
MALE = 'male'
class sdark.Grip(*values)
ONE_HANDED = 1
TWO_HANDED = 2
class sdark.Inventory
add(*items: GearList) None
armor() list[Armor]
remove(gear: Gear) None
weapons() list[Weapon]
property slots: Slots
class sdark.Language(name: str, who_speaks_it: str, frequency: sdark.characters.language.LanguageFrequency = <LanguageFrequency.COMMON: 'common'>)
frequency: LanguageFrequency
name: str
who_speaks_it: str
class sdark.Money(gp: 'Fraction | int' = Fraction(0, 1), sp: 'Fraction | int' = Fraction(0, 1), cp: 'Fraction | int' = Fraction(0, 1))
property coins: tuple[int, int, int]
cp: Fraction
class sdark.Profession(name: str, weapons: list[sdark.gear.weapon.Weapon], armor: list[sdark.gear.armor.Armor], hp_per_level: ndice.dice.Dice, talents: list[sdark.characters.talents.talent.Talent])
armor: list[Armor]
hp_per_level: Dice
name: str
talents: list[Talent]
weapons: list[Weapon]
class sdark.Range(*values)
CLOSE = 1
FAR = 4
NEAR = 2
class sdark.RollHP(max_hp_at_first_level: bool)
max_hp_at_first_level: bool
class sdark.RollStats(reroll_if_no_stat_is_14_plus: bool)
reroll_if_no_stat_is_14_plus: bool
class sdark.Row(value: 'T', weight: 'int')
classmethod from_ranged_value(ranged_value: RangedValue[T]) Row[T]
value: T
weight: int
class sdark.Slots(value: 'Fraction | int')
value: Fraction
class sdark.Spell(level: int, name: str)
level: int
name: str
class sdark.Stat(value: int)
abstract property abbreviation: str
property mod: Dice

Stats table, SD v4.8, p15

abstract property name: str
class sdark.Table(rows: 'list[Row[T]]', dice: 'Dice | None' = None)
classmethod with_dice_and_ranges(dice: Dice, *ranged_values: RangedValue[T]) Table[T]
classmethod with_ranges(*ranged_values: RangedValue[T]) Table[T]
classmethod with_values(*values: T) Table[T]
pick(rng: RNG, count: int, *, skip: Sequence[T] = ()) list[T]
roll(rng: RNG) T
without_values(*values: T) Table[T] | None
dice: Dice | None = None
rows: list[Row]
property total_weight: int
class sdark.Talent(name: str, description: str)
description: str
name: str
class sdark.TalentChoice(name: str, description: str, choices: list[sdark.characters.talents.talent.Talent])
choices: list[Talent]
class sdark.Weapon(name: 'Word', unit_cost: 'Money', unit_slots: 'Slots', unit: 'Unit', free_to_carry: 'int', qty: 'int', mode: sdark.gear.weapon_mode.WeaponMode, range: sdark.mechanics.range.Range, damage: ndice.dice.Dice | tuple[ndice.dice.Dice, ndice.dice.Dice], grip: sdark.gear.grip.Grip = <Grip.ONE_HANDED: 1>, finesse: bool = False, loading: bool = False, thrown: bool = False)
damage: Dice | tuple[Dice, Dice]
finesse: bool
grip: Grip
property is_two_handed: bool
property is_versatile: bool
loading: bool
mode: WeaponMode
range: Range
thrown: bool
class sdark.WeaponMastery(name: str, description: str, weapon: sdark.gear.weapon.Weapon)
weapon: Weapon
class sdark.WeaponMode(*values)
MELEE = 1
RANGED = 2
sdark.clamp(low: int, value: int, high: int) int
sdark.make_mod(value: int) Dice
sdark.mod_value(*mods: Dice) int
sdark.random_character(rng: Callable[[int], int], roll_stats: RollStats, roll_hp: RollHP, level: int) Character
sdark.roll_with_advantage(rng: Callable[[int], int], *dice_expression: Dice) int
sdark.roll_with_disadvantage(rng: Callable[[int], int], *dice_expression: Dice) int
sdark.simplify_mods(*expression: Dice) list[Dice]