コード例 #1
0
        public WarApp(Armada attackers, Armada defenders)
        {
            Attackers = attackers;
            Defenders = defenders;

            Console.WriteLine("\n\n\n\n---- There's an Armada War a'brewin'! ----");
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: rurikovec/Leviathan-X
        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();
        }