Esempio n. 1
0
        public void AttackMissesIfItsTotalIsLowerThanAc()
        {
            var random = new ControlledRandomSource {
                NextResult = 9
            };

            MeleeHittingPolicy sut = new MeleeHittingPolicy(random);

            Assert.IsFalse(sut.DetermineHit(_source, _target));
        }
Esempio n. 2
0
        public void AttackHitsIfItsTotalIsGreaterThanArmorClass()
        {
            var random = new ControlledRandomSource {
                NextResult = 11
            };

            MeleeHittingPolicy sut = new MeleeHittingPolicy(random);

            Assert.IsTrue(sut.DetermineHit(_source, _target));
        }
Esempio n. 3
0
        public void AttackMissesIfTotalIsGreaterThanAcButRollIsCriticalFail()
        {
            var random = new ControlledRandomSource {
                NextResult = 1
            };

            MeleeHittingPolicy sut = new MeleeHittingPolicy(random);

            _source.SetAttribute(Attributes.Strength, 30);

            Assert.IsFalse(sut.DetermineHit(_source, _target));
        }
Esempio n. 4
0
        public void AttackHitsIfItsTotalIsEqualToArmorClass()
        {
            var random = new ControlledRandomSource {
                NextResult = 9
            };

            MeleeHittingPolicy sut = new MeleeHittingPolicy(random);

            _source.SetAttribute(Attributes.Strength, 12);

            Assert.IsTrue(sut.DetermineHit(_source, _target));
        }
        public void WeaponStrikeUsesWeaponDieForDamage()
        {
            ControlledRandomSource random = new ControlledRandomSource
            {
                NextResult = 0
            };

            Weapon weapon = new Weapon(1, 4);

            _source.EquipWeapon(weapon);

            Assert.AreEqual(1, _sut.CalculateDamage(_source, random));
        }