Dnd-character

Latest version: v23.7.29

Safety actively analyzes 623383 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

23.07.29

Breaking Changes

- Things previously represented solely by dicts (monsters, spells, items) are now represented by their own serializable objects. Actually, they are dataclasses from the standard library. See the updated README.
- Character `class_spellcasting` was removed to reduce redundancy in the character data
- Previous wealth-changing methods have been replaced with the new `change_wealth` (lower wealth with negative input)
- Every remaining camelCase method was replaced with snake_case
- `maximum_hp` renamed to `get_maximum_hp`
- `getModifier` renamed to `get_ability_modifier`

Bug fixes

- Character `spell_slots` is no longer blank. Instead, it is a dict containing the maximum spell slots, cantrips known, and spells known for the character's class level.
- Character class no longer defines `__getitem__` or `keys` so it does not itself function like a dict. Instead it defines `__iter__`, which accomplishes the same end-result of allowing Character to become a dict without the undesired side-effect of acting like it already is one. This is also consistent with dataclasses.
- `repr(character)` now prints a statement that will reconstruct the object in Python, as it does for dataclasses

New Features

- Character now defines `__eq__` and will return `True` if compared against an identical character (or a dict of an identical character)
- Wealth is now a float with 1.00 equal to 1 gp.
- Other coins are stored in a new optional property, `wealth_detailed`
- `{'pp': 0, 'gp': 0, 'ep': 0, 'sp': 0, 'cp': 0}`
- Added `conditions` dict for storing conditions as booleans:
- blinded
- charmed
- deafened
- frightened
- grappled
- incapacitated
- invisible
- paralyzed
- petrified
- poisoned
- prone
- restrained
- stunned
- unconscious
- All conditions start out as False, of course.

[View on PyPI](https://pypi.org/project/dnd-character/23.7.29/)

23.07.22

Breaking Changes
- Finished renaming "armour" to "armor" (in methods of the Character class)


New Features
- Re-added dice functions (thanks to gergo-szabo) now in `dice.py`
- Roll 4d6 and drop the lowest:

from dnd_character.dice import sum_rolls
sum_rolls(d6=4, drop_lowest=True)

- Roll d20 with advantage:

from dnd_character.dice import roll_with_advantage_disadvantage
roll_with_advantage_disadvantage(dice=20, advantage=True)


Minor Changes
- Serialized version of characters is smaller due to not including superfluous copies of data (level 20 bard used to produce a 56kb json file and now produces a 36kb file instead)



[View on PyPI](https://pypi.org/project/dnd-character/23.7.22/)

23.07.12

**Small breaking changes** - two things have been renamed!

Changes
- Renamed `hp` to `current_hp`
- Renamed `biography` to `background`
- Added `species` which does nothing currently.
- Added `speed` which does nothing currently (defaults to 30).
- Added `temp_hp` for temporary HP
- Added `personality`, `bonds`, `ideals`, and `flaws`
- Added `max_hd` and `current_hd` for tracking hit dice (*note:* `hd` is for the dice itself, e.g., d8, d10)
- Added `exhaustion` which initializes to 0. Actual exhaustion mechanics will come in a later version.

[View on PyPI](https://pypi.org/project/dnd-character/23.7.12/)

23.06.28

**This is a major update** - lots of structures changed and things have been renamed!

Changes
- The `json_cache` is updated to be more in line with the new [5e SRD API](http://www.dnd5eapi.co/). Mostly this means that there is a lot more consistency between different entries so you don't have to check if keys exist before accessing them from the dictionary/object.
- To match with the SRD as we have it, `armour_class` property on characters has been renamed to `armor_class`

[View on PyPI](https://pypi.org/project/dnd-character/23.6.28/)

22.04.18

Changes
- `chargeWealth` is removed. Its functionality is now rolled into `removeWealth`. This means that removeWealth returns a boolean and will not reduce the character's wealth if the amount is larger than the current wealth.
- Test coverage of the character class increased from 70% to 99% -- the "starting options" are still not tested.

Bugs fixed
- Removing armour from a character with shield equipped will no longer remove the AC bonus from the shield.

[View on PyPI](https://pypi.org/project/dnd-character/22.4.18/)

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.