DnD_5e.character_classes package
Submodules
DnD_5e.character_classes.barbarian module
- class DnD_5e.character_classes.barbarian.Barbarian(**kwargs)[source]
Bases:
CharacterBarbarian character class
- current_eq(other) bool[source]
Compare self and other to determine if they are identical based on the attributes checked in equals and also these attributes: rage slots, rage state
- Parameters:
other – the Barbarian to compare
- Returns:
True if self is identical to other, False otherwise
- Return type:
- start_reckless()[source]
Enter this state when attacking recklessly. It lasts for one round.
- Returns:
None
- stop_reckless()[source]
End the reckless state. This happens after one round of recklessly attacking.
- Returns:
None
- make_saving_throw(save_type: str, adv=0)[source]
Roll a saving throw of the given type. This is different from the superclass method in that it is affected by raging and the “danger sense” feature.
- Parameters:
save_type (one of these strings: "strength", "dexterity", "constitution", "intelligence", "wisdom", "charisma") – the kind of saving throw to make
adv (int) – indicates advantage (positive), disadvantage (negative), or neither (0)
- Returns:
the number rolled for the saving throw
- Return type:
- become_unconscious()[source]
Go unconscious. This differs from the superclass method in that self may drop to 1 hit point instead due to the “relentless rage” feature. If self saves, then self drops to 1 hit point. Otherwise, self is unconscious and has current hp of 0
- Returns:
None
DnD_5e.character_classes.bard module
- class DnD_5e.character_classes.bard.Bard(**kwargs)[source]
Bases:
SpellCaster,CharacterBard character class
- current_eq(other) bool[source]
Compare self and other to determine if they are identical based on the attributes checked in equals and also these attributes: inspiration slots
- Parameters:
other – the Bard to compare
- Returns:
True if self is identical to other, False otherwise
- Return type:
DnD_5e.character_classes.cleric module
- class DnD_5e.character_classes.cleric.Cleric(**kwargs)[source]
Bases:
SpellCaster,CharacterCleric character class
- current_eq(other) bool[source]
Check to see if self is identical to other by looking at everything in equals as well as the following attributes: channel divinity slots
- get_channel_divinity_slots() int[source]
- Returns:
channel divinity slots
- Return type:
non-negative integer
DnD_5e.character_classes.druid module
- class DnD_5e.character_classes.druid.Druid(**kwargs)[source]
Bases:
SpellCaster,CharacterDruid character class
- current_eq(other) bool[source]
Check to see if self is identical to other by looking at everything in equals as well as the following attributes: wild shape slots, wild shapes, current shape
- get_current_shape() Creature | None[source]
- Returns:
current shape (or None if in original shape)
- Return type:
Creature (or None)
- get_ac() int[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
armor class
- Return type:
positive integer
- get_hit_dice() Tuple[int, int][source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
hit dice
- Return type:
TYPE_DICE_TUPLE
- get_max_hp() int[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
max hit points
- Return type:
positive integer
- get_temp_hp() int[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
temporary hit points
- Return type:
non-negative integer
- get_current_hp() int[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
current hit points
- Return type:
non-negative integer
- is_bloodied() bool[source]
Tell whether self is bloodied (current hit points at or below half of maximum). If a wild shape is active, use the statistics of the wild shape.
- Returns:
True if self is bloodied, False otherwise
- Return type:
- is_hp_max() bool[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
True if current hp equals max hp, False otherwise
- Return type:
- get_speed() int[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
speed
- Return type:
positive integer
- get_vision() str[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
vision
- Return type:
one of these strings: “normal”, “darkvision”, “blindsight”, “truesight”
- get_ability(ability: str) int[source]
If a wild shape is active, use the statistics of the wild shape
- Parameters:
ability (one of these strings: "strength", "dexterity", "constitution", "intelligence", "wisdom", "charisma") – the name of an ability score
- Returns:
the ability score modifier
- Return type:
- Raise:
ValueError if ability is not valid
- get_strength() int[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
strength modifier
- Return type:
- get_dexterity() int[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
dexterity modifier
- Return type:
- get_constitution() int[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
constitution modifier
- Return type:
- get_proficiencies() set[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
proficiencies
- Return type:
set of strings
- get_vulnerabilities() set[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
vulnerabilities
- Return type:
set of strings
- get_resistances() set[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
resistances
- Return type:
set of strings
- get_immunities() set[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
immunities
- Return type:
set of strings
- get_saving_throw(ability: str) int[source]
Get the modifier for an ability saving throw. Note: this does NOT roll the saving throw. If a wild shape is active, use the statistics of the wild shape.
- Parameters:
ability (one of these strings: "strength", "dexterity", "constitution", "intelligence", "wisdom", "charisma') – an ability score name
- Returns:
the modifier for an ability saving throw
- Return type:
- Raise:
ValueError if ability is not valid
- get_attacks() list[source]
If a wild shape is active, use the statistics of the wild shape
- Returns:
attacks
- Return type:
list of Attacks
- add_wild_shape(beast: Creature)[source]
Add a wild shape
- Parameters:
beast (Creature) – the wild shape to add
- Returns:
None
- can_cast(spell)[source]
Determine if self can cast the given Spell. Note: does not check spell slots.
- Parameters:
spell (py:class:Spell) – the Spell self is trying to cast
- Returns:
True if self can cast spell, False otherwise
- Return type:
- take_damage(damage, damage_type=None, is_critical: bool = False)[source]
Take damage, applying vulnerabilities, resistances, and immunities as necessary. If self has a wild shape active, that beast takes damage first. If the beast reaches 0 hit points, the wild shape ends and self goes back to their original form and takes the rest of the damage.
DnD_5e.character_classes.fighter module
- class DnD_5e.character_classes.fighter.Fighter(**kwargs)[source]
Bases:
CharacterFighter character class
- current_eq(other) bool[source]
Compare self and other to determine if they are identical based on the attributes checked in equals and also these attributes: action surge slots, indomitable
- get_extra_attack_num() int[source]
- Returns:
the number of extra attacks (additional attacks allowed when using the attack action)
- Return type:
non-negative integer
- take_action_surge()[source]
Do an action surge. NOT IMPLEMENTED YET.
- Returns:
None
- Raise:
ValueError if self has no action surge slots left
- take_extra_attack()[source]
Make an extra attack. NOT IMPLEMENTED YET.
- Returns:
None
- Raise:
ValueError if self has no extra attack slots left
DnD_5e.character_classes.monk module
- class DnD_5e.character_classes.monk.Monk(**kwargs)[source]
Bases:
CharacterMonk character class
- current_eq(other) bool[source]
Compare self and other to determine if they are identical based on the attributes checked in equals and also these attributes: ki points
- get_martial_arts_dice() Tuple[int, int][source]
- Returns:
martial arts dice
- Return type:
TYPE_DICE_TUPLE
DnD_5e.character_classes.paladin module
- class DnD_5e.character_classes.paladin.Paladin(**kwargs)[source]
Bases:
SpellCaster,CharacterPaladin character class
- current_eq(other) bool[source]
Compare self and other to determine if they are identical based on the attributes checked in equals and also these attributes: divine sense slots, lay on hands pool, cleansing touch slots
- get_lay_on_hands_pool() int[source]
- Returns:
the hit points in the lay on hands pool
- Return type:
non-negative integer
- get_aura() int[source]
- Returns:
the number of feet for the aura features
- Return type:
non-negative integer
- get_cleansing_touch_slots() int[source]
- Returns:
cleansing touch slots
- Return type:
non-negative integer
- spend_divine_sense_slot()[source]
Spend a divine sense slot
- Returns:
None
- Raise:
ValueError if self has no divine sense slots left
- spend_cleansing_touch_slot()[source]
Spend a cleansing touch slot
- Returns:
None
- Raise:
ValueError if self has no cleansing touch slots left
- send_lay_on_hands(hp: int, target=None, use='healing')[source]
Use the Lay on Hands feature
- Parameters:
- Returns:
the hit points healed for, if use is “healing”
- Raise:
ValueError if self doesn’t have enough Lay on Hands points
- send_divine_smite(target: Combatant, level=1) int[source]
Use Divine Smite on a specified target
- Parameters:
target (Combatant) – the Combatant to use Divine Smite on
level (integer between 1 and 9 (inclusive)) – the level to cast Divine Smite at
- Returns:
the damage taken
- Return type:
non-negative integer
- Raise:
ValueError if self doesn’t have the Divine Smite feature
DnD_5e.character_classes.ranger module
DnD_5e.character_classes.rogue module
- class DnD_5e.character_classes.rogue.Rogue(**kwargs)[source]
Bases:
CharacterRogue character class
- current_eq(other) bool[source]
Compare self and other to determine if they are identical based on the attributes checked in equals and also these attributes: stroke of luck slots
- can_see(light_src: str) bool[source]
Determine whether self can see a given light source. If self can’t see according to superclass method, look at blindsense feature.
- Parameters:
light_src (one of these strings: "normal", "dark", "magic") – a kind of light
- Returns:
True if self can see light_src, False otherwise
- Return type:
- get_adv_to_be_hit() int[source]
The sum of advantage (+1) and disadvantage (-1) circumstances affecting self is stored in self._adv_to_be_hit. Look at this number and return an integer indicating whether an attack against self has advantage, disadvantage, or neither. Look at the “elusive” feature.
- Returns:
positive if attacks against self have advantage, negative if they have disadvantage, and 0 otherwise
- Return type:
one of these integers: -1, 0, 1
- get_stroke_of_luck_slots() int[source]
- Returns:
stroke of luck slots
- Return type:
non-negative integer
- get_sneak_attack_dice() Tuple[int, int][source]
- Returns:
sneak attack dice
- Return type:
TYPE_DICE_TUPLE
- can_make_sneak_attack(weapon, target, adv) bool[source]
Determine if self can make a sneak attack against target. NOT IMPLEMENTED YET
- roll_sneak_attack_dice() int[source]
Roll sneak attack dice
- Returns:
the number rolled by the sneak attack dice
- Return type:
non-negative integer
- take_stroke_of_luck()[source]
Use the Stroke of Luck feature. NOT IMPLEMENTED YET.
- Returns:
None
- Raise:
ValueError if self has no stroke of luck slots
DnD_5e.character_classes.sorcerer module
- class DnD_5e.character_classes.sorcerer.Sorcerer(**kwargs)[source]
Bases:
SpellCaster,CharacterSorcerer character class
- current_eq(other) bool[source]
Compare self and other to determine if they are identical based on the attributes checked in equals and also these attributes: sorcery points
- get_full_sorcery_points() int[source]
- Returns:
full sorcery points
- Return type:
non-negative integer
- spend_sorcery_points(points: int) int[source]
Spend a given number of sorcery points
- Parameters:
points (non-negative integer) – the number of sorcery points to spend
- Returns:
the number of sorcery points spent
- Return type:
positive integer
- Raise:
ValueError if points is invalid or self doesn’t have enough sorcery points
- spell_slot_to_sorcery_points(level: int)[source]
Convert a spell slot to sorcery points
- Parameters:
level (integer between 1 and 9 (inclusive)) – the level of the spell slot being used
- Returns:
None
- Raise:
ValueError if level is invalid
DnD_5e.character_classes.warlock module
DnD_5e.character_classes.wizard module
- class DnD_5e.character_classes.wizard.Wizard(**kwargs)[source]
Bases:
SpellCaster,CharacterWizard character class
- current_eq(other)[source]
Compare self and other to determine if they are identical based on the attributes checked in equals and also these attributes: signature spell slots
- get_spell_mastery_names() set[source]
- Returns:
name of Spells that self has Spell Mastery for
- Return type:
set of strings
- get_signature_spell_slots() dict[source]
- Returns:
signature spell slots
- Return type:
dict mapping spell names to the number of slots left to use that as a signature spell
- spend_spell_slot(level: int, spell=None)[source]
Spend a spell slot of the given level. Deal with spell mastery and signature spells appropriately.
- Parameters:
level (an integer from 0 to 9 (inclusive)) – the spell level
spell (Spell) – the spell that is being used
- Returns:
None
- Raise:
ValueError if self doesn’t have any spell slots of level level