public void TestShipDoesNotRegenerateShieldWhenHit() { fleet1 = new Fleet("Federation", CreateSpaceShips(15), CommonRandom); fleet1.NewBattleCommencing(3); TargetingMissile missile = new TargetingMissile(15, 1); // shield down TargetingMissile missile2 = new TargetingMissile(15, 10); // shield down TargetingMissile missile3 = new TargetingMissile(150, 8); // kill TargetingMissile missile4 = new TargetingMissile(2, 1); fleet1.RecieveFireFromEnemyFleet(missile); fleet1.RecieveFireFromEnemyFleet(missile2); fleet1.RecieveFireFromEnemyFleet(missile3); fleet1.RecieveFireFromEnemyFleet(missile4); Assert.That(fleet1.TotalNumberOfLosses, Is.EqualTo(0)); // should not be updated yet Assert.That(fleet1.SizeofActiveFleet, Is.EqualTo(15)); Assert.That(fleet1.SpaceShipsInService[1].IsShieldDown()); Assert.That(fleet1.SpaceShipsInService[10].IsShieldDown()); Assert.That(fleet1.SpaceShipsInService[8].IsShieldDown()); Assert.That(fleet1.SpaceShipsInService[8].IsDestroyed()); // should still be in service fleet1.Ceasefire(); // shields should not regen Assert.That(fleet1.SpaceShipsInService[1].IsShieldDown()); Assert.That(fleet1.SpaceShipsInService[9].IsShieldDown()); Assert.That(fleet1.TotalNumberOfLosses, Is.EqualTo(1)); Assert.That(fleet1.SizeofActiveFleet, Is.EqualTo(14)); }
public static void WriteFleetWonBattle(Fleet winingFleet, Fleet loosingFleet, int numberOfBattleRounds) { Console.WriteLine(); Console.WriteLine("After round {0} the {1} fleet won", numberOfBattleRounds, winingFleet.FleetName); Console.WriteLine(" {0} enemy ships destroyed", loosingFleet.TotalNumberOfLosses); Console.WriteLine(" {0} ships lost", winingFleet.TotalNumberOfLosses); Console.WriteLine(" {0} ships survived", winingFleet.SizeofActiveFleet); foreach (SpaceShip spaceShip in winingFleet.SpaceShipsInService) { string damageDispaly = DamageStatusDisplay(spaceShip.DamageStatus()); Console.WriteLine(" {0} - {1}", spaceShip.ShipClassName, damageDispaly); } }
public void SetUp() { this.fleet1 = new Fleet("Federation", CreateSpaceShips(2), CommonRandom); this.fleet2 = new Fleet("Borg", CreateSpaceShips(3), CommonRandom); }
public SpaceBattle(Fleet fleet1, Fleet fleet2) { this.fleet1 = fleet1; this.fleet2 = fleet2; }