JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q20921F
  • License ISC

Create dice and use them

Package Exports

  • devildice

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (devildice) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Devil Dice

Roll the dice a simple dice roller. Nothing over the top just roll.

The basics

The code will auto load in a d6 dice.

roll

var dd = require("devildice");

dd.roll();

//output : {"roll_0":[4]}

add die

var dd = require("devildice");

dd.addDice(20);

dd.roll();

//output : {"roll_0":[3,13]}

clear dice

var dd = require("devildice");

dd.clearStoredDice();

dd.roll();

//output : No dice to roll

show dice

var dd = require("devildice");

dd.addDice(20);
dd.addDice(10);
dd.addDice(3);


dd.showDice();

//output : {"dice":[{"key":0,"die":[1,2,3,4,5,6]},{"key":1,"die":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]},{"key":2,"die":[1,2,3,4,5,6,7,8,9,10]},{"key":3,"die":[1,2,3]}]}

remove dice

var dd = require("devildice");

dd.addDice(20);
dd.addDice(10);
dd.addDice(3);

//Use the key from dd.showDice();
// in this case 2 would be the  key for the d10
dd.removeDice(2);

Advanced dice

Roll All Dice

var dd = require("devildice");

dd.addDice(20);
dd.addDice(10);
dd.addDice(3);
dd.addDice(3);

dd.rollAllDice();

//output : {"roll_0":[4,4,2,1]}

Roll them x number of times (remember that by default a d6 is added so the first dice unless cleared is a d6)

var dd = require("devildice");

dd.addDice(20);
dd.addDice(10);
dd.addDice(3);
dd.addDice(3);

dd.rollAllDice(6);

//output : {"roll_0":[4,13,2,2,2],"roll_1":[2,7,2,3,2],"roll_2":[5,18,2,3,2],"roll_3":[1,6,6,3,2],"roll_4":[6,4,8,1,3],"roll_5":[1,8,9,2,3]}

if you like check the rest of my projects at https://github.com/TechDevils and maybe checkout ko-fi