// member methods (CAN DO)

        public void Attack(Robot robot)
        {
            Console.WriteLine("Choose your attack:\n1) Bite (does 10 damage, costs 10 energy)\n2) Stomp (5 damage, costs 5 energy)");
            string userInput = Console.ReadLine();
            // Verify
            string validUserInput = GameVerification.VerifySwitchCase(userInput, 1, 2);

            switch (validUserInput)
            {
            case "1":
                energy       -= 10; // Dinosaur spends energy according to attack choice;
                robot.health -= 10; // Robot takes damage according to dinosaur attack choice;
                break;

            case "2":
                energy       -= 5;
                robot.health -= 5;
                break;
            }
        }
Example #2
0
        // constructor (SPAWN)

        public Weapon()
        {
            Console.WriteLine("1) Sword (power: 10)\n2) Battle Axe (power: 15)");
            string userInput = Console.ReadLine();
            // Verify
            string validUserInput = GameVerification.VerifySwitchCase(userInput, 1, 2);

            switch (validUserInput) // choose which weapon each robot has
            {
            case "1":
                type        = "Sword";
                attackPower = 10;
                break;

            case "2":
                type        = "Battle Axe";
                attackPower = 15;
                break;
            }
        }
Example #3
0
        // constructor (SPAWN)

        public Herd()
        {
            Console.WriteLine($"1) T-Rex / health: 100 / energy: 50\n2) Veliciraptor / health: 50 / energy: 100\n3) Triceratops / health: 200/ energy: 25\n");

            Console.Write("Choose the first dinosaur in your herd: "); // User chooses which dinosaur to add to herd
            string userInput = Console.ReadLine();
            // Verify
            string validUserInput = GameVerification.VerifySwitchCase(userInput, 1, 3);

            dinosaur1 = ChooseDinosaurType(validUserInput);             // take returned dinosaur and assign

            Console.Write("Choose the second dinosaur in your herd: "); // Choose dinosaur type
            userInput = Console.ReadLine();
            // Verify
            validUserInput = GameVerification.VerifySwitchCase(userInput, 1, 3);
            dinosaur2      = ChooseDinosaurType(validUserInput);       // Assign

            Console.Write("Choose the third dinosaur in your herd: "); // Choose dinosaur type
            userInput = Console.ReadLine();
            // Verify
            validUserInput = GameVerification.VerifySwitchCase(userInput, 1, 3);
            dinosaur3      = ChooseDinosaurType(validUserInput); // Assign
        }
Example #4
0
        public void ChooseOpponent(Fleet fleet)
        {
            // Dinosaurs go first, switch case to choose which dinosaur attacks which robot
            Console.WriteLine($"Choose dinosaur:\n1) {dinosaur1.type}\n2) {dinosaur2.type}\n3) {dinosaur3.type}");
            string userInput      = Console.ReadLine();
            string validUserInput = GameVerification.VerifySwitchCase(userInput, 1, 3); // Verify

            switch (validUserInput)
            {
            case "1":
                Console.WriteLine($"Choose robot to attack:\n1) {fleet.robot1.name}\n2) {fleet.robot2.name}\n3) {fleet.robot3.name}");
                userInput      = Console.ReadLine();
                validUserInput = GameVerification.VerifySwitchCase(userInput, 1, 3);     // Verify
                // Verify that dinosaur has power (is alive)
                switch (validUserInput)
                {
                case "1":
                    dinosaur1.Attack(fleet.robot1);
                    GameVerification.CheckIfRobotIsDead(fleet.robot1);
                    break;

                case "2":
                    dinosaur1.Attack(fleet.robot2);
                    GameVerification.CheckIfRobotIsDead(fleet.robot2);
                    break;

                case "3":
                    dinosaur1.Attack(fleet.robot3);
                    GameVerification.CheckIfRobotIsDead(fleet.robot3);
                    break;
                }
                break;

            case "2":
                Console.WriteLine($"Choose robot to attack:\n1) {fleet.robot1.name}\n2) {fleet.robot2.name}\n3) {fleet.robot3.name}");
                userInput      = Console.ReadLine();
                validUserInput = GameVerification.VerifySwitchCase(userInput, 1, 3);     // Verify
                switch (validUserInput)
                {
                case "1":
                    dinosaur2.Attack(fleet.robot1);
                    GameVerification.CheckIfRobotIsDead(fleet.robot1);
                    break;

                case "2":
                    dinosaur2.Attack(fleet.robot2);
                    GameVerification.CheckIfRobotIsDead(fleet.robot2);
                    break;

                case "3":
                    dinosaur2.Attack(fleet.robot3);
                    GameVerification.CheckIfRobotIsDead(fleet.robot3);
                    break;
                }
                break;

            case "3":
                Console.WriteLine($"Choose robot to attack:\n1) {fleet.robot1.name}\n2) {fleet.robot2.name}\n3) {fleet.robot3.name}");
                userInput      = Console.ReadLine();
                validUserInput = GameVerification.VerifySwitchCase(userInput, 1, 3);     // Verify
                switch (validUserInput)
                {
                case "1":
                    dinosaur3.Attack(fleet.robot1);
                    GameVerification.CheckIfRobotIsDead(fleet.robot1);
                    break;

                case "2":
                    dinosaur3.Attack(fleet.robot2);
                    GameVerification.CheckIfRobotIsDead(fleet.robot2);
                    break;

                case "3":
                    dinosaur3.Attack(fleet.robot3);
                    GameVerification.CheckIfRobotIsDead(fleet.robot3);
                    break;
                }
                break;
            }
        }
