Exemplo n.º 1
0
        public void CriticalSuccessAlwaysHits()
        {
            var random = new CriticalSuccessSource();

            MeleeHittingPolicy sut = new MeleeHittingPolicy(random);

            Assert.IsTrue(sut.DetermineHit(_source, _target));
        }
Exemplo n.º 2
0
        public void CriticalFailAlwaysMisses()
        {
            var random = new CriticalFailSource();

            MeleeHittingPolicy sut = new MeleeHittingPolicy(random);

            Assert.IsFalse(sut.DetermineHit(_source, _target));
        }
Exemplo n.º 3
0
        public void AttackMissesIfItsTotalIsLowerThanAc()
        {
            var random = new ControlledRandomSource {
                NextResult = 9
            };

            MeleeHittingPolicy sut = new MeleeHittingPolicy(random);

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

            MeleeHittingPolicy sut = new MeleeHittingPolicy(random);

            Assert.IsTrue(sut.DetermineHit(_source, _target));
        }
Exemplo n.º 5
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));
        }
Exemplo n.º 6
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));
        }