public void VantageType_LimitsDiceCount(VantageType vantageType)
        {
            var diceTray = new DiceTray("d20", "5", "0", vantageType);
            int expected = 2;

            var actual = diceTray.DiceCount;

            Assert.Equal(expected, actual);
        }
Exemple #2
0
        private void RollButton_Click(object sender, RoutedEventArgs e)
        {
            VantageType vantageType = GetVantage();
            var         diceTray    = new DiceTray(diceSelector.Text, diceCount.Text, modifier.Text, vantageType);
            var         rollMessage = new RollMessage(diceTray);
            string      message     = $"You Rolled {rollMessage.RollMade}\n" +
                                      $"Your rolls were {rollMessage.Rolls}\n" +
                                      $"Result = {rollMessage.Result}";

            MessageBox.Show(this, message, rollMessage.CritMessage);
        }
Exemple #3
0
        public void DiceRoll(string diceType, string diceCount, string bonus, VantageType vantageType = VantageType.NoVantage)
        {
            var stringToInt = new StringToInt();

            Bonus       = stringToInt.ZeroOrGreater(bonus);
            DiceCount   = stringToInt.OneOrGreater(diceCount);
            DiceType    = stringToInt.OneOrGreater(diceType);
            VantageType = vantageType;
            CheckVantageType();
            RollDice();
            Crit = CheckIfCrit();
        }