Exemple #1
0
 public int rollDieInt(DieFormula df)
 {
     int[] rolls = new int[df.NumberOfDie];
     for (int i = 0; i < rolls.Length; i++)
     {
         rolls[i] = random.Next(1, ((int)df.Die) + 1);
     }
     return(rolls.Sum() + df.NumToAdd);;
 }
Exemple #2
0
        public String rollDie(DieFormula df)
        {
            int[] rolls = new int[df.NumberOfDie];
            for (int i = 0; i < rolls.Length; i++)
            {
                rolls[i] = random.Next(1, ((int)df.Die) + 1);
            }
            String toReturn = "Your rolls are";

            foreach (int roll in rolls)
            {
                toReturn += " " + roll + ",";
            }
            toReturn += " for a total of " + rolls.Sum() + "mod: " + df.NumToAdd;
            return(toReturn);
        }