示例#1
0
        // Return the result of a roll, considered as a melee roll
        public int getMeleeResult()
        {
            // Get the maximal dice
            int result = getMax();
            // Find the two others maximal value
            int i;

            // Treat the two next dices
            for (i = 1; i < Math.Min(3, DicesList.Count); i++)
            {
                result += (DicesList[i] == 6) ? 2 : 1;
            }

            // Add the other +1 for the extra 6
            if (DicesList.Count > 3)
            {
                // Get the total number of 6
                int nbSix = DicesList.FindAll(x => x == 6).Count;
                // If there is more than three 6
                if (nbSix > 3)
                {
                    // you have to add those which haven't been treated here
                    result += nbSix - 3;
                }
            }

            // Return the result
            return(result);
        }
示例#2
0
 // Process the list of dices to extract a result
 public void TreatList()
 {
     // Sort the dice in decreasing order
     DicesList.Sort();
     DicesList.Reverse();
     // Remove all the one
     DicesList.RemoveAll(x => x == 1);
     DicesList.RemoveAll(x => x == 0);
 }
 public void AddDice(Dices to_add)
 {
     foreach (Dices dices in DicesList)
     {
         if (dices.DiceValue == to_add.DiceValue)
         {
             dices.DiceAmount += to_add.DiceAmount;
             return;
         }
     }
     DicesList.Add(to_add);
 }
示例#4
0
        // Return the result of a roll, considered as a opposed roll
        public int getOpposedResult()
        {
            // Initialise the result to the maximal value
            int result = getMax();
            // Try to add others 6
            // Get the number of 6 of the roll
            int nbSix = DicesList.FindAll(x => x == 6).Count;

            // Add every 6 that has not been counted yet
            result += Math.Min(0, nbSix - 1);

            return(result);
        }
示例#5
0
 // Remove the highest roll
 public void RemoveHighestDice()
 {
     DicesList.RemoveAt(0);
 }