项目作者: finitum

项目描述 :
Rust Dice Roller in dice notation
高级语言: Rust
项目地址: git://github.com/finitum/roll-rs.git
创建时间: 2020-11-25T18:29:26Z
项目社区:https://github.com/finitum/roll-rs

开源协议:European Union Public License 1.2

下载


Roll-rs

roll-rs is a dice roller that allows one to roll arbitrary dice and potentially combine them with arithmetic

Usage Modes

Normal usage

  1. $ roll d8 + 2d4
  2. d8 d4
  3. d8 + 2d4 = 8
  4. 3 1
  5. 4

Short mode

  1. $ roll -s d8 + 2d4
  2. d8 + 2d4 = [3] + [1, 4] = 8

Advanced mode
this allows using dice rolls to determine the sides and amount of another roll

  1. $ roll -a (d8)d(2d4)
  2. d8 d7 d4
  3. (d8)d(2d4) = 5
  4. 2 3 3
  5. 2 4

Notation

Standard
Standard notation allows you to roll any sided die any number of times
```shell script
d # roll a single 20 sided die
1d20 # equivalent

  1. **Percentile**
  2. You can use `%` as a shorthand for 100 sides
  3. ```shell script
  4. 3d% # roll a percentile die 3 times and add them together
  5. 3d100 # equivalent

Keep
The keep modifier allows you to roll multiple dice but only keep the highest or lowest result(s)
```shell script
4d8kh2 # roll a d8 4 times and keep the highest 2 rolls
4d8k2 # equivalent to the above
4d8kl1 # roll a d10 4 times and keep the lowest roll

  1. **Drop**
  2. The keep modifier allows you to roll multiple dice but drop the highest or lowest result(s)
  3. (Opposite of Keep).
  4. ```shell script
  5. 4d8dl2 # roll a d8 4 times and drop the lowest 2 rolls
  6. 4d8d2 # equivalent to the above
  7. 4d8dh1 # roll a d8 4 times and drop the highest roll

Maths

Roll-rs supports the following arithmetic operators

Operator Description
+ Plus
- Minus
* Multiplication
/ Division
// Integer division
mod Modulo
** Exponentiation

Roll-rs follows the normal order of operations and also allows the use of parenthesis to affect this.