dice_tower 0.5.2

dice_tower #

A flutter package for rolling dice.

Currently implemented rule sets:

  • Dungeons & Dragons 5e

Planned rule sets:

  • Shadowrun 5e

Examples:

// Constructors

[0.5.2] - 2020/02/05

Fixes:

  • D&D 5e ruleset:
    • It was not using the special strings for natural 1s / 20s.
    • Pretty prints sum formatting fix.

[0.5.1] - 2020/02/04

Fixes:

  • D&D 5e ruleset:
    • unless I've missed something in the rule book, rolls cannot go below 0.

[0.5.0] - 2020/01/26

  • Initial release with Dungeons & Dragons 5e support.

example/example.dart

import "package:dice_tower/dice_tower.dart";

void main(List<String> arguments) async {
  // Defining dice pools.
  Dice d1 = Dice(20);
  Dice d2 = Dice(12, numberOfDice: 2);
  Dice d3 = Dice(10, modifier: -2);
  Dice d4 = Dice(8, modifier: 1, numberOfDice: 3);
  Dice d5 = Dice(4, modifier: -10, numberOfDice: 20, title: "Lemons & Limes");

  // Rolling a single dice pool.
  RollResult r1 = Dnd5eRuleset.roll([d1]);

  // Rolling x dice pool.
  RollResult r2 = Dnd5eRuleset.roll([d1, d2, d3, d4, d5]);

  // Pretty printing results.
  print(
      "Title: ${r1.title}\nSum: ${Dnd5eRuleset.prettyPrintSum(r1)}\nRoll Details: ${Dnd5eRuleset.prettyPrintResultDetails(r1)}");
  print(
      "Title: ${r2.title}\nSum: ${Dnd5eRuleset.prettyPrintSum(r2)}\nRoll Details: ${Dnd5eRuleset.prettyPrintResultDetails(r2)}");
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dice_tower: ^0.5.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dice_tower/dice_tower.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
17
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
55
Learn more about scoring.

We analyzed this package on Feb 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
effective_dart ^1.2.0
flutter_test