Пример #1
0
        public void ItRollsAllTheDiceWhenRollingTheCup()
        {
            var cup = new Cup();

            cup.AddDie(Die.D6());
            cup.AddDie(Die.D6());
            cup.Roll();
            Assert.True(cup.Dice.All(x => x.LastRoll > 0));
        }
Пример #2
0
        public void ResultIsTheSumOfAllDiceRolled()
        {
            var cup = new Cup();

            cup.AddDie(Die.D6());
            cup.AddDie(Die.D6());
            var result = cup.Roll();

            Assert.Equal(result, cup.Dice.Sum(x => x.LastRoll));
        }
Пример #3
0
        public void AnyTypeOfDieMayBeAddedToTheCup()
        {
            var cup = new Cup();

            cup.AddDie(Die.D4());
            cup.AddDie(Die.D10());
            cup.AddDie(Die.D6());

            Assert.Equal(new Die[] { Die.D4(), Die.D10(), Die.D6() }, cup.Dice);
        }
Пример #4
0
        public void ReturnsACountOfAllDiceInTheCup()
        {
            var cup = new Cup();

            cup.AddDie(Die.D10());
            Assert.Equal(1, cup.Count);
            cup.AddDie(Die.D4());
            Assert.Equal(2, cup.Count);
            cup.AddDie(Die.D6());
            Assert.Equal(3, cup.Count);
        }
Пример #5
0
        public void FormatsCupIntoADiceString()
        {
            var cup = new Cup();

            cup.AddDie(Die.D10());
            Assert.Equal("1d10", cup.ToString());
            cup.AddDie(Die.D10());
            Assert.Equal("2d10", cup.ToString());
            cup.Modifier = 5;
            Assert.Equal("2d10+5", cup.ToString());
            cup.AddDie(Die.D6());
            Assert.Equal("2d10+1d6+5", cup.ToString());
        }
Пример #6
0
        public void CupCanHaveABaseValueForTheRoll()
        {
            var cup = new Cup();

            cup.AddDie(Die.D4());
            cup.Modifier = 20;
            Assert.True(cup.Roll() >= 20);
        }
Пример #7
0
        public void CupCanHaveABaseValueForTheRoll()
        {
            var cup = new Cup();

            cup.AddDie(Die.D4());
            cup.Modifier = 20;
            Assert.GreaterOrEqual(cup.Roll(), 20);
        }
Пример #8
0
        /// <summary>
        /// Rolls the level up hit points
        /// </summary>
        /// <returns>The level up hitpoint amount.</returns>
        /// <param name="character">Character to roll hit points for.</param>
        public int RollLevelUp(CharacterSheet character)
        {
            var cup = new Cup();

            cup.AddDie(new Die(character.Class.HitDice));
            cup.Modifier = character.AbilityScores.GetModifier(AbilityScoreTypes.Constitution);
            return(cup.Roll());
        }
Пример #9
0
        public void ExecuteStep(CharacterSheet character)
        {
            var cup = new Cup();

            cup.AddDie(new Die(character.Class.HitDice));
            var roll      = cup.Roll();
            var modifier  = new ValueStatModifier(roll);
            var hitpoints = character.FindStat(StatNames.HitPoints);

            hitpoints.AddModifier(modifier);
            hitpoints.AddModifier(character.AbilityScores.GetAbility(AbilityScoreTypes.Constitution).UniversalStatModifier);
        }