예제 #1
0
        public int StartGame()
        {
            bool defeatedTwoVillians = false; //flag to check if first two villians are defeated to determine if hero is allowed to go to last planet in phase
            bool phaseWon            = false; //phase will be won when hero beats two villians on the two planets
            bool quitGame            = false; //game will quit if set to true
            bool playerDead          = false; //will return to the main program and give the player an option to play again

            //introducing the second phase of the game
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            System.Threading.Thread.Sleep(800);
            Console.WriteLine(Ally.Story + "\n");
            Console.ResetColor();
            //starting second phase of game
            do
            {
                System.Threading.Thread.Sleep(500);
                DisplayMenuOptions.DisplayMainOptions(PlanetsInGame, Ally, true);
                string userInputChoice = Console.ReadLine();

                int userChoice;

                if (Int32.TryParse(userInputChoice, out userChoice))
                {
                    if (userChoice < 1 || userChoice > PlanetsInGame.Count)
                    {
                        System.Threading.Thread.Sleep(500);
                        Console.WriteLine("Invalid Choice");
                    }
                    else
                    {
                        //play go to planet and fight villian occupying planet
                        int result = PlayerActions.VisitPlanet(Player, PlanetsInGame[userChoice - 1].VillianOccupyingPlanet);
                        //switch based on what happend while visiting planet
                        switch (result)
                        {
                        case 0:
                            //check to see if hero defeated last villian in phase
                            if (defeatedTwoVillians)
                            {
                                phaseWon = true;
                            }
                            else
                            {
                                PlanetsInGame.RemoveAt(userChoice - 1);
                                //if two planets are defeated, unlock last planet
                                if (!PlanetsInGame.Any())
                                {
                                    Console.ForegroundColor = ConsoleColor.Blue;
                                    System.Threading.Thread.Sleep(500);
                                    Console.WriteLine($"\nHelp liberate {(FighterType == HeroType.MANDALORIAN ? "your home planet Mandalore" : "the planet Manadlore")} from the clutches of " +
                                                      $"Darth Maul.\n");
                                    Console.ResetColor();
                                    PlanetsInGame.Add(Planets.GetMandalore());
                                    defeatedTwoVillians = true;
                                }
                            }
                            break;

                        //if villian defeats hero
                        case 1:
                            playerDead = true;
                            break;

                        //player retreats
                        default:
                            Console.ForegroundColor = ConsoleColor.Blue;
                            System.Threading.Thread.Sleep(500);
                            Console.WriteLine($"\nYou have retreated from planet {PlanetsInGame[userChoice - 1].Name}.\n");
                            Console.ResetColor();
                            break;
                        }
                    }
                }
                else
                {
                    //user selects buy items
                    if (userInputChoice == "B" || userInputChoice == "b")
                    {
                        PlayerActions.BuyUpgrades(Player, FighterType, Ally);
                    }

                    //user quits game
                    else if (userInputChoice == "Q" || userInputChoice == "q")
                    {
                        quitGame = true;
                    }
                    else
                    {
                        System.Threading.Thread.Sleep(500);
                        Console.WriteLine("Invalid Choice");
                    }
                }
            } while (!phaseWon && !quitGame && !playerDead);

            //if phase won a mandalorian will automatically get the darksaber as a weapon
            if (phaseWon)
            {
                if (FighterType == HeroType.MANDALORIAN)
                {
                    Console.ForegroundColor = ConsoleColor.DarkYellow;
                    System.Threading.Thread.Sleep(500);
                    Console.WriteLine("\nBo-Katan: You have liberated our home planet and won the darksaber from Darth Maul. You are now the Mandalore, ruler of our planet. All of the Clans of " +
                                      "Mandalore will now pledge their allegiance to you.\n");
                    Console.ResetColor();
                    Weapon darksaber = GameWeaponsList.getDarksaber();
                    Player.WeaponInventory.Add(darksaber);   //adding darksaber to inventory

                    //giving player an option to equip darksaber
                    bool isValidWeaponChoice = false;
                    do
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        System.Threading.Thread.Sleep(500);
                        Console.Write("Do you want to equipped the Darksaber? Y/N");
                        Console.ResetColor();
                        string choice = Console.ReadLine();
                        switch (choice)
                        {
                        case "Y":
                        case "y":
                            Player.EquippedWeapon   = darksaber;
                            Console.ForegroundColor = ConsoleColor.Blue;
                            Console.WriteLine("\nYou have now equipped the DarkSaber, the most powerful Mandalorian weapon in the galaxy!\n");
                            Console.ResetColor();
                            isValidWeaponChoice = true;
                            break;

                        case "N":
                        case "n":
                            Console.ForegroundColor = ConsoleColor.Blue;
                            Console.WriteLine("The Darksaber will be in your weapons inventory in case you change your mind.");
                            Console.ResetColor();
                            isValidWeaponChoice = true;
                            break;

                        default:
                            Console.WriteLine("Invalid choice!");
                            break;
                        }
                    } while (!isValidWeaponChoice);
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.DarkYellow;
                    System.Threading.Thread.Sleep(800);
                    Console.WriteLine("Bo-Katan: Thank you Jedi for helping liberating Madalore. All clans of Mandalore" +
                                      "are forever in your debt.");
                    Console.ResetColor();
                }
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.WriteLine("Congratutions! You have conquered this phase of the game. Great work and may the force be with you!");
                Console.WriteLine("Your life has increased by 70 points");
                Console.WriteLine("Your max life has increased by 30 points");
                Console.WriteLine("Your armour has increased by 50 points");
                Console.WriteLine("Your max hit damage has increased by 30 points");
                Console.WriteLine("You have been awarded 1000 credits");
                Console.WriteLine("1000 points have been added to your score\n");
                Console.ResetColor();

                PlayerUpgrades.AddMaxHealth(Player, 30);
                PlayerUpgrades.AddHealth(Player, 70);
                PlayerUpgrades.AddArmour(Player, 50);
                PlayerUpgrades.AddMaxHitDamage(Player, 30);
                PlayerUpgrades.AddCredits(Player, 1000);
                PlayerUpgrades.AddScore(Player, 1000);

                return(0);
            }

            else if (playerDead)
            {
                return(1);
            }
            else   //player quit game
            {
                return(2);
            }
        }
