Exemplo n.º 1
0
        public void GivenASingleUnitSquad_WhenAllAttackedByASurvivableLethalAttackFromWingmanA_ThenTheDefenderCounterSinceNotAttacked()
        {
            Squad DummySquad = CreateDummySquadWithWingmans();
            Squad EnemySquad = CreateDummySquad();

            DummySquad.CurrentLeader.ListAttack[0].PowerFormula   = "0";
            DummySquad.CurrentLeader.ListAttack[0].Pri            = Core.Attacks.WeaponPrimaryProperty.ALL;
            DummySquad.CurrentWingmanA.ListAttack[0].PowerFormula = "20000";
            DummySquad.CurrentWingmanB.ListAttack[0].PowerFormula = "0";

            DummySquad.CurrentLeader.AttackIndex   = 0;
            DummySquad.CurrentWingmanA.AttackIndex = -1;
            DummySquad.CurrentWingmanB.AttackIndex = -1;

            EnemySquad.CurrentLeader.AttackIndex = 0;

            DummySquad.CurrentLeader.BattleDefenseChoice   = Unit.BattleDefenseChoices.Evade;
            DummySquad.CurrentWingmanA.BattleDefenseChoice = Unit.BattleDefenseChoices.Evade;
            DummySquad.CurrentWingmanB.BattleDefenseChoice = Unit.BattleDefenseChoices.Evade;

            EnemySquad.CurrentLeader.BattleDefenseChoice = Unit.BattleDefenseChoices.Evade;

            EnemySquad.IsPlayerControlled = false;
            DummyMap.SpawnSquad(0, DummySquad, 1, new Vector3(3, 5, 0), 0);
            DummyMap.SpawnSquad(1, EnemySquad, 2, new Vector3(5, 5, 0), 0);
            DummyMap.BattleMenuOffenseFormationChoice = BattleMap.FormationChoices.ALL;
            DummyMap.BattleMenuDefenseFormationChoice = BattleMap.FormationChoices.Spread;
            DummyMap.PrepareSquadsForBattle(0, 0, 1, 0);

            Assert.AreEqual(Unit.BattleDefenseChoices.Attack, DummySquad.CurrentLeader.BattleDefenseChoice);
            Assert.AreEqual(Unit.BattleDefenseChoices.Defend, DummySquad.CurrentWingmanA.BattleDefenseChoice);
            Assert.AreEqual(Unit.BattleDefenseChoices.Defend, DummySquad.CurrentWingmanB.BattleDefenseChoice);

            Assert.AreEqual(Unit.BattleDefenseChoices.Attack, EnemySquad.CurrentLeader.BattleDefenseChoice);

            Assert.AreEqual(0, DummySquad.CurrentLeader.AttackIndex);
            Assert.AreEqual(-1, DummySquad.CurrentWingmanA.AttackIndex);
            Assert.AreEqual(-1, DummySquad.CurrentWingmanB.AttackIndex);

            Assert.AreEqual(0, EnemySquad.CurrentLeader.AttackIndex);
        }
Exemplo n.º 2
0
        public void TestGetTargetsMoveSuccess()
        {
            DeathmatchScriptHolder.GetTargets Test = new DeathmatchScriptHolder.GetTargets();
            Test.AddMovementToRange = true;
            CoreScriptHolder.SetVariable Attack = new CoreScriptHolder.SetVariable();
            Squad DummySquad = CreateDummySquad();
            Squad EnemySquad = CreateDummySquad();

            DummyMap.SpawnSquad(0, DummySquad, 1, new Vector3(3, 5, 0));
            DummyMap.SpawnSquad(1, EnemySquad, 2, new Vector3(8, 8, 0));
            bool          IsCompleted;
            List <object> ListResult;

            Attack.Evaluate(null, DummySquad.CurrentLeader.ListAttack[0], out IsCompleted, out ListResult);
            Test.ArrayReferences[0].ReferencedScript = Attack;

            Test.Info = new GameScreens.DeathmatchMapScreen.DeathmatchAIInfo(DummyMap, DummySquad);
            List <object> ListEnemies = (List <object>)Test.GetContent();

            Assert.AreEqual(1, ListEnemies.Count);
        }
Exemplo n.º 3
0
        public void GivenASingleUnitSquad_WhenAllAttackedByASingleUnitSquadAtCounterRange_ThenTheDefenderDefend()
        {
            Squad DummySquad = CreateDummySquad();
            Squad EnemySquad = CreateDummySquad();

            DummySquad.CurrentLeader.ListAttack[0].PowerFormula = "4000";
            DummySquad.CurrentLeader.ListAttack[0].Pri          = Core.Attacks.WeaponPrimaryProperty.ALL;

            DummySquad.CurrentLeader.AttackIndex = 0;

            EnemySquad.CurrentLeader.AttackIndex = 0;

            EnemySquad.IsPlayerControlled = false;
            DummyMap.SpawnSquad(0, DummySquad, 1, new Vector3(3, 5, 0), 0);
            DummyMap.SpawnSquad(1, EnemySquad, 2, new Vector3(5, 5, 0), 0);
            DummyMap.BattleMenuOffenseFormationChoice = BattleMap.FormationChoices.ALL;
            DummyMap.BattleMenuDefenseFormationChoice = BattleMap.FormationChoices.Spread;
            DummyMap.PrepareSquadsForBattle(0, 0, 1, 0);

            Assert.AreEqual(Unit.BattleDefenseChoices.Defend, EnemySquad.CurrentLeader.BattleDefenseChoice);
            Assert.AreEqual(-1, EnemySquad.CurrentLeader.AttackIndex);
        }