Example #5
0
        // member methods (CAN DO)

        public void ChooseOpponent(Herd herd)
        {
            Console.WriteLine($"Choose robot:\n1) {robot1.name}\n2) {robot2.name}\n3) {robot3.name}");
            string userInput = Console.ReadLine();
            // Verify
            string validUserInput = GameVerification.VerifySwitchCase(userInput, 1, 3);

            switch (validUserInput)
            {
            case "1":
                Console.WriteLine($"Choose dinosaur to attack:\n1) {herd.dinosaur1.type}\n2) {herd.dinosaur2.type}\n3) {herd.dinosaur3.type}");
                userInput = Console.ReadLine();
                // Verify
                validUserInput = GameVerification.VerifySwitchCase(userInput, 1, 3);
                // Verify that robot has power (is alive)
                switch (validUserInput)
                {
                case "1":
                    robot1.Attack(herd.dinosaur1);
                    GameVerification.CheckIfDinosaurIsDead(herd.dinosaur1);
                    break;

                case "2":
                    robot1.Attack(herd.dinosaur2);
                    GameVerification.CheckIfDinosaurIsDead(herd.dinosaur1);
                    break;

                case "3":
                    robot1.Attack(herd.dinosaur3);
                    GameVerification.CheckIfDinosaurIsDead(herd.dinosaur1);
                    break;
                }
                break;

            case "2":
                Console.WriteLine($"Choose dinosaur to attack:\n1) {herd.dinosaur1.type}\n2) {herd.dinosaur2.type}\n3) {herd.dinosaur3.type}");
                userInput = Console.ReadLine();
                // Verify
                validUserInput = GameVerification.VerifySwitchCase(userInput, 1, 3);
                switch (validUserInput)
                {
                case "1":
                    robot2.Attack(herd.dinosaur1);
                    GameVerification.CheckIfDinosaurIsDead(herd.dinosaur2);
                    break;

                case "2":
                    robot2.Attack(herd.dinosaur2);
                    GameVerification.CheckIfDinosaurIsDead(herd.dinosaur2);
                    break;

                case "3":
                    robot2.Attack(herd.dinosaur2);
                    GameVerification.CheckIfDinosaurIsDead(herd.dinosaur2);
                    break;
                }
                break;

            case "3":
                Console.WriteLine($"Choose dinosaur to attack:\n1) {herd.dinosaur1.type}\n2) {herd.dinosaur2.type}\n3) {herd.dinosaur3.type}");
                userInput = Console.ReadLine();
                // Verify
                validUserInput = GameVerification.VerifySwitchCase(userInput, 1, 3);
                switch (validUserInput)
                {
                case "1":
                    robot3.Attack(herd.dinosaur1);
                    GameVerification.CheckIfDinosaurIsDead(herd.dinosaur3);
                    break;

                case "2":
                    robot3.Attack(herd.dinosaur2);
                    GameVerification.CheckIfDinosaurIsDead(herd.dinosaur3);
                    break;

                case "3":
                    robot3.Attack(herd.dinosaur3);
                    GameVerification.CheckIfDinosaurIsDead(herd.dinosaur3);
                    break;
                }
                break;
            }
        }