예제 #2
0
        public int StartGame()
        {
            Console.WriteLine(Player.Story + "\n");

            //flags that will determine direction of the game
            bool defeatedOneVillian = false; //flag to check if one villian is defeated to determine if hero meets ally
            bool phaseWon           = false; //phase will be won when hero beats two villians on the two planets
            bool quitGame           = false; //game will quit if set to true
            bool playerDead         = false; //will return to the main program and give the player an option to play again
            bool meetAlly           = false; //flag to check if hero meet ally, effects the display menu options

            do
            {
                //checking to see if hero as met ally, will not meet ally until one planet is won
                if (!meetAlly && defeatedOneVillian)
                {
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    System.Threading.Thread.Sleep(800);
                    Console.WriteLine(Ally.Story + "\n");
                    Console.ResetColor();
                    meetAlly = true;
                }
                System.Threading.Thread.Sleep(800);
                DisplayMenuOptions.DisplayMainOptions(PlanetsInGame, Ally, meetAlly);
                string userInputChoice = Console.ReadLine();

                int userChoice;
                if (Int32.TryParse(userInputChoice, out userChoice))
                {
                    if (userChoice < 1 || userChoice > PlanetsInGame.Count)
                    {
                        System.Threading.Thread.Sleep(500);
                        Console.WriteLine("Invalid Choice");
                    }
                    else
                    {
                        //player go to planet and fight villian occupying planet
                        int result = PlayerActions.VisitPlanet(Player, PlanetsInGame[userChoice - 1].VillianOccupyingPlanet);
                        //switch based on what happend while visiting planet
                        switch (result)
                        {
                        //if player defeats villian
                        case 0:
                            //if first villian defeated in the phase of the game
                            if (!defeatedOneVillian)
                            {
                                defeatedOneVillian = true;
                                PlanetsInGame.RemoveAt(userChoice - 1);
                            }
                            else
                            {
                                phaseWon = true;
                            }
                            break;

                        //if villian defeats hero
                        case 1:
                            playerDead = true;
                            break;

                        //player retreats
                        default:
                            Console.ForegroundColor = ConsoleColor.Blue;
                            System.Threading.Thread.Sleep(500);
                            Console.WriteLine($"\nYou have retreated from planet {PlanetsInGame[userChoice - 1].Name}.\n");
                            Console.ResetColor();
                            break;
                        }
                    }
                }
                else
                {
                    if (userInputChoice == "B" || userInputChoice == "b")
                    {
                        if (meetAlly)
                        {
                            PlayerActions.BuyUpgrades(Player, FighterType, Ally);
                        }
                        else
                        {
                            System.Threading.Thread.Sleep(500);
                            Console.WriteLine("Invalid Choice");
                        }
                    }
                    else if (userInputChoice == "Q" || userInputChoice == "q")
                    {
                        quitGame = true;
                    }
                    else
                    {
                        System.Threading.Thread.Sleep(500);
                        Console.WriteLine("Invalid Choice");
                    }
                }
            } while (!phaseWon && !quitGame && !playerDead);

            if (phaseWon)
            {
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                System.Threading.Thread.Sleep(800);
                Console.WriteLine("\nHondo: It's been fun. Congratulations on your battles won. I must depart you and seek my new operation in the " +
                                  "outer rim. Good luck to you!\n");
                Console.ForegroundColor = ConsoleColor.Blue;
                System.Threading.Thread.Sleep(800);
                System.Threading.Thread.Sleep(800);
                Console.WriteLine("Congratutions! You have conquered this phase of the game. Great work and may the force be with you!");
                Console.WriteLine("Your life has increased by 50 points");
                Console.WriteLine("Your max life has increased by 20 points");
                Console.WriteLine("Your armour has increased by 20 points");
                Console.WriteLine("Your max hit damage has increased by 20 points");
                Console.WriteLine("You have been awarded 500 credits");
                Console.WriteLine("500 points have been added to your score\n");
                Console.ResetColor();

                PlayerUpgrades.AddMaxHealth(Player, 20);
                PlayerUpgrades.AddHealth(Player, 50);
                PlayerUpgrades.AddArmour(Player, 20);
                PlayerUpgrades.AddMaxHitDamage(Player, 20);
                PlayerUpgrades.AddCredits(Player, 500);
                PlayerUpgrades.AddScore(Player, 500);

                return(0);
            }

            else if (playerDead)
            {
                return(1);
            }
            else   //player quit game
            {
                return(2);
            }
        }
