/// <summary> /// Provides framework for one-time tutorial /// </summary> /// <param name="Enemies">All Enemies array</param> /// <param name="p1">Main Character</param> private static void Tutorial(Player player, Enemy[] Enemies) { Combat.StartCombat(player, Enemies[0]); player.TutorialComplete = true; GameIntro.PlayerPrompt(player); string playerChoices = string.Format("Are you ready to journey into " + "the tunnel? \n 1) Yes \n 2) No\n"); GameIntro.ChoiceResponse(getChoice(2, playerChoices)); Console.WriteLine("Its seems we have come to a fork. There are 4 doors " + "ahead of us.\n\nLook! there's a note on the wall."); }
/// <summary> /// Main Game /// </summary> private static void Main() { TextUtil.SetStartingDirectory(); // Snapshots relative directory paths // Enhanced search speed and avoids // Some errors if started from shortcut Console.Title = ("Into the Woods"); ShowGameTitleScreen(); Enemy[] Enemies = CreateAllEnemies(); Player p1 = GameIntro.CharacterCreation(new Player("", 20)); Tutorial(p1, Enemies); Item note = new Item("Note", "Paper", TextUtil.ReturnTextFile("Note_PreDoor.txt")); int response = getChoice(2, " Would you like to: \n 1) Take a Look \n " + "2) Add to Inventory"); if (response == 1) { p1.AddToInventory(note, 1); Console.ForegroundColor = ConsoleColor.DarkYellow; TextUtil.PressAnyKeyNOBufferClear(note.description); Console.ResetColor(); Console.WriteLine("\n\n**Hmmmm, kind of odd that the name at the " + "bottom is ripped off**\n\n"); } else { p1.AddToInventory(note, 1); } Console.WriteLine("Well lets not take too long, lets start finding " + "keys!\n"); string doorAccept = "\nOkay, we are going into door "; bool playerWins = false; while (!(playerWins)) { if (Enemies[11].isAlive() == false) { playerWins = true; break; } response = getChoice(5, "", true); // gets player input here if (1 <= response && response <= 3) //checks if response is a door number { if (!p1.Stage) // makes sure player is not currently in the middle of a stage. { if (p1.DoorsOpened.Count == 0) // checks to see if player has not completed any stages { if (OpenedDoors(response, p1)) // code for stage 1 { Console.WriteLine(doorAccept + "{0}", response); DoorStage1(p1, Enemies[1], Enemies[2], Enemies[3]); continue; ////Stage 1 ends here } } else if (p1.DoorsOpened.Count == 1) // checks to see if player has completed 1 stage (so that stage 2 can start) { if (OpenedDoors(response, p1)) //checks to see if the desired door has been opened before { Console.WriteLine(doorAccept + "{0}", response); DoorStage2(p1, Enemies[4], Enemies[5], Enemies[6]); continue; } else // response if door has already been opened { DoorAlreadyComplete(); continue; } } else if (p1.DoorsOpened.Count == 2) // checks to see if stage 2 has been completed (so that stage 3 can start) { if (OpenedDoors(response, p1)) // checks to see if the desired door has been opened before { Console.WriteLine(doorAccept + "{0}", response); DoorStage3(p1, Enemies[7], Enemies[8], Enemies[9]); continue; } else // response if door has been opened before { DoorAlreadyComplete(); continue; } } else if (p1.DoorsOpened.Count == 3) { DoorAlreadyComplete(); continue; } } else if (p1.Stage) // if player dies/runs, they are returned to the lobby. In this case stage will be true. { // this code makes it so player is only allowed to return to the door where they died/ran from. if (response == p1.currentDoor) { int stagesCompleted = p1.DoorsOpened.Count; switch (stagesCompleted) { case 1: DoorStage1(p1, Enemies[1], Enemies[2], Enemies[3]); break; case 2: DoorStage2(p1, Enemies[4], Enemies[5], Enemies[6]); break; case 3: DoorStage3(p1, Enemies[7], Enemies[8], Enemies[9]); break; case 4: DoorStage4(p1, Enemies[10], Enemies[11]); break; } continue; } else if (response != p1.currentDoor) { Console.WriteLine("This door is sealed shut and will not open."); continue; } } } else if (response == 5) { p1.DisplayInventoryContents(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("{0}) Close the inventory", p1.allItems.Count + 1); Console.ResetColor(); int choice = getChoice(p1.allItems.Count + 1, "Please type the " + "number corresponding to the Item \nyou " + "wish to see the description of."); if (choice <= p1.allItems.Count) { p1.Inspect(p1.allItems[choice - 1]); TextUtil.PressAnyKeyBufferClear(); continue; } else if (choice == p1.allItems.Count + 1) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("\nYou have chosen to close the inventory."); Console.ResetColor(); continue; } } else if (response == 4) { if (p1.currentStage != 3) { Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine("\nThis door is locked, it smells like plants..." + "\nThis door also seems to have 3 keyholes... " + "very strange..."); Console.ResetColor(); TextUtil.PressAnyKeyBufferClear(); continue; } else if (p1.currentStage == 3) { Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine("You have found all three keys and the door " + "now opens! We are going into the final door!"); Console.ResetColor(); DoorStage4(p1, Enemies[10], Enemies[11]); if (p1.currentStage == 4) { break; } } } } PlayerBeatsGame(); }
private static void Main(string[] args) { TextUtil.SetBufferSize(); TextUtil.PrintTextFile("gamelogo.txt"); TextUtil.PressAnyKeyBufferClear(); TextUtil.PrintTextFile("gamelogo2.txt"); Player p1 = GameIntro.Start(new Player("", 100, 10)); Console.Write(p1.Name + ", "); Enemy Spider = new Enemy(); Spider.Name = "Small Spider"; Combat.StartCombat(p1, Spider); p1.TutorialComplete = true; Console.WriteLine("Congrats on Defeating your first Enemy, {0}!", p1.Name); Poison venom = new Poison("Spider Venom", "athough it has a very attractive smell, " + "\n this venom will weaken anyone who touches it.", false); Console.WriteLine("The {0} has dropped {1}, {2}. \n You can now add it to your inventory if you desire." , Spider.Name, venom.name, venom.description); int answer = getChoice(2, "Would you like to add to inventory? \n 1) Yes \n 2) No)\n"); if (answer == 1) { p1.AddToInventory(venom, 1); Console.WriteLine("{0} has been added to you inventory.", venom.name); } else { Console.WriteLine("you have dropped {0}", venom.name); } Console.WriteLine("{0}, good job on your combat training, \n we are now ready to venture" + " into the tunnel. \nIt will be challening, but after seeing your skills, \nI trust you will bring peace to the woods.", p1.Name); int forward = getChoice(2, "Are you ready to journey into the tunnel? \n 1) Yes \n 2) No)\n"); if (forward == 1) { Console.WriteLine("Good to hear, we are now entering the cave."); } else { Console.WriteLine("You're coming anyways... were walking into the tunnel."); } Console.WriteLine("Its seems we have come to a fork. There are 4 doors ahead of us." + "\n Look! there's a note on the wall."); string noteDescription = TextUtil.ReturnTextFile("note.txt"); Item note = new Item("Note", "Paper", noteDescription); int response = getChoice(2, " Would you like to: \n 1) Take a Look \n 2) Add to Inventory"); if (response == 1) { Console.WriteLine(note.description); Console.WriteLine("\n\n**Hmmmm, kind of odd that the name at the bottom is ripped off**\n\n"); } else { p1.AddToInventory(note, 1); } p1.AddToInventory(note, 1); Console.WriteLine("Well lets not take too long, lets start finding keys!\n"); bool responseIsGood = false; while (!(responseIsGood)) { response = getChoice(4, "Which door would you like to enter? \n 1) Door 1 \n 2) Door 2 \n 3) Door 3 \n 4) Open Inventory \n"); if (p1.currentStage == 0 && //Stage 1 starts here response != 4) { if (OpenedDoors(response, p1) == true) { p1.Stage = true; Console.WriteLine("Okay, we are going into door {0}", response); Enemy skeleton = new Enemy("Skeleton", 10, 1, 5, 6); Weapon IronSword = new Weapon("Iron Sword", "sword", "sword made of iron", 10, 0); HealthPotion skeleFluid = new HealthPotion("Skeleton Fluid", "Fluid from a skeleton... it looks nutritious", false); skeleton.AddToInventory(IronSword, 1); skeleton.AddToInventory(skeleFluid, 2); Enemy goblin = new Enemy("Goblin", 20, 2, 7, 9); Weapon SteelSword = new Weapon("#blessed Steel Sword", "sword", "sword made of steel, with slight magic damage", 15, 10); HealthPotion GoblinBlood = new HealthPotion("Goblin Blood", "blood from the heart of the Goblin", false); goblin.AddToInventory(SteelSword, 1); goblin.AddToInventory(GoblinBlood, 2); Enemy giant = new Enemy("Giant", 35, 3, 10, 13); Weapon BasicBow = new Weapon("BasicBow", "bow", "basic wooden bow", 20, 0); HealthPotion GiantMagic = new HealthPotion("Giant Magic", "magic potion used by the Giant to cure his injuries", true); Item key1 = new Item("Key I", "key", "this is the key colloected from first stage"); giant.AddToInventory(key1, 1); giant.AddToInventory(BasicBow, 1); giant.AddToInventory(GiantMagic, 1); DoorStage(p1, skeleton, goblin, giant); Console.WriteLine("After defeating the giant, you leave the room. You hear \n the door lock behind you as you step into the lobby."); p1.Stage1Complete = true; ////Stage 1 ends here p1.currentStage = 1; p1.Stage = false; continue; } else if (p1.Stage1Complete) { Console.WriteLine("The door is sealed shut"); continue; } } else if (p1.currentStage == 1 && response != 4) { if (OpenedDoors(response, p1) == true) { Console.WriteLine("Okay, we are going into door {0}", response); Enemy GiantSpider = new Enemy("Giant Spider", 20, 10, 5, 7); Enemy alligator = new Enemy("Alligator", 20, 10, 5, 7); Enemy kraken = new Enemy("Kraken", 20, 10, 5, 7); Item key2 = new Item("Key II", "key", "this is the key collected from second stage"); kraken.AddToInventory(key2, 1); DoorStage(p1, GiantSpider, alligator, kraken); p1.Stage2Complete = true; p1.currentStage = 2; continue; } else if (p1.Stage2Complete) { response = UI.PromptInt("You have already completed this Door, choose another."); continue; } } else if (p1.currentStage == 2 && response != 4) { if (OpenedDoors(response, p1) == true) { Console.WriteLine("Okay, we are going into door {0}", response); Enemy wolf = new Enemy("Wolf", 20, 10, 5, 7); Enemy zombie = new Enemy("Zombie", 20, 10, 5, 7); Enemy orc = new Enemy("Orc", 20, 10, 5, 7); Item key3 = new Item("Key III", "key", "this is the key collected from third stage"); orc.AddToInventory(key3, 1); DoorStage(p1, wolf, zombie, orc); p1.Stage3Complete = true; p1.currentStage = 3; } else if (p1.Stage3Complete) { response = UI.PromptInt("You have already completed this Door, choose another."); continue; } } else if (response == 4) { p1.DisplayInventoryContents(); string input = UI.PromptLine("Spell out the name of Item you wish to see description of. (case doesn't matter)"); foreach (KeyValuePair <Item, int> a in p1.inventory.contents) { if (input.Trim().ToLower() == a.Key.name.Trim().ToLower()) { p1.Inspect(a.Key); } else { input = UI.PromptLine("There is no item in your inventory that matches that input. Try again."); } } } else if (p1.currentStage == 3 && response != 4) { responseIsGood = true; continue; } } }