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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyroll20-0.1.9.tar.gz
.
File metadata
- Download URL: pyroll20-0.1.9.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9561b5f245aad6f509c24ccf7d9e8c2ffad22f42d9ae6936d6db6c8eb6c4002a |
|
MD5 | c878257a2121f4bc06619400faed180d |
|
BLAKE2b-256 | 06846f7d02420ff3e82cc2829cc4a3c2ca776ee01b8b9fb2962d2746a0bebeb9 |
File details
Details for the file pyroll20-0.1.9-py3-none-any.whl
.
File metadata
- Download URL: pyroll20-0.1.9-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffeda2703a307f029398a4c787e461f35a832f92348d3416504cca222e84604b |
|
MD5 | ac87827ef58e36bd4ee3023f7ac660e2 |
|
BLAKE2b-256 | f954dc5f53e4aabd9fd71d9c34c6a4f5497f189ebb26133ba7b203c198663272 |