Gurgle is yet another dice rolling crate using TRPG-like syntax.
```rust let attack = "3d6+2d4+1";
println!("roll your attack({}), result: {}", attack, gurgle::roll(attack).unwrap());
// output: roll your attack(3d6+2d4+1), result: 16 ```
```rust use gurgle::Gurgle;
let attack = "3d6+2d4+1>15"; let dice = Gurgle::compile(attack).unwrap(); let result = dice.roll();
println!("roll your attack({}), result: {}", attack, result);
// output: roll your attack(3d6+2d4+1>15), result: (4+3+1) + (1+3) + 1 = 15, target is >15, failed ```
Notice: Display
trait for rolling result is implemented only if feature detail
(which is enabled by default) is enabled.
But you can always use result.value()
to get rolling result value(i64), and result.success()
to get if it's a success.
Gurgle also support multiply and parentheses, see docs for full syntax and example.
BSD 3-Clause Clear License, See LICENSE.