예제 #3
0
        public int StartGame()
        {
            bool defeatedOneVillain = false; //flag to see if one villian has been deafeated
            bool phaseWon           = false; //phase will be won when hero beats two villians on the two planets
            bool quitGame           = false; //game will quit if set to true
            bool playerDead         = false; //will return to the main program and give the player an option to play again

            //introducing the second phase of the game
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            System.Threading.Thread.Sleep(800);
            Console.WriteLine(Ally.Story + "\n");
            Console.ResetColor();

            //starting third phase of the game
            do
            {
                System.Threading.Thread.Sleep(500);
                DisplayMenuOptions.DisplayMainOptions(PlanetsInGame, Ally, true);
                string userInputChoice = Console.ReadLine();

                int userChoice;

                if (Int32.TryParse(userInputChoice, out userChoice))
                {
                    if (userChoice < 1 || userChoice > PlanetsInGame.Count)
                    {
                        System.Threading.Thread.Sleep(500);
                        Console.WriteLine("Invalid Choice");
                    }

                    else
                    {
                        //go to planet and fight villain occupying planet
                        int result = PlayerActions.VisitPlanet(Player, PlanetsInGame[userChoice - 1].VillianOccupyingPlanet);
                        //switch based on what happend while visiting planet
                        switch (result)
                        {
                        case 0:
                            //check to seee if hero defeated one villian
                            if (defeatedOneVillain)
                            {
                                phaseWon = true;
                            }
                            else
                            {
                                PlanetsInGame.RemoveAt(userChoice - 1);
                                defeatedOneVillain = true;
                            }
                            break;

                        //if villian defeats hero
                        case 1:
                            playerDead = true;
                            break;

                        //player retreats
                        default:
                            Console.ForegroundColor = ConsoleColor.Blue;
                            System.Threading.Thread.Sleep(500);
                            Console.WriteLine($"\nYou have retreated from planet {PlanetsInGame[userChoice - 1].Name}.\n");
                            Console.ResetColor();
                            break;
                        }
                    }
                }

                else
                {
                    //user selecs buy items
                    if (userInputChoice == "B" || userInputChoice == "b")
                    {
                        PlayerActions.BuyUpgrades(Player, FighterType, Ally);
                    }
                    else if (userInputChoice == "Q" || userInputChoice == "b")
                    {
                        quitGame = true;
                    }
                    else
                    {
                        System.Threading.Thread.Sleep(500);
                        Console.WriteLine("Ivalid Choice");
                    }
                }
            } while (!phaseWon && !quitGame && !playerDead);

            if (phaseWon)
            {
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                System.Threading.Thread.Sleep(800);
                Console.WriteLine($"\nBoba Fett: Congraulations kid...You are the biggest hero in the galaxy. The {(FighterType == HeroType.JEDI? "Jedi" : "Mandalorians")} should be proud!\n");
                Console.ForegroundColor = ConsoleColor.Blue;
                System.Threading.Thread.Sleep(800);
                System.Threading.Thread.Sleep(800);
                Console.WriteLine("Congratulations. You have defeated the most evil and vile scum of the galaxy and have returned peace to everyone!");
                Console.WriteLine("Your life has increased by 50 points");
                Console.WriteLine("Your max life has increased by 20 points");
                Console.WriteLine("Your armour has increased by 20 points");
                Console.WriteLine("Your max hit damage has increased by 20 points");
                Console.WriteLine("You have been awarded 500 credits");
                Console.WriteLine("500 points have been added to your score\n");
                Console.ResetColor();

                PlayerUpgrades.AddMaxHealth(Player, 20);
                PlayerUpgrades.AddHealth(Player, 50);
                PlayerUpgrades.AddArmour(Player, 20);
                PlayerUpgrades.AddMaxHitDamage(Player, 20);
                PlayerUpgrades.AddCredits(Player, 500);
                PlayerUpgrades.AddScore(Player, 500);

                return(0);
            }

            else if (playerDead)
            {
                return(1);
            }
            else   //player quit game
            {
                return(2);
            }
        }