private void ShootHostileTest(bool debugMode) { _setup.SetupMapWith1Hostile(); var srs = ShortRangeScan.For(_setup.TestMap.Playership); srs.Controls(); _photonsToTest = Torpedoes.For(_setup.TestMap.Playership); _testRegion = _setup.TestMap.Playership.GetRegion(); IShip hostile = _testRegion.GetHostiles().Single(); Assert.AreEqual(0, _photonsToTest.ShipConnectedTo.Sector.X, "Playership.X not at 0"); Assert.AreEqual(0, _photonsToTest.ShipConnectedTo.Sector.Y, "Playership.Y not at 0"); //Verify Hostile ship's location Assert.AreEqual(0, hostile.Sector.X, "Hostile.X not at 0"); Assert.AreEqual(1, hostile.Sector.Y, "Hostile.Y not at 1"); Assert.AreEqual(SectorItem.HostileShip, hostile.Sector.Item); Assert.IsNotNull(hostile.Sector.Object); Constants.DEBUG_MODE = debugMode; Assert.IsTrue(_setup.TestMap == _photonsToTest.Game.Map); _photonsToTest.Shoot(7); var noMoreHostile = _testRegion.GetHostiles(); //Verify ship's location is no more Assert.AreEqual(0, noMoreHostile.Count, "Hostile Not destroyed."); }
public void ShootHostileAt(Coordinate friendlySector, Coordinate hostileSector, int directionToShoot, bool debugMode) { Constants.DEBUG_MODE = false; _setup.SetupMapWith1HostileAtSector(friendlySector, hostileSector); var srs = ShortRangeScan.For(_setup.TestMap.Playership); srs.Controls(); _photonsToTest = Torpedoes.For(_setup.TestMap.Playership); _testRegion = _setup.TestMap.Playership.GetRegion(); IShip hostile = _testRegion.GetHostiles().Single(); Assert.AreEqual(friendlySector.X, _photonsToTest.ShipConnectedTo.Sector.X, "Playership.X not at 0"); Assert.AreEqual(friendlySector.Y, _photonsToTest.ShipConnectedTo.Sector.Y, "Playership.Y not at 0"); //Verify Hostile ship's location Assert.AreEqual(hostileSector.X, hostile.Sector.X, "Hostile.X not at 0"); Assert.AreEqual(hostileSector.Y, hostile.Sector.Y, "Hostile.Y not at 1"); Assert.AreEqual(SectorItem.HostileShip, hostile.Sector.Item); Assert.IsNotNull(hostile.Sector.Object); Constants.DEBUG_MODE = debugMode; _photonsToTest.Shoot(directionToShoot); var noMoreHostile = _testRegion.GetHostiles(); //Verify ship's location is no more Assert.AreEqual(0, noMoreHostile.Count, "Hostile Not destroyed."); }
//This needs to be a command method that the UI passes values into. //Readline is done in UI public void Prompt(Ship playerShip, string mapText, Game game) { this.Console.Write(mapText); var readLine = this.Console.ReadLine(); if (readLine == null) { return; } var command = readLine.Trim().ToLower(); switch (command) { case "wrp": case "imp": case "nto": Navigation.For(playerShip).Controls(command); break; case "irs": ImmediateRangeScan.For(playerShip).Controls(); break; case "srs": ShortRangeScan.For(playerShip).Controls(); break; case "lrs": LongRangeScan.For(playerShip).Controls(); break; case "crs": CombinedRangeScan.For(playerShip).Controls(); break; case "pha": Phasers.For(playerShip).Controls(playerShip); break; case "tor": Torpedoes.For(playerShip).Controls(); break; case "she": this.ShieldMenu(playerShip); break; case "com": this.ComputerMenu(playerShip); break; case "toq": Computer.For(playerShip).Controls(command); break; case "dmg": this.DamageControlMenu(playerShip); break; //Utility Commands case "dbg": this.DebugMenu(playerShip); break; case "ver": this.Console.WriteLine(this.Config.GetText("AppVersion").TrimStart(' ')); break; case "cls": this.Console.Clear(); break; default: //case "?": this.CreateCommandPanel(); this.Panel(this.GetPanelHead(playerShip.Name), ACTIVITY_PANEL); break; } }