public WarApp(Armada attackers, Armada defenders) { Attackers = attackers; Defenders = defenders; Console.WriteLine("\n\n\n\n---- There's an Armada War a'brewin'! ----"); }
public bool War(Armada enemyArmada) { int ourParty = 0; int theirParty = 0; while (warShips.Count - 1 != ourParty && enemyArmada.warShips.Count - 1 != theirParty) { if (warShips[ourParty].Battle(enemyArmada.warShips[theirParty])) { Console.WriteLine($"\nThe {warName} Armada ship destroys the {enemyArmada.warName} ship!"); theirParty++; } else { Console.WriteLine($"\nThe {enemyArmada.warName} Armada ship destroys the {warName} ship!"); ourParty++; } } if (warShips.Count - 1 == ourParty) { return(false); } else { return(true); } }
static void Main(string[] args) { Console.WriteLine("\n---- Arr! Welcome ta de Pirate Wars! ----"); Pirate billy = new Pirate("Billy", true); Ship anneMarie = new Ship("Anne Marie", billy); anneMarie.FillShip(); billy.DrinkSomeRum(); billy.DrinkSomeRum(); anneMarie.BrawlBreakOut(); anneMarie.ShipStatus(); Pirate matheas = new Pirate("Matheas", true); Ship bombarda = new Ship("Bombarda", matheas); bombarda.FillShip(); matheas.DrinkSomeRum(); matheas.DrinkSomeRum(); bombarda.BrawlBreakOut(); bombarda.ShipStatus(); BattleApp battle1 = new BattleApp(anneMarie, bombarda); battle1.BeginBattle(); Armada warParty1 = new Armada("War Party 1", 4); Armada warParty2 = new Armada("War Party 2", 4); WarApp battle2 = new WarApp(warParty1, warParty2); battle2.BeginWar(); }