public static Command GetCommand() { string cmd; string parameter = null; var line = Ui.PromptLine("> ").Trim(); var i = line.IndexOf(" ", StringComparison.Ordinal); if (i == -1) { cmd = line; } else { cmd = line.Substring(0, i); parameter = line.Substring(i).Trim(); } return(new Command(cmd, parameter)); }
public bool Execute(Command command) { if (_game.CurrentPlace == _game.GetNamedPlace("Champion")) { //Prompts player for secret password to fight the champion. var p1Response = Ui.PromptLine("What is the secret Password: "******"Onix") { var tempList2 = new List <Pokemon> { GlobalVar.PokeList2[3], GlobalVar.PokeList2[4], GlobalVar.PokeList2[5], GlobalVar.PokeList2[6], GlobalVar.PokeList2[1], GlobalVar.PokeList2[7] }; //Champion is difficult so he is assigned with 6 Predefined Pokemon //Assigned Charizard //Assigned Zapdos //Assigned Gengar //Assigned Lapras //Assigned Pikachu //Assigned Blastoise const string p2Name = "Pokemon Trainer Red"; Console.WriteLine(); var trainer2 = new Trainer(p2Name, tempList2, true); var bs = new BattleSystem(GlobalVar.Player1, trainer2, GlobalVar.MoveDir); bs.BattleSystemRun(); foreach (var poke in GlobalVar.Player1.GetPokemonList()) { poke.MaxHp(); } foreach (var poke in trainer2.GetPokemonList()) { poke.MaxHp(); } //If the player beats the champion they win the game and get a nice reward! if (bs.GetWinStatus()) { GlobalVar.Player1.ModifyCash(2000); Console.WriteLine("You gained 2000 Cash"); Console.WriteLine("Your total Cash is " + GlobalVar.Player1.GetCash() + "!"); Console.WriteLine(); Console.WriteLine("Congratulations! You Won!"); Console.WriteLine("You are the new Pokemon Master!"); Console.WriteLine("Thank you for playing Pokemon!"); //If player loses they have unlimited tries but need to continue to battle to make money. } else { Console.WriteLine(); Console.WriteLine("You Lost. To start a new battle type 'champ' then password again."); } } else { Console.WriteLine("Type the password to fight the Champion"); } } else { Console.WriteLine("Go south of the arena to fight the champion!"); } return(false); }
/// Print out the opening message for the player. private void printWelcome() { Console.ForegroundColor = ConsoleColor.White; GlobalVar.P1Name = Ui.PromptLine("What is Player 1's Name: "); Console.WriteLine(); var tempList1 = new List <Pokemon> (); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("eevee, pikachu, charmander"); Console.ResetColor(); Console.WriteLine(); Console.WriteLine("Pick your first Pokemon!"); var startResponse = Ui.PromptLine("Which Pokemon would you like to start with?: "); while (startResponse != "eevee" && startResponse != "pikachu" && startResponse != "charmander") { Console.WriteLine("Invalid Name. Try Again!"); startResponse = Ui.PromptLine("Pick your Pokemon: "); Console.WriteLine(); } if (startResponse == "eevee") { tempList1.Add(GlobalVar.PokeList [0]); } else if (startResponse == "pikachu") { tempList1.Add(GlobalVar.PokeList [1]); } else if (startResponse == "charmander") { tempList1.Add(GlobalVar.PokeList [2]); } GlobalVar.Player1 = GlobalVar.P1Name == "AI" ? new Trainer(GlobalVar.P1Name, tempList1, true) : new Trainer(GlobalVar.P1Name, tempList1, false); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine( @" .::. .;:**' ` .:XHHHHk. db. .;;. dH MX oMMMMMMMMMMM ~MM dMMP :MMMMMR MMM MR ~MRMN QMMMMMb ""MMX MMMMMMP !MX' :M~ MMM MMM .oo. XMMM 'MMM `MMMM. )M> :X!Hk. MMMM XMM.o"" . MMMMMMM X?XMMM MMM>!MMP 'MMMb.dM! XM M'?M MMMMMX.`MMMMMMMM~ MM MMM XM `"" MX MMXXMM ~MMMMM~ XMM. .XM XM`""MMMb.~*?**~ .MMX M t MMbooMM XMMMMMP ?MMM> YMMMMMM! MM `?MMRb. `"""""" !L""MMMMM XM IMMM MMMX ""MMMM"" MM ~%: !Mh."""""" dMI IMMP 'MMM. IMX ~M!M IMP "); Console.ForegroundColor = ConsoleColor.White; Console.ReadLine(); Console.Clear(); Console.WriteLine(@" .""-,.__ `. `. , .--' .._,'""-' `. . .' `' `. / ,' ` '--. ,-""' `""` | \ -. \, | `--Y.' ___. \ L._, \ _., `. < <\ _ ,' ' `, `. | \ ( ` ../, `. ` | .\`. \ \_ ,' ,.. . _.,' ||\l ) '"". , ,' \ ,'.-.`-._,' | . _._`. ,' / \ \ `' ' `--/ | \ / / ..\ .' / \ . |\__ - _ ,'` ` / / `.`. | ' .. `-...-"" | `-' / / . `. | / |L__ | | / / `. `. , / . . | | / / ` ` / / ,. ,`._ `-_ | | _ ,-' / ` \ / . \""`_/. `-_ \_,. ,' +-' `-' _, ..,-. \`. ' .-f ,' ` '. \__.---' _ .' ' \ \ ' / `.' l .' / \.. ,_|/ `. ,'` L` |' _.-""""` `. \ _,' ` \ `.___`.'""`-. , | | | \ || ,' `. `. ' _,...._ ` | `/ ' | ' .| || ,' `. ;.,.---' ,' `. `.. `-' .-' /_ .' ;_ || || ' V / / ` | ` ,' ,' '. ! `. || ||/ _,-------7 ' . | `-' l / `|| | ,' .- ,' || | .-. `. .' || `' ,' `"".' | | `. '. -.' `' / ,' | |,' \-.._,.'/' . / . . \ .'' .`. | `. / :_,'.' \ `...\ _ ,'-. .' /_.-' `-.__ `, `' . _.>----''. _ __ / .' /""' | ""' '_ /_|.-'\ ,"". '.'`__'-( \ / ,""'""\,' `/ `-.|"" mh Welcome to the world of Pokemon!" ); Console.ReadLine(); Console.WriteLine(@" This is a game by: Morgan Rose Christopher Hernandez Nathan Blais Kija Ndekeja "); Console.ReadLine(); Console.Write("Pokemon "); Console.WriteLine("are animal-like creatures with mysterious powers. Humans and"); Console.WriteLine("Pokemon travel alongside each other as friends and partners."); Console.WriteLine("People also battle their Pokemon against other Pokemon to test"); Console.WriteLine("their strengths as a team. These people are called Pokemon Trainers."); Console.WriteLine("They battle as teams with thier Pokemon in Arenas."); Console.WriteLine(); Console.ReadLine(); Console.WriteLine("Today you start your very own Pokemon journey!"); Console.WriteLine("Your dream has always been to become the Pokemon Champion by mastering"); Console.WriteLine("your Pokemon's strengths by battling your way to the top in the Arena!"); Console.ReadLine(); Console.Clear(); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Your goal is to battle your way to the top of the Pokemon World."); Console.WriteLine("The current Pokemon Champion is Red - he is currently south of the Arena"); Console.WriteLine("and is awaiting new challengers. You should hone your skills and then take him"); Console.WriteLine("on if you wish to become the new champion and beat the game!"); Console.WriteLine(); Console.WriteLine("You start your journey off in the forest away from home."); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("You know the Arena is south of the forest. There is also a Town"); Console.WriteLine("to the West and a City to the East. You can buy potions in the City"); Console.WriteLine("and new Pokemon in the Town! Make sure you visit each if you want"); Console.WriteLine("to become a Pokemon master!"); Console.ForegroundColor = ConsoleColor.Yellow; Console.ReadLine(); Console.Write("Type '"); Console.ForegroundColor = ConsoleColor.Red; Console.Write("help"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("' for help."); Console.Write(" Type '"); Console.ForegroundColor = ConsoleColor.Red; Console.Write("map"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("'To see what places you could go."); Console.Write(" Type '"); Console.ForegroundColor = ConsoleColor.Red; Console.Write("quit"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("' to quit."); Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.Write("Type '"); Console.ForegroundColor = ConsoleColor.Red; Console.Write("bag"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("' to check your items. You already have 4 health-restoring potions."); //Starts with the player off with a couple of free potions GlobalVar.Player1.AddItem("potion"); GlobalVar.Player1.AddItem("potion"); GlobalVar.Player1.AddItem("super potion"); GlobalVar.Player1.AddItem("super potion"); Console.WriteLine("You should go south from here to get to the Arena and start battling."); Console.WriteLine("After successful each battle, you'll win money. Spend this on new Pokemon"); Console.WriteLine("and on items to make battling easier! Remeber to visit the City and Town for each."); Console.Write("To travel you need to type the command "); Console.ForegroundColor = ConsoleColor.Red; Console.Write("go "); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("followed by the "); Console.ForegroundColor = ConsoleColor.Red; Console.Write("direction "); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("you wish to travel."); Console.ReadLine(); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("You are currently in the forest."); Console.ResetColor(); Console.WriteLine("You should go south of here to start battles. Type 'go south'"); Console.WriteLine("to get started!"); }