Skip to main content

A light, Roll20 syntax compatible, python dice roller

Project description

PyRoll20

An easy to use, Roll20 syntax compatible,python dice roller.

Installing

pip3 install pyroll20

Usage Example

from pyroll20.pyroll20 import roll

print(roll(user_input="2d20"))

>> [12,8]

or with a modifier

from pyroll20.pyroll20 import roll

print(roll(user_input="2d20+5"))

>> 23 

Modifiers

'h' # Highest Rolls - 5d20h3 returns the 3 highest rolls from the five d20 that were rolled.
'l' # Lowest Rolls - 5d20l3 returns the 3 lowest rolls from the five d20 that were rolled.
'+' # Adds to sum - 5d20+3 adds 3 to the sum of the five d20 that were rolled, always returns a single integer.
'-' # Subtracts from sum - 5d20-3 subtracts 3 from the sum of the five d20 that were rolled, always returns a single integer.
'.-' # Subtracts from each individual roll - 5d20.-3 subtracts 3 from each of the five d20 that were rolled.
'.+' # Adds to each individual roll - 5d20.+3 adds 3 to each of the five d20 that were rolled.
't' # Sum of all rolls - 5d20t returns the sum of the five d20 that were rolled.
'e' # "Exploding dice - 5d20e if any of the five rolls goes critical, it gets re-rolled and added to the individual roll.

Notes

If sides are provided but no roll number, the roll number defaults to 1, for example d20 is a valid input.

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE v3.

TODO

Advantage and disadvantage[Not working] Wrap it in some sort of gui for a standalone app.[Maybe]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyroll20-0.1.9.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

pyroll20-0.1.9-py3-none-any.whl (15.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page