Beispiel #1
0
        /// <summary>
        /// Make a random roll for this DieRoll
        /// </summary>
        /// <returns>A RollResult object with the resulting rolling of the dice.</returns>
        public RollResult Roll()
        {
            RollResult result = new RollResult();

            result.Mod   = this.Mod;
            result.Total = this.Mod;

            foreach (DieRollElement element in this.AllRolls)
            {
                for (int i = 0; i < element.Count; i++)
                {
                    DieResult res = new DieResult();
                    res.Die       = element.Die;
                    res.Result   += Random.Next(1, element.Die + 1);
                    result.Total += res.Result;
                    result.Rolls.Add(res);
                }
            }

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Make a random roll for this DieRoll
        /// </summary>
        /// <returns>A RollResult object with the resulting rolling of the dice.</returns>
        public RollResult Roll()
        {
            RollResult result = new RollResult();
            result.Mod = this.Mod;
            result.Total = this.Mod;

            foreach (DieRollElement element in this.AllRolls)
            {
                for (int i = 0; i < element.Count; i++)
                {
                    DieResult res = new DieResult();
                    res.Die = element.Die;
                    res.Result += Random.Next(1, element.Die + 1);
                    result.Total += res.Result;
                    result.Rolls.Add(res);
                }
            }

            return result;
        }