示例#1
0
        public void GivenCharacterHasOneHitPointLeftWhenRollIsGreaterThanArmorThenCharacterIsDead()
        {
            var game = new EvercraftGame();

            game.Start("Jack", "Bob");
            game.Attack(11, game.Chars[1]);
            game.Attack(11, game.Chars[1]);
            game.Attack(11, game.Chars[1]);
            game.Attack(11, game.Chars[1]);

            game.Attack(11, game.Chars[1]);

            game.Chars[1].HitPts.Should().Be(0);
            game.IsDead(game.Chars[1]).Should().Be(true);
        }
示例#2
0
        public void GivenGameHasStartedWhenRollIsACriticalHitThenCharacterTakesDoubleDamage()
        {
            var game = new EvercraftGame();

            game.Start("Jack", "Bob");

            game.Attack(20, game.Chars[1]);

            game.Chars[1].HitPts.Should().Be(3);
        }
示例#3
0
        public void GivenGameHasStartedWhenRollIsLessThanArmorThenNoDamageIsDealt()
        {
            var game = new EvercraftGame();

            game.Start("Jack", "Bob");

            game.Attack(9, game.Chars[1]);

            game.Chars[1].HitPts.Should().Be(5);
        }
示例#4
0
        public void GivenGameHasStartedWhenRollIsEqualToArmorThenCharacterTakesDamage()
        {
            var game = new EvercraftGame();

            game.Start("Jack", "Bob");

            game.Attack(10, game.Chars[1]);

            game.Chars[1].HitPts.Should().Be(4);
        }
示例#5
0
        public void GivenGameHasStartedWhenSecondCharacterAttacksTheFirstThenFirstCharacterTakesDamage()
        {
            var game = new EvercraftGame();

            game.Start("Jack", "Bob");

            game.Attack(10, game.Chars[0]);

            game.Chars[0].HitPts.Should().Be(4);
        }
示例#6
0
        public void GivenFirstCharacterHasDexterityWithPositiveModifierWhenRollIsLessThanModifiedArmorThenFirstCharacterTakesNoDamage(int dexterity, int modifier)
        {
            var game = new EvercraftGame();

            game.Start("Jack", "Bob");
            game.ApplyDexterity(dexterity, game.Chars[0]);

            game.Attack(9 + modifier, game.Chars[0]);

            game.Chars[0].HitPts.Should().Be(5);
        }
示例#7
0
        public void GivenSecondCharacterHasStrengthWithPositiveModifierWhenRollIsModifiedToBeLessThanArmorThenSecondCharacterTakesOneDamage(int strength, int modifier)
        {
            var game = new EvercraftGame();

            game.Start("Jack", "Bob");
            game.ApplyStrength(strength, game.Chars[1]);

            game.Attack(9 - modifier, game.Chars[0]);

            game.Chars[0].HitPts.Should().Be(4);
        }
示例#8
0
        public void GivenSecondCharacterHasConstitutionWithNegative_5_ModifierWhenRollIsGreaterThanArmorThenSecondCharacterDies()
        {
            var game = new EvercraftGame();

            game.Start("Jack", "Bob");
            game.ApplyConstitution(1, game.Chars[1]);

            game.Attack(10, game.Chars[1]);

            game.IsDead(game.Chars[1]).Should().Be(true);
        }
示例#9
0
        public void GivenSecondCharacterHasDexterityWithPositiveModifierWhenRollIsGreaterThanModifiedArmorThenSecondCharacterTakesDamage(int dexterity, int modifier)
        {
            var game = new EvercraftGame();

            game.Start("Jack", "Bob");
            game.ApplyDexterity(dexterity, game.Chars[1]);

            game.Attack(10 + modifier, game.Chars[1]);

            game.Chars[1].HitPts.Should().Be(4);
        }
示例#10
0
        public void GivenCharacterHasStrengthWithNegativeModifierWhenRollIsModifiedToBeGreaterThanArmorThenCharacterTakesTwoDamage(int strength, int modifier)
        {
            var game = new EvercraftGame();

            game.Start("Jack", "Bob");
            game.ApplyStrength(strength, game.Chars[0]);

            game.Attack(10 - modifier, game.Chars[1]);

            game.Chars[1].HitPts.Should().Be(3);
        }
示例#11
0
        public void GivenFirstCharacterHasConstitutionWithPositiveModifierWhenRollIsGreaterThanArmorThenFirstCharacterIsAliveAfterAttacks(int constitution, int attacks)
        {
            var game = new EvercraftGame();

            game.Start("Jack", "Bob");
            game.ApplyConstitution(constitution, game.Chars[0]);

            for (var i = 0; i < attacks; i++)
            {
                game.Attack(10, game.Chars[0]);
            }

            game.IsDead(game.Chars[0]).Should().Be(false);
        }