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.
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
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.
xDn
xDn>=y
etc.nBx
xBn>=y
etc.xRn>=y
etc.xUn[t]
xUn[t]>=y
etc.x: number of dice, n: sides of die, y: target number, t: threshold for rerolling dice.
The optional syntaxes are as follows:
[min...max]
SxDn
etc.The core dice roller also supports the following commands:
C(1+2-3*4/5)
etc.CHOICE[A,B,C]
etc.Operators available in dice rolling and calculation are listed.
In arithmetic operations, a numerical value is treated as an integer.
+
-
+
-
*
/
/R
/U
Comparison operators are used for a success check.
=
<>
<
<=
>
>=
Original BCDice authors are Faceless and Taitai Takeru (たいたい竹流).