Exemplo n.º 1
0
        public void TestUnitOrderAttackAfterMove()
        {
            session.StartTurn(session.PlayerTeam);

            //select Hector
            session.OnConfirmationInputReceived(20, 13);

            //move two squares north
            session.OnPositionHover(20, 14);
            session.OnPositionHover(20, 15);             //there should be an "Eastern Merc" directly north of us"

            //we should have both "Attack" and "Wait"
            MenuOpenedAction unitOptions = session.OnConfirmationInputReceived(20, 15)[0] as MenuOpenedAction;

            Assert.IsNotNull(unitOptions, "Did not get the unit menu as expected");
            Assert.AreEqual(unitOptions.OpenedMenu.MenuType, MenuTypes.Unit, "Did not get a unit menu");
            Assert.IsTrue(unitOptions.OpenedMenu.Actions.Contains("Attack"), "Did not have Attack as expected");

            //select "Attack"
            AttackDetailsMenuData attackMenu = (session.OnConfirmationInputReceived(MenuTypes.Unit, "Attack")[0] as MenuOpenedAction).OpenedMenu as AttackDetailsMenuData;

            Assert.IsNotNull(attackMenu, "Did not get the attack details menu as expected");
            Assert.AreEqual(attackMenu.MenuType, MenuTypes.AttackDetails, "Did not get a attack details menu");
            Assert.IsTrue(attackMenu.Actions.Contains("Attack"), "Did not have Attack as expected");

            //Trigger the attack
            List <GameAction>          attackResults = session.OnConfirmationInputReceived(MenuTypes.AttackDetails, "Attack");
            CombatHitAction            cha           = attackResults[0] as CombatHitAction;
            CombatDefenderDefeatAction cdda          = attackResults[1] as CombatDefenderDefeatAction;

            Assert.IsNotNull(cha, "Hector did not Hit");
            Assert.IsNotNull(cdda, "Hector did not win outright.");
            Assert.IsTrue(attackResults.Count > 3, "Did not include move actions");
        }
Exemplo n.º 2
0
        public void WeaponTriangleSwordBowTest()
        {
            //hit, nocrit, miss, nocrit
            engine.ResetRandomNumbers();
            List <int> randNumbs = new List <int> {
                99, 99, 0, 0, 0, 0
            };

            engine.AddRandomNumbers(randNumbs);

            //sword, axe, lance, bow
            UnitEntity[] testUnits = DataFactory.GetFE7EngineWeaponTestUnits();

            var result = engine.InitiateCombat(testUnits[0], testUnits[3], 1);

            Assert.AreEqual(result.Count, 2, "Did not have 2 actions");
            CombatMissAction cma = result[0] as CombatMissAction;             //Did not get a WTA bonus as expected

            Assert.IsNotNull(cma, "First action wasn't a miss");

            result = engine.InitiateCombat(testUnits[0], testUnits[3], 1);
            CombatHitAction cha = result[0] as CombatHitAction;

            Assert.AreEqual(cha.AttackerDamage, 1, "Erroneously got weapon triangle bonus damage");             //Did not get a WTA damage bonus as expected

            //test WTD damage reduction
            randNumbs = new List <int> {
                0, 0, 0, 70, 70, 0
            };
            engine.AddRandomNumbers(randNumbs);
            result = engine.InitiateCombat(testUnits[3], testUnits[0], 2);

            Assert.AreEqual(result.Count, 2, "Did not have 2 actions");
            CombatHitAction OneCHA = result[0] as CombatHitAction;                                     //Did not get a WDA penalty as expected

            Assert.AreEqual(OneCHA.AttackerDamage, 1, "Erroneously got weapon triangle bonus damage"); //Did not get a WDA damage penalty as expected
        }
Exemplo n.º 3
0
        public void WeaponTriangleAxeLanceTest()
        {
            //hit, nocrit, miss, nocrit
            engine.ResetRandomNumbers();
            List <int> randNumbs = new List <int> {
                99, 99, 0, 70, 70, 0
            };

            engine.AddRandomNumbers(randNumbs);

            //sword, axe, lance, bow
            UnitEntity[] testUnits = DataFactory.GetFE7EngineWeaponTestUnits();


            var result = engine.InitiateCombat(testUnits[1], testUnits[2], 1);

            Assert.AreEqual(result.Count, 3, "Did not have 3 actions");
            CombatHitAction  cha = result[0] as CombatHitAction;            //WTA hit increase works correctly.
            CombatMissAction cma = result[1] as CombatMissAction;           //WTD hit reduction works correctly.

            Assert.IsNotNull(cha, "First action wasn't a hit");
            Assert.IsNotNull(cma, "Second action wasn't a miss");
            Assert.AreEqual(cha.AttackerDamage, 2, "Didn't get weapon triangle bonus damage");             //WTA damage increase works correctly

            //test WTD damage reduction
            randNumbs = new List <int> {
                0, 0, 0, 70, 70, 0
            };
            engine.AddRandomNumbers(randNumbs);
            result = engine.InitiateCombat(testUnits[2], testUnits[1], 1);

            Assert.AreEqual(result.Count, 3, "Did not have 3 actions");
            CombatHitAction ZeroCHA = result[0] as CombatHitAction;

            Assert.AreEqual(ZeroCHA.AttackerDamage, 0, "Didn't get weapon triangle damage penalty");
        }