DnD_5e.weapons package
Module contents
- class DnD_5e.weapons.Weapon(**kwargs)[source]
Bases:
objectThis class represents weapons
- has_prop(prop) bool[source]
Determine whether self has a given property
- Parameters:
prop – the property to check for
- Returns:
True if self has property prop, False otherwise
- Return type:
- get_range() Tuple[int, int][source]
- Returns:
range for ranged attacks
- Return type:
TYPE_RANGE_TUPLE
- get_damage_dice() DamageDice[source]
- Returns:
damage dice
- Return type:
- get_versatile() Tuple[int, int] | None[source]
- Returns:
dice for two-handed attack with versatile weapon
- Return type:
TYPE_DICE_TUPLE or None
- set_name(name: str)[source]
Set self._name
- Parameters:
name (str) – the name to change to
- Returns:
None
- Raise:
ValueError if name is not a string
- set_owner(owner)[source]
Set self._owner to a given owner (not typechecked)
- Parameters:
owner – the new owner of self
- Returns:
None
- set_attack_mod(attack_mod: int)[source]
Set self._attack_mod
- Parameters:
attack_mod (int) – the new attack mod
- Returns:
None
- Raise:
ValueError if attack_mod is not an integer
- set_damage_mod(damage_mod)[source]
Set self._damage_mod
- Parameters:
damage_mod (int) – the new attack mod
- Returns:
None
- Raise:
ValueError if damage_mod is not an integer
- get_attack_kwargs()[source]
Get the kwargs dictionaries for each
Attackthat can be made using this weapon. I would use this to build the attack themselves, but I need to avoid a circular import.- Returns:
a list of dicts, with one dictionary for each attack
- Return type:
dict of dicts: key is the attack name, value is the attack kwargs