From 00670619f3a9ac80683f1a1d751349e010c602dc Mon Sep 17 00:00:00 2001 From: 简律纯 Date: Sat, 13 Sep 2025 02:34:14 +0800 Subject: feat: introduce new dice modifiers for grouping and merging, enhance variable references and instruction sequences in parser --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index edfca7a..8d31755 100644 --- a/README.md +++ b/README.md @@ -76,9 +76,11 @@ Dice Expression Syntax ---------------------- - `XdY`: Roll X dice with Y sides -- Modifiers: `kh`, `kl`, `dh`, `dl`, `!`, `r`, `ro` +- Modifiers: `kh`, `kl`, `dh`, `dl`, `!`, `e`, `r`, `ro`, `R`, `a`, `u`, `s`, `c`, `m`, `g`, `gs` - Mathematical operations: `+`, `-`, `*`, `/`, `^` - Comments: Add with `#`, e.g., `3d6 + 2 # Attack roll` +- Instruction sequences: Use `;` to separate multiple instructions +- Variable references: Use `$n` to reference the result of the nth instruction Examples -------- @@ -96,6 +98,18 @@ stats = oneroll.roll_statistics("3d6", 100) # Comment usage result = oneroll.roll("1d20 + 5 # Attack check") print(result["comment"]) + +# Instruction sequences +result = oneroll.roll("3d6; 1d20; 2d8") + +# Variable references +result = oneroll.roll("3d6; $1c6") # Count 6s in first roll + +# Group modifier +result = oneroll.roll("4d6g10") # Count groups >= 10 + +# Count modifier +result = oneroll.roll("5d6c6") # Count occurrences of 6 ``` Documentation -- cgit v1.2.3-70-g09d2