private int RollHitDie()
        {
            int health = DiceRoller.RollDie(model.PlayerClass.ClassHitDie);

            while (health == 1)
            {
                health = DiceRoller.RollDie(model.PlayerClass.ClassHitDie);
            }

            return(health);
        }
        public void RollStats()
        {
            Dictionary <string, int> baseStats = new Dictionary <string, int>();
            List <int> statRoll = DiceRoller.RollStats();

            for (int i = 0; i < 6; i++)
            {
                baseStats.Add(model.PlayerClass.ClassAbilityOrder[i], statRoll[i]);
            }

            foreach (KeyValuePair <string, int> kv in model.PlayerRace.RaceScoreBuff)
            {
                baseStats[kv.Key] += kv.Value;
            }

            model.PlayerAbilityScore = baseStats;
        }
Example #3
0
        public static List <int> RollStats()
        {
            //?? Sums
            List <int> sums = new List <int>();

            List <List <int> > stats = new List <List <int> >();

            //?? Loops, Certain Values
            do
            {
                // Clear all sums.
                sums.Clear();

                // Loop over each stat
                for (int i = 0; i < 6; i++)
                {
                    List <int> stat = new List <int>();

                    // generate 4 values.
                    for (int x = 0; x < 4; x++)
                    {
                        stat.Add(DiceRoller.RollDie(6));
                    }

                    // Sort
                    stat.Sort();

                    // Remove Lowest Element
                    stat.RemoveAt(0);

                    // Add to the list of sums.
                    sums.Add(stat.Sum());

                    // Add to list of stats.
                    stats.Add(stat);
                }
            } while (sums.Sum() < 70 || sums.Max() < 15);

            return((from sum in sums orderby sum descending select sum).ToList());
        }