public void GivenASingleUnitSquad_WhenFocusAttackedByAnUnsurvivableLethalAttackFromWingmanA_ThenTheDefenderCounter() { Squad DummySquad = CreateDummySquadWithWingmans(); Squad EnemySquad = CreateDummySquad(); DummySquad.CurrentLeader.ListAttack[0].PowerFormula = "0"; DummySquad.CurrentWingmanA.ListAttack[0].PowerFormula = "30000"; DummySquad.CurrentWingmanB.ListAttack[0].PowerFormula = "0"; DummySquad.CurrentLeader.AttackIndex = 0; DummySquad.CurrentWingmanA.AttackIndex = -1; DummySquad.CurrentWingmanB.AttackIndex = -1; EnemySquad.CurrentLeader.AttackIndex = 0; EnemySquad.IsPlayerControlled = false; DummyMap.SpawnSquad(0, DummySquad, 1, new Vector3(3, 5, 0)); DummyMap.SpawnSquad(1, EnemySquad, 2, new Vector3(5, 5, 0)); DummyMap.BattleMenuOffenseFormationChoice = BattleMap.FormationChoices.Focused; DummyMap.BattleMenuDefenseFormationChoice = BattleMap.FormationChoices.Spread; DummyMap.PrepareSquadsForBattle(DummySquad, EnemySquad); Assert.AreEqual(Unit.BattleDefenseChoices.Attack, DummySquad.CurrentLeader.BattleDefenseChoice); Assert.AreEqual(Unit.BattleDefenseChoices.Attack, DummySquad.CurrentWingmanA.BattleDefenseChoice); Assert.AreEqual(Unit.BattleDefenseChoices.Attack, DummySquad.CurrentWingmanB.BattleDefenseChoice); Assert.AreEqual(Unit.BattleDefenseChoices.Attack, EnemySquad.CurrentLeader.BattleDefenseChoice); Assert.AreEqual(0, DummySquad.CurrentLeader.AttackIndex); Assert.AreEqual(0, DummySquad.CurrentWingmanA.AttackIndex); Assert.AreEqual(0, DummySquad.CurrentWingmanB.AttackIndex); Assert.AreEqual(0, EnemySquad.CurrentLeader.AttackIndex); }
public void GivenASquadWithWingmans_WhenFocusAttackedByASingleUnitSquadAtCounterRange_ThenTheWingmansDefend() { Squad DummySquad = CreateDummySquad(); Squad EnemySquad = CreateDummySquadWithWingmans(); DummySquad.CurrentLeader.ListAttack[0].PowerFormula = "4000"; DummySquad.CurrentLeader.AttackIndex = 0; EnemySquad.CurrentLeader.AttackIndex = -1; EnemySquad.CurrentWingmanA.AttackIndex = -1; EnemySquad.CurrentWingmanB.AttackIndex = -1; 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.Focused; DummyMap.BattleMenuDefenseFormationChoice = BattleMap.FormationChoices.Focused; DummyMap.PrepareSquadsForBattle(0, 0, 1, 0); Assert.AreEqual(Unit.BattleDefenseChoices.Attack, DummySquad.CurrentLeader.BattleDefenseChoice); Assert.AreEqual(Unit.BattleDefenseChoices.Evade, EnemySquad.CurrentLeader.BattleDefenseChoice); Assert.AreEqual(Unit.BattleDefenseChoices.Evade, EnemySquad.CurrentWingmanA.BattleDefenseChoice); Assert.AreEqual(Unit.BattleDefenseChoices.Evade, EnemySquad.CurrentWingmanB.BattleDefenseChoice); Assert.AreEqual(0, DummySquad.CurrentLeader.AttackIndex); Assert.AreEqual(-1, EnemySquad.CurrentLeader.AttackIndex); Assert.AreEqual(-1, EnemySquad.CurrentWingmanA.AttackIndex); Assert.AreEqual(-1, EnemySquad.CurrentWingmanB.AttackIndex); }
public void GivenASquadWithWingmans_WhenAllAttackedByAnUnsurvivableLethalAttack_ThenTheWingmansEvade() { Squad DummySquad = CreateDummySquad(); Squad EnemySquad = CreateDummySquadWithWingmans(); DummySquad.CurrentLeader.ListAttack[0].PowerFormula = "20000"; DummySquad.CurrentLeader.ListAttack[0].Pri = Core.Attacks.WeaponPrimaryProperty.ALL; DummySquad.CurrentLeader.AttackIndex = 0; EnemySquad.CurrentLeader.AttackIndex = 0; EnemySquad.CurrentWingmanA.AttackIndex = 0; EnemySquad.CurrentWingmanB.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.Attack, DummySquad.CurrentLeader.BattleDefenseChoice); Assert.AreEqual(Unit.BattleDefenseChoices.Evade, EnemySquad.CurrentLeader.BattleDefenseChoice); Assert.AreEqual(Unit.BattleDefenseChoices.Evade, EnemySquad.CurrentWingmanA.BattleDefenseChoice); Assert.AreEqual(Unit.BattleDefenseChoices.Evade, EnemySquad.CurrentWingmanB.BattleDefenseChoice); Assert.AreEqual(0, DummySquad.CurrentLeader.AttackIndex); Assert.AreEqual(-1, EnemySquad.CurrentLeader.AttackIndex); Assert.AreEqual(-1, EnemySquad.CurrentWingmanA.AttackIndex); Assert.AreEqual(-1, EnemySquad.CurrentWingmanB.AttackIndex); }
public void GivenASingleUnitSquad_WhenFocusAttackedByASingleUnitSquadAtCounterRange_ThenTheDefenderCounterWithNonPostMovementAttack() { Squad DummySquad = CreateDummySquad(); Squad EnemySquad = CreateDummySquad(); DummySquad.CurrentLeader.ListAttack[0].PowerFormula = "4000"; Attack DummyAttack = new Attack("Dummy Attack", string.Empty, 0, "40000", 0, 5, WeaponPrimaryProperty.None, WeaponSecondaryProperty.None, 10, 0, 6, 1, 100, "Laser", new Dictionary <string, char>() { { "Air", 'S' }, { "Land", 'S' }, { "Sea", 'S' }, { "Space", 'S' } }); EnemySquad.CurrentLeader.ListAttack.Add(DummyAttack); 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.Focused; DummyMap.BattleMenuDefenseFormationChoice = BattleMap.FormationChoices.Spread; DummyMap.PrepareSquadsForBattle(0, 0, 1, 0); Assert.AreEqual(Unit.BattleDefenseChoices.Attack, EnemySquad.CurrentLeader.BattleDefenseChoice); Assert.AreEqual(1, EnemySquad.CurrentLeader.AttackIndex); }
public void GivenASingleUnitSquad_WhenAllAttackedByASurvivableLethalAttackFromBothWingmans_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 = "10000"; DummySquad.CurrentWingmanB.ListAttack[0].PowerFormula = "10000"; DummySquad.CurrentLeader.AttackIndex = 0; DummySquad.CurrentWingmanA.AttackIndex = -1; DummySquad.CurrentWingmanB.AttackIndex = -1; EnemySquad.CurrentLeader.AttackIndex = 0; EnemySquad.IsPlayerControlled = false; DummyMap.SpawnSquad(0, DummySquad, 1, new Vector3(3, 5, 0)); DummyMap.SpawnSquad(1, EnemySquad, 2, new Vector3(5, 5, 0)); DummyMap.BattleMenuOffenseFormationChoice = BattleMap.FormationChoices.ALL; DummyMap.BattleMenuDefenseFormationChoice = BattleMap.FormationChoices.Spread; DummyMap.PrepareSquadsForBattle(DummySquad, EnemySquad); 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); }
public void TestGetEnemies() { DeathmatchScriptHolder.GetEnemies Test = new DeathmatchScriptHolder.GetEnemies(); Squad DummySquad = CreateDummySquad(); Squad EnemySquad = CreateDummySquad(); DummyMap.SpawnSquad(0, DummySquad, 1, new Vector3(3, 5, 0)); DummyMap.SpawnSquad(1, EnemySquad, 2, new Vector3(7, 8, 0)); Test.Info = new GameScreens.DeathmatchMapScreen.DeathmatchAIInfo(DummyMap, DummySquad); List <object> ListEnemies = (List <object>)Test.GetContent(); Assert.AreEqual(1, ListEnemies.Count); }
public void GivenASingleUnitSquad_WhenSpreadAttackedByASingleUnitSquadAtCounterRange_ThenTheDefenderDefend() { Squad DummySquad = CreateDummySquad(); Squad EnemySquad = CreateDummySquad(); DummySquad.CurrentLeader.ListAttack[0].PowerFormula = "4000"; EnemySquad.IsPlayerControlled = false; DummyMap.SpawnSquad(0, DummySquad, 1, new Vector3(3, 5, 0)); DummyMap.SpawnSquad(1, EnemySquad, 2, new Vector3(5, 5, 0)); DummyMap.BattleMenuOffenseFormationChoice = BattleMap.FormationChoices.Spread; DummyMap.BattleMenuDefenseFormationChoice = BattleMap.FormationChoices.Spread; DummyMap.PrepareSquadsForBattle(DummySquad, EnemySquad); Assert.AreEqual(Unit.BattleDefenseChoices.Evade, EnemySquad.CurrentLeader.BattleDefenseChoice); Assert.AreEqual(-1, EnemySquad.CurrentLeader.AttackIndex); }
public void GivenASingleUnitSquad_WhenFocusAttackedByAnUnsurvivableLethalAttackFromASingleUnitSquad_ThenTheDefenderDefend() { Squad DummySquad = CreateDummySquad(); Squad EnemySquad = CreateDummySquad(); DummySquad.CurrentLeader.ListAttack[0].PowerFormula = "20000"; 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); EnemySquad.CurrentLeader.AttackIndex = 0; DummyMap.BattleMenuOffenseFormationChoice = BattleMap.FormationChoices.Focused; DummyMap.BattleMenuDefenseFormationChoice = BattleMap.FormationChoices.Spread; DummyMap.PrepareSquadsForBattle(0, 0, 1, 0); Assert.AreEqual(Unit.BattleDefenseChoices.Evade, EnemySquad.CurrentLeader.BattleDefenseChoice); Assert.AreEqual(-1, EnemySquad.CurrentLeader.AttackIndex); }
public void GivenASingleUnitSquad_WhenAllAttackedByASingleUnitSquadOutCounterRange_ThenTheDefenderEvade() { Squad DummySquad = CreateDummySquad(); Squad EnemySquad = CreateDummySquad(); DummySquad.CurrentLeader.ListAttack[0].PowerFormula = "4000"; DummySquad.CurrentLeader.ListAttack[0].Pri = Core.Attacks.WeaponPrimaryProperty.ALL; EnemySquad.IsPlayerControlled = false; DummyMap.SpawnSquad(0, DummySquad, 1, new Vector3(3, 5, 0), 0); DummyMap.SpawnSquad(1, EnemySquad, 2, new Vector3(13, 5, 0), 0); EnemySquad.CurrentLeader.AttackIndex = 0; DummyMap.BattleMenuOffenseFormationChoice = BattleMap.FormationChoices.ALL; DummyMap.BattleMenuDefenseFormationChoice = BattleMap.FormationChoices.Spread; DummyMap.PrepareSquadsForBattle(0, 0, 1, 0); Assert.AreEqual(Unit.BattleDefenseChoices.Evade, EnemySquad.CurrentLeader.BattleDefenseChoice); Assert.AreEqual(-1, EnemySquad.CurrentLeader.AttackIndex); }
public void TestGetTargetsSuccess() { DeathmatchScriptHolder.GetTargets Test = new DeathmatchScriptHolder.GetTargets(); 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(3, 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); }