Flexible Dungeons and Dragons entity manager and helper
pydnd is structured to be installed via pip. It requires python 3.8 or later, so check your python version before attempting to install by doing
python --version
to make sure that your version of python is compatible. If it is, installation can be completed by navigating to where the outermost pydnd folder is (if you can see setup.py, you have gone too far) and running
python -m pip install pydnd
to install the package to your python environment. If you want to use the scripts included with pydnd, make sure that your environment path has the scripts folder of your preferred python environment.
The most common action in Dungeons and Dragons is rolling dice, so this feature is exposed at the outermost level, so it can be done a few different ways. The first step is knowing the basic syntax for the dice.
xdy
- Roll x number of y sided dice
xdydz
- Roll x number of y sided dice dropping the lowest z dice
xdykz
- Roll x number of y sided dice keeping the highest z dice
d is shorthand for dl which stands for drop lowest
k is shorthand for kh which stands for keep highest
dh and kl (drop highest and keep lowest respectively) are also supported
xdyrz
- Roll x number of y sided dice rerolling all values < = z
xdyroz
- Roll x number of y sided dice rerolling < = z only once
With python: python -m pydnd 1d20
With script: pydnd 1d20
In the interpreter with the package:
import pydnd
pydnd.roll('1d20')
In the interpreter with a custom randomizer:
from custom_random_package import some_randint_function
from pydnd import dice_bag
roller = dice_bag.Roller(some_randint_function)
roller.roll('1d20')
The Monster class in pydnd is designed to make creating creatures as painless as possible. Many of the table lookups and calculations are built into the class, so you have to input as little information as possible to get a monster working. Much of a monster's math is based upon its size and cr, so once those are entered, the rest of the setup is just telling the class what proficiencies that creature has.
See help(pydnd.Monster)
for more details.
The NonPlayerCharacter class is a work in progress. Please check back regularly for any updates.
The Player class is a work in progress. Please check back regularly for any updates.