Exemplo n.º 1
0
        private DieRollResults Roll(DieRoll dr, int count)
        {
            DieRollResults rolls = new DieRollResults();

            for (int i = 1; i <= count; i++)
            {
                rolls.Add(dr.Roll());
            }
            return(rolls);
        }
Exemplo n.º 2
0
        public void RollAbilities()
        {
            DieRoll dr;

            if (Method == RollingMethod.Simple)
            {
                // Simply roll 3d6 for each attribute and take what you get
                dr = new DieRoll(3, 6, 0);
                DieRollResults results = dr.MultiRoll(6);
                SetAbilities(results);
            }
            else if (Method == RollingMethod.Method1)
            {
                // Roll 4d6 for each ability and keep the top 3 dice
                dr      = new DieRoll(4, 6, 0);
                dr.Keep = 3;
                AbilityScores.Add(Ability.Strength, dr.Roll());
                AbilityScores.Add(Ability.Intelligence, dr.Roll());
                AbilityScores.Add(Ability.Wisdom, dr.Roll());
                AbilityScores.Add(Ability.Dexterity, dr.Roll());
                AbilityScores.Add(Ability.Constitution, dr.Roll());
                AbilityScores.Add(Ability.Charisma, dr.Roll());
            }
            else if (Method == RollingMethod.Method2)
            {
                // Roll 3d6 12 times and keep the best 6 results
                dr = new DieRoll(3, 6, 0);
                DieRollResults results = dr.MultiRoll(12, 6);
                results.KeepBest(6);
                SetAbilities(results);
            }
            else if (Method == RollingMethod.Method3)
            {
                // For each ability roll 3d6 6 times and keep the best result
                dr = new DieRoll(3, 6, 0);
                DieRollResults results = new DieRollResults();
                for (int i = 0; i < 6; i++)
                {
                    // when called with params Roll returns a RollResult;
                    // add the first and only member of this RollResult, an int,  to the results list
                    results.Add(dr.MultiRoll(6, 1)[0]);
                }
                SetAbilities(results);
            }
        }