Exemple #1
0
        private int roll_stat()
        {
            var         roller     = new DiceRoller(6);
            IList <int> rolls      = new List <int>();
            var         roll_total = 0;
            int         roll       = 0;

            if (radio3d6.Checked.Equals(true))
            {
                for (var i = 0; i < 3; ++i)
                {
                    roll = roller.GetRoll();
                    if (reroll1s.Checked)
                    {
                        while (roll == 1)
                        {
                            roll = roller.GetRoll();
                        }
                    }
                    rolls.Add(roll);
                }
            }
            else
            {
                for (var i = 0; i < 4; ++i)
                {
                    roll = roller.GetRoll();
                    if (reroll1s.Checked)
                    {
                        while (roll == 1)
                        {
                            roll = roller.GetRoll();
                        }
                    }
                    rolls.Add(roll);
                }
                rolls = rolls.OrderByDescending(i => i).ToList();
                rolls.RemoveAt(3);
            }

            foreach (var i in rolls)
            {
                roll_total += i;
            }

            return(roll_total);
        }
Exemple #2
0
 public modified_dice_roller_control()
 {
     InitializeComponent();
     dice_sides_label.Text = "d" + Die.ToString() + " +";
     roller = new DiceRoller(Die);
 }