示例#1
0
        private void Test_Execute_CantFire_Misfired()
        {
            //Action: atk (3) atk (3) atk (3) -> BA (misfire) (1)
            List <int> sequence = new List <int>()
            {
                3, 3, 3, 1
            };
            Rng         sequenceRng = new MockRng(sequence);
            List <IGun> singleOh    = new List <IGun>()
            {
                gunFactory.Get(GunType.PalmPistol)
            };

            player = new Player(sequenceRng, 11, 11, FightingStyle.Archery, mh, singleOh, feats, buffs);
            status = new PlayerStatus(sequenceRng, player);

            status.MainHandAttack(enemy);
            status.OffHandAttack(enemy);
            status.EndTurn();
            status.MainHandAttack(enemy);

            Assert.DoesNotThrow(() => ret = turnEvent.Execute(status, enemy));
            Assert.AreEqual(TurnStateEnum.End, ret);
            Assert.AreEqual(7, status.NumberOfShots);   //Didn't do second OH shot
            Assert.IsTrue(status.BonusActionAvailable);
        }
示例#2
0
        private void Test_Execute_CantFire_BrokenSwap()
        {
            //Action: atk (3) hit (1) atk (3) hit (1) atk (3) hit (1) -> BA (misfire) (1) -> try to fix with reaction (fail) (1)
            //turn 2: atk (3) hit (1) atk (3) hit (1) atk (3) hit (1) -> BA atk (2) (doesn't roll bc OH) ->
            //turn 3: Reload, atk (3) hit (1) atk (3) hit (1) -> BA cannot swap to OH because misfire
            List <int> sequence = new List <int>()
            {
                3, 1, 3, 1, 3, 1,
                1, 1,
                3, 1, 3, 1, 3, 1,
                2,
                3, 1, 3, 1
            };
            Rng         sequenceRng       = new MockRng(sequence);
            List <IGun> singleArtificerOh = new List <IGun>()
            {
                gunFactory.Get(GunType.PalmPistol, WeaponTier.ArtificerReloadProperty),
                gunFactory.Get(GunType.PalmPistol)
            };

            player = new Player(sequenceRng, 11, 11, FightingStyle.Archery, mh, singleArtificerOh, feats, buffs);
            status = new PlayerStatus(sequenceRng, player);

            status.MainHandAttack(enemy);
            status.OffHandAttack(enemy);
            Assert.AreEqual(GunFiringStatus.Broken, status.CurrentOffHand.Status);
            status.EndTurn();
            status.MainHandAttack(enemy);
            status.SwapOffHand();
            Assert.AreEqual(GunFiringStatus.Okay, status.CurrentOffHand.Status);
            status.OffHandAttack(enemy);
            Assert.IsTrue(!status.CurrentOffHand.HasShotLoaded());
            Assert.IsTrue(!status.CanSwapOffHand());
            status.EndTurn();
            status.MainHandAttack(enemy);

            Assert.DoesNotThrow(() => ret = turnEvent.Execute(status, enemy));
            Assert.AreEqual(TurnStateEnum.End, ret);
            Assert.AreEqual(10, status.NumberOfShots);   //Didn't do second OH shot, had to reload
            Assert.IsTrue(status.BonusActionAvailable);
            Assert.IsTrue(!status.CurrentOffHand.HasShotLoaded());
        }