dice

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Roll

func Roll(def string) (int, error)

Roll the dice in given rpg dice definition (for example 3d6+2). Returns the result of the roll or an error of the def cannot be parsed.

func SupportedDice

func SupportedDice() map[int]Dice

Types

type Dice

type Dice uint

Dice represents a single game dice

const (
	D4   Dice = 4
	D6   Dice = 6
	D8   Dice = 8
	D10  Dice = 10
	D12  Dice = 12
	D20  Dice = 20
	D100 Dice = 100
)

func (Dice) Roll

func (d Dice) Roll() int

Roll the Dice and return the result.

func (Dice) RollMany

func (d Dice) RollMany(amount int) (result int)

RollMany rolls the Dice multiple times and sums up the results.

func (Dice) RollSpecial

func (d Dice) RollSpecial(amount, modifier int) int

RollSpecial is the same as RollMany, but after the rolls a modifier is also added to the result.

Jump to

Keyboard shortcuts

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