Exemple #1
0
    public DiceData GenerateDiceResult(DiceData dice, int extraRoll = 0)
    {
        var r = new System.Random();

        int[] results = new int[dice.RollCnt * 2];
        for (int i = 0; i < (dice.RollCnt * 2) + extraRoll; i++)
        {
            results[i] = r.Next(dice.MinValue, dice.MaxValue + 1);
        }
        return(dice.Final(results));
    }
Exemple #2
0
 public DiceData this[DiceBase baseValue] {
     get {
         DiceData dice    = DiceTable[baseValue];
         var      r       = new System.Random();
         int[]    results = new int[dice.RollCnt * 2];
         for (int i = 0; i < (dice.RollCnt * 2); i++)
         {
             results[i] = r.Next(dice.MinValue, dice.MaxValue + 1);
         }
         return(dice.Final(results));
     }
 }