Skip to content

aloisdg/RollGen

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RollGen

Rolls a set of dice, as determined by the D20 die system.

Build status

Syntax

Use

To use RollGen, simple adhere to the verbose, fluid syntax:

var standardRoll = dice.Roll(3).d6();
var customRoll = dice.Roll(92).d(66);
var parsedRoll = dice.Roll("5+3d4*2");

Getting Dice Objects

You can obtain a Dice object in one of 2 ways:

  1. Recommended Use the Ninject Bootstrapper to inject the Dice object into your constructor

    var kernel = new StandardKernel();
    var rollGenModuleLoader = new RollGenModuleLoader();
    
    rollGenModuleLoader.LoadModules(kernel);
    

    Your particular syntax for how the Ninject injection should work will depend on your project (class library, web site, etc.)

  2. Manually build the Dice object:

    var random = new Random();
    var dice = new RandomDice(random);
    

    Important If you are newing up dice objects multiple times, the seed for the Random class that you use will potentially be the same, and will not produce random results. The Ninject bootstrapper has taken this into account and helps ensure random seeds for the Random object - which is why it is the recommended way to build your Dice object.

###Installing RollGen Install via the NuGet Package Manager.

There's RollGen and RollGen.Bootstrap - which do I install?

That depends on your project. If you are making a library that will only reference RollGen, but does not expressly implement it (such as the TreasureGen project), then you only need the RollGen package. If you actually want to run and implement the dice (such as on the DnDGenSite or in the tests for TreasureGen), then you need RollGen.Bootstrap, which will install RollGen as a dependency.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%