GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - comigor/d20: Dart library for RPG dice rolling

BranchesTags
Open more actions menu

Latest commit

 

History

43 Commits
43 Commits

Folders and files

NameName
Last commit message
Last commit date
.devcontainer
.devcontainer
 
 
.github/workflows
.github/workflows
 
 
example
example
 
 
lib
lib
 
 
test
test
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
analysis_options.yaml
analysis_options.yaml
 
 
pubspec.yaml
pubspec.yaml
 
 

Repository files navigation

D20

View at pub.dev Test PRs Welcome Star on GitHub Fork on GitHub

D20 is a Dart library for RPG dice rolling. Supports standard notation (like "2d12", "d6+5" and "2d20-L").

Installation

Add the following to your pubspec.yaml file:

dependencies:
  d20: <1.0.0

then run:

pub get

or with flutter:

flutter packages get

Usage

import 'package:d20/d20.dart';

void main() {
  final d20 = D20();
  print(d20.roll('2d8+5+5d6'));
}

One can also get (probably) useful information of roll results:

import 'package:d20/d20.dart';

void main() {
  final d20 = D20();
  final stats = d20.rollWithStatistics('2d8+5+5d6');
  print(stats.results[0].faces);
  print(stats.results[1].results);
}

Supported notation

The standard dice notation will be parsed, such as 2d8+4.

L and H subtraction

When a -L or -H follows a roll, as in 2d20-L, the lowest (or highest) roll of the sequence will be subtracted from the result.

Operators

You can also use mathematical operators, such as 1d6*3 or 10d4/d6; or even 10 * sin(d20), though I'm not sure why you'd need that.

Percentile dice (d%)

You can also use use the d% notation instead of d100.

About

Dart library for RPG dice rolling

Topics

d20dartdart-librarydicedice-rollerflutterhacktoberfestrandomrpg

Resources

Readme
MIT license
Activity

Stars

10 stars

Watchers

1 watching

Forks

4 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.