コード例 #1
0
ファイル: Dice.cs プロジェクト: sevans19/TheWorld
        /// <summary>
        /// Roll a number of the specified type of dice.
        /// </summary>
        /// <param name="type">Type.</param>
        /// <param name="count">numbre of dice to throw.</param>
        /// <returns>The Sum of all dice thrown</returns>
        public static int Roll(Dice.Type type, int count)
        {
            int total = 0;

            for (int i = 0; i < count; i++)
            {
                total += rand.Next((int)type) + 1;
            }
            return(total);
        }
コード例 #2
0
        /// <summary>
        /// Roll a number of the specified type of dice.
        /// </summary>
        /// <param name="type">Type.</param>
        /// <param name="count">numbre of dice to throw.</param>
        /// <returns>The Sum of all dice thrown</returns>
        public static int Roll(Dice.Type type, int count = 1, int modifier = 0)
        {
            int total = 0;

            for (int i = 0; i < count; i++)
            {
                total += GodPlaysDice.Next((int)type) + 1;                  // +1 because Dice don't have a zero.
            }
            return(total + modifier);
        }
コード例 #3
0
ファイル: Damage.cs プロジェクト: Mikrus708/DnD_noob_editor
 public int this[Dice.Type t]
 {
     get
     {
         return(diceNum[(int)t]);
     }
     set
     {
         diceNum[(int)t] = value;
         NotifyPropertyChanged("Item[]");
         NotifyPropertyChanged("Name");
     }
 }
コード例 #4
0
ファイル: Damage.cs プロジェクト: Mikrus708/DnD_noob_editor
 public void Add(Dice.Type t, int ammount = 1)
 {
     this[t] += ammount;
 }