GoBCDice

module
v0.0.0-...-3319774 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2020 License: BSD-3-Clause

README

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.

  • Sum roll (加算ロール, D): xDn
    • With success check: xDn>=y etc.
  • Basic roll (バラバラロール, B): nBx
    • With success check: xBn>=y etc.
  • Exploding roll (個数振り足しロール, R): xRn>=y etc.
  • Compounding roll (上方無限ロール, U): xUn[t]
    • With success check: 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:

  • Embedding random number: [min...max]
  • Secret roll: SxDn etc.

The core dice roller also supports the following commands:

  • Calculation (arithmetic operation, C): C(1+2-3*4/5) etc.
  • Random sampling (choice): CHOICE[A,B,C] etc.
Operators

Operators available in dice rolling and calculation are listed.

Arithmetic operators

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

  • Unary operators
    • Unary plus (noop) +
    • Unary minus (sign inversion) -
  • Binary operators
    • Add +
    • Subtract -
    • Multiply *
    • Divide
      • Divide with rounding down /
      • Divide with rounding /R
      • Divide with rounding up /U
Comparison operators

Comparison operators are used for a success check.

  • Equal to =
  • Not equal to <>
  • Less than <
  • Less than or equal to <=
  • Greater than >
  • Greater than or equal to >=

Author

raa0121

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

Directories

Path Synopsis
cmd
pkg
core
BCDiceの機能のうち、特定のダイスボットに依存しない基本的な機能を格納するパッケージ。
BCDiceの機能のうち、特定のダイスボットに依存しない基本的な機能を格納するパッケージ。
core/ast
BCDiceコマンドの抽象構文木のノードを定義するパッケージ。
BCDiceコマンドの抽象構文木のノードを定義するパッケージ。
core/command
BCDiceコマンドの実行処理のパッケージ。
BCDiceコマンドの実行処理のパッケージ。
core/dice
ダイスの内部表現のパッケージ。
ダイスの内部表現のパッケージ。
core/dice/feeder
1個1個のダイスの供給の仕方を定義するパッケージ。
1個1個のダイスの供給の仕方を定義するパッケージ。
core/dice/roller
ダイスを振る処理のパッケージ。
ダイスを振る処理のパッケージ。
core/evaluator
BCDiceコマンドの評価処理のパッケージ。
BCDiceコマンドの評価処理のパッケージ。
core/notation
抽象構文木の中置表記生成処理のパッケージ。
抽象構文木の中置表記生成処理のパッケージ。
core/object
BCDiceコマンドの評価結果として生成される数値などのオブジェクトの内部表現のパッケージ。
BCDiceコマンドの評価結果として生成される数値などのオブジェクトの内部表現のパッケージ。
dicebot
ダイスボットのインターフェースを定義するパッケージ。
ダイスボットのインターフェースを定義するパッケージ。
dicebot/gamesystem
各ゲームシステムに対応したダイスボットは、このパッケージの下に配置する。
各ゲームシステムに対応したダイスボットは、このパッケージの下に配置する。
dicebot/gamesystem/basic
ダイスボットの基本機能のパッケージ。
ダイスボットの基本機能のパッケージ。
dicebot/list
ダイスボットの一覧を管理するパッケージ。
ダイスボットの一覧を管理するパッケージ。
dicebot/testing
ダイスボットのテストの共通処理のパッケージ。
ダイスボットのテストの共通処理のパッケージ。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL