/// <summary> /// Simulates a die roll with the given number of sides /// </summary> /// <param name="num">The number.</param> /// <returns></returns> public static int Roll(DiceSides num) { Random roller = new Random(); int r = roller.Next((int)num); return(r + 1); }
private Class(string name, DiceSides hd) { this.Levels = new List <Level>(); this.Name = name; this.HitDice = hd; this.HitDicePerLevel = new DiceClassLevelModifier(new Cup(new Die(HitDice)), StatNames.HitDice, this.Name, 1); }
/// <summary> /// Generates an array of die objects based on the the numbers of sides and count specified /// </summary> /// <returns>The dice array</returns> /// <param name="sides">Sides of all the dice</param> /// <param name="count">Count of dice to create</param> public static Die[] GetDice(DiceSides sides, int count) { var result = new Die[count]; for (int i = 0; i < count; i++) { result[i] = new Die(sides); } return(result); }
/// <summary> /// Initializes a new instance of the <see cref="SilverNeedle.Dice.Die"/> class. /// </summary> /// <param name="sides">Sides of the die</param> public Die(DiceSides sides) { this.Sides = sides; this.LastRoll = -1; }
public static Class CreateForTesting(string name, DiceSides hd) { return(new Class(name, hd)); }