raa0121 / GoBCDice

GoBCDice is BCDice reimplemented by Go.
BSD 3-Clause "New" or "Revised" License
9 stars 2 forks source link
bcdice dice-rolls

GoBCDice

Build Status Build status codecov

GoBCDice is a Go implementation of BCDice, a dice bot for tabletop RPGs supporting many Japanese game systems. It will consist of the core dice roller (dice notation parser and evaluator) and many game-system-specific dice bots.

Usage

Prerequisite: Go ≥ 1.12

Currently, only the REPL of GoBCDice can be built and run.

cd cmd/GoBCDiceREPL

# Build REPL
go build

# Run REPL
./GoBCDiceREPL

To modify and build the dice notation parser (pkg/core/parser/parser.go), you also need to install github.com/mna/pigeon first:

GO111MODULE=off go get -u github.com/mna/pigeon

And then build it with the following commands:

cd pkg/core/parser
make

Core dice roller

The core dice roller of GoBCDice provides the common dice rolling feature.

BCDice supports the following dice notations (the detailed description can be found at bcdice/BCDice/docs/README.txt on GitHub). The notations currently supported by GoBCDice are checked.

x: number of dice, n: sides of die, y: target number, t: threshold for rerolling dice.

The optional syntaxes are as follows:

The core dice roller also supports the following commands:

Operators

Operators available in dice rolling and calculation are listed.

Arithmetic operators

In arithmetic operations, a numerical value is treated as an integer.

Comparison operators

Comparison operators are used for a success check.

Author

raa0121

Original BCDice authors are Faceless and Taitai Takeru (たいたい竹流).