/// <summary> /// Takes in a person object and depending on the use option is either calls /// WeaponMenu, ArmorMenu, PotionMenu or return the person object /// </summary> /// <param name="player"></param> /// <returns></returns> internal Player StartCrafting(Player ps) { player = ps; Console.WriteLine("*** Crafting Menu ***"); Console.WriteLine("*********************"); Console.WriteLine("1 craft a weapon"); Console.WriteLine("2 craft some armor"); Console.WriteLine("3 Craft some potions"); Console.WriteLine("4 Go back to previews menu"); Crafting: try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { Console.WriteLine(); Console.WriteLine("There is no such option available"); Console.WriteLine(); } switch (choice) { case 1: Console.Clear(); WeaponMenu(); goto Crafting; case 2: Console.Clear(); ArmorMenu(); goto Crafting; case 3: Console.Clear(); PotionMenu(); goto Crafting; case 4: Console.Clear(); return player; default: Console.Clear(); Console.WriteLine(); Console.WriteLine("There is no such option available"); Console.WriteLine(); goto Crafting; } }
internal Player The_Stocades(Player play) { Console.Clear(); player = play; Area area = new Area("The_Stocades", 7); player.Area = area; Console.WriteLine("As you go down the staircase one of the advisors come running towards you \n" + "if you wanna go into the dungeon, please atleast take your equipment with you \n" + "he hands back all your equipment and as you take it on and go towards the dungeon \n" + "he blesses you"); Console.WriteLine(); Console.WriteLine("You are in " + area.Name + " level " + area.Level); Console.WriteLine(player.stats()); Console.WriteLine(); Console.WriteLine("1 Go to The Fery"); Console.WriteLine("2 Save your progress"); int choice = 0; try_again: try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { goto try_again; } switch (choice) { case 1: player = The_Fery(player); break; case 2: return player; } return player; }
internal Player The_Plague_Lands(Player play) { Console.Clear(); player = play; Area area = new Area("The_Plague_Lands", 6); player.Area = area; player.updateQuests(null, player.Area, null, 0, 0, 0); Console.WriteLine("As you enter the dark forest you feel an itching all over your body \n" + "the dirt looks tainted and all the leaves withered away. \n" + "you look around and spot a single hill with a castle upon \n" + "and around the hill you spot a huge graveyard"); Console.WriteLine(); Console.WriteLine("You are in " + area.Name + " level " + area.Level); Console.WriteLine(player.stats()); Console.WriteLine(); Console.WriteLine("1 Go to Graveyard (level 7)"); Console.WriteLine("2 Go to Orexdale (level 3)"); Console.WriteLine("3 Go to Undead Castle (level 9)"); Console.WriteLine("4 Save your progress"); int choice = 0; try_again: try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { goto try_again; } switch (choice) { case 1: player = Graveyard(player); break; case 2: player = Orexdale(player); break; case 3: player = Undead_Castle(player); break; case 4: return player; } return player; }
internal Player The_Fery(Player play) { Console.Clear(); player = play; Area area = new Area("The_Fery", 1); player.Area = area; Console.WriteLine("You approach the castle, but as you reach the gate 2 guards stop you and asks \n" + "to put away your equipment while your inside the castle. \n" + "You put the equipment away and as you enter the castle you see a \n" + "staircase leading to a dungeon and the king sitting as his throne."); Console.WriteLine(); Console.WriteLine("You are in " + area.Name + " level " + area.Level); Console.WriteLine(player.stats()); Console.WriteLine(); Console.WriteLine("1 Go to The Stocades (dungeon level 7)"); Console.WriteLine("2 Go to Ferrington (city)"); Console.WriteLine("3 Save your progress"); int choice = 0; try_again: try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { goto try_again; } switch (choice) { case 1: player = The_Stocades(player); break; case 2: player = Ferrington(player); break; case 3: return player; } return player; }
internal Player Undead_Castle(Player play) { try_again: Console.Clear(); player = play; Area area = new Area("Undead_Castle", 9); player.Area = area; Console.WriteLine("You walk up the hill towards the castle and as you reach the door it opens \n" + "and a cold smoke rushes out you look inside and the dark hall consumes you. \n" + "As you enter the door you see nothing, but darkness and wonder whether \n" + "to continue onwards or turn back"); Console.WriteLine(); Console.WriteLine("You are in " + area.Name + " level " + area.Level); Console.WriteLine(player.stats()); Console.WriteLine(); Console.WriteLine("1 Go to the The Plague Lands (level 6)"); Console.WriteLine("2 Explore the castle"); Console.WriteLine("3 Go to the graveyard (level 7)"); Console.WriteLine("4 Save your progress"); int choice = 0; try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { goto try_again; } switch (choice) { case 1: player = The_Plague_Lands(player); break; case 2: Console.Clear(); switch (rng.Next(1, 3)) { case 1: Enemy enemy = UndeadCastleEnemy(area.Level); Monster tama = chooseMonster(player); Console.WriteLine("Combat strength"); Console.WriteLine("Enemy: " + combatStrength(enemy.Tama)); Console.WriteLine("You: " + combatStrength(tama)); Console.WriteLine(); player = FM.FightMonster(player, tama, enemy); goto try_again; case 2: int money = exploreAreaMoney(area.Level); Console.WriteLine("You found money " + money); player.Money += money; Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); Console.Clear(); goto try_again; } break; case 3: player = Graveyard(player); break; case 4: return player; } return player; }
internal Player GetPlayer() { //read in Monsters string[] Monsters = System.IO.File.ReadAllLines("../../Monster"); List<Monster> tama2 = new List<Monster>(); Item.equipment e=0, e2 = 0, e3 = 0, e4 = 0, e5 = 0, e6 = 0; foreach (var item in Monsters) { string[] t2 = item.Split(';'); Item helmet, chest, weapon, shield, pants, shoes; #region fix switch (t2[20]) { case "helmet": e = Item.equipment.helmet; break; case "chest": e = Item.equipment.chest; break; case "pants": e = Item.equipment.pants; break; case "potion": e = Item.equipment.potion; break; case "shield": e = Item.equipment.shield; break; case "shoes": e = Item.equipment.shoes; break; case "weapon": e = Item.equipment.weapon; break; default: break; } switch (t2[30]) { case "helmet": e2 = Item.equipment.helmet; break; case "chest": e2 = Item.equipment.chest; break; case "pants": e2 = Item.equipment.pants; break; case "potion": e2 = Item.equipment.potion; break; case "shield": e2 = Item.equipment.shield; break; case "shoes": e2 = Item.equipment.shoes; break; case "weapon": e2 = Item.equipment.weapon; break; default: break; } switch (t2[40]) { case "helmet": e3 = Item.equipment.helmet; break; case "chest": e3 = Item.equipment.chest; break; case "pants": e3 = Item.equipment.pants; break; case "potion": e3 = Item.equipment.potion; break; case "shield": e3 = Item.equipment.shield; break; case "shoes": e3 = Item.equipment.shoes; break; case "weapon": e3 = Item.equipment.weapon; break; default: break; } switch (t2[50]) { case "helmet": e4 = Item.equipment.helmet; break; case "chest": e4 = Item.equipment.chest; break; case "pants": e4 = Item.equipment.pants; break; case "potion": e4 = Item.equipment.potion; break; case "shield": e4 = Item.equipment.shield; break; case "shoes": e4 = Item.equipment.shoes; break; case "weapon": e4 = Item.equipment.weapon; break; default: break; } switch (t2[60]) { case "helmet": e5 = Item.equipment.helmet; break; case "chest": e5 = Item.equipment.chest; break; case "pants": e5 = Item.equipment.pants; break; case "potion": e5 = Item.equipment.potion; break; case "shield": e5 = Item.equipment.shield; break; case "shoes": e5 = Item.equipment.shoes; break; case "weapon": e5 = Item.equipment.weapon; break; default: break; } switch (t2[70]) { case "helmet": e6 = Item.equipment.helmet; break; case "chest": e6 = Item.equipment.chest; break; case "pants": e6 = Item.equipment.pants; break; case "potion": e6 = Item.equipment.potion; break; case "shield": e6 = Item.equipment.shield; break; case "shoes": e6 = Item.equipment.shoes; break; case "weapon": e6 = Item.equipment.weapon; break; default: break; } #endregion helmet = new Item(t2[13], int.Parse(t2[14]), int.Parse(t2[15]), int.Parse(t2[16]), int.Parse(t2[17]), int.Parse(t2[18]), int.Parse(t2[19]), e, int.Parse(t2[21]), int.Parse(t2[22])); chest = new Item(t2[23], int.Parse(t2[24]), int.Parse(t2[25]), int.Parse(t2[26]), int.Parse(t2[27]), int.Parse(t2[28]), int.Parse(t2[29]), e2, int.Parse(t2[31]), int.Parse(t2[32])); weapon = new Item(t2[33], int.Parse(t2[34]), int.Parse(t2[35]), int.Parse(t2[36]), int.Parse(t2[37]), int.Parse(t2[38]), int.Parse(t2[39]), e3, int.Parse(t2[41]), int.Parse(t2[42])); shield = new Item(t2[43], int.Parse(t2[44]), int.Parse(t2[45]), int.Parse(t2[46]), int.Parse(t2[47]), int.Parse(t2[48]), int.Parse(t2[49]), e4, int.Parse(t2[51]), int.Parse(t2[52])); pants = new Item(t2[53], int.Parse(t2[54]), int.Parse(t2[55]), int.Parse(t2[56]), int.Parse(t2[57]), int.Parse(t2[58]), int.Parse(t2[59]), e5, int.Parse(t2[61]), int.Parse(t2[62])); shoes = new Item(t2[63], int.Parse(t2[64]), int.Parse(t2[65]), int.Parse(t2[66]), int.Parse(t2[67]), int.Parse(t2[68]), int.Parse(t2[69]), e6, int.Parse(t2[71]), int.Parse(t2[72])); tama2.Add(new Monster(t2[0], int.Parse(t2[1]), t2[2], int.Parse(t2[3]), int.Parse(t2[4]), int.Parse(t2[5]), int.Parse(t2[6]), int.Parse(t2[7]), int.Parse(t2[8]), int.Parse(t2[9]), int.Parse(t2[10]), int.Parse(t2[11]), int.Parse(t2[12]), helmet, chest,weapon,shield,pants,shoes)); } //read in quests string[] quests = System.IO.File.ReadAllLines("../../quests"); List<Quest> quests2 = new List<Quest>(); foreach (var item in quests) { string[] q2 = item.Split(';'); quests2.Add(new Quest(q2[0], q2[1], int.Parse(q2[2]), int.Parse(q2[3]), q2[4], bool.Parse(q2[5]), bool.Parse(q2[6]))); } //read in eggs string[] eggs = System.IO.File.ReadAllLines("../../eggs"); List<Egg> eggs2 = new List<Egg>(); foreach (var item in eggs) { string[] e22 = item.Split(';'); eggs2.Add(new Egg(e22[0], e22[1], int.Parse(e22[2]))); } //read in items string[] items = System.IO.File.ReadAllLines("../../items"); List<Item> items2 = new List<Item>(); Item.equipment iteeeeem = 0; foreach (var item in items) { string[] ite2 = item.Split(';'); switch (ite2[7]) { case "helmet": iteeeeem = Item.equipment.helmet; break; case "chest": iteeeeem = Item.equipment.chest; break; case "pants": iteeeeem = Item.equipment.pants; break; case "potion": iteeeeem = Item.equipment.potion; break; case "shield": iteeeeem = Item.equipment.shield; break; case "shoes": iteeeeem = Item.equipment.shoes; break; case "weapon": iteeeeem = Item.equipment.weapon; break; default: break; } items2.Add(new Item(ite2[0], int.Parse(ite2[1]), int.Parse(ite2[2]), int.Parse(ite2[3]), int.Parse(ite2[4]), int.Parse(ite2[5]), int.Parse(ite2[6]), iteeeeem, int.Parse(ite2[8]), int.Parse(ite2[9]))); } //read in the player string pI = System.IO.File.ReadAllText("../../player"); string[] pI2 = pI.Split(';'); Area area = null; switch (pI2[4]) { case "Eirin": area = new Area("Eirin"); break; case "Pladósh": area = new Area("Pladósh"); break; case "Saepegox": area = new Area("Saepegox"); break; case "Orexdale": area = new Area("Orexdale"); break; case "The_Stocades": area = new Area("The_Stocades"); break; case "Shrine_Of_Jaagi": area = new Area("Shrine_Of_Jaagi"); break; case "Ferrington": area = new Area("Ferrington"); break; case "The_Fery": area = new Area("The_Fery"); break; case "Mount_Anor": area = new Area("Mount_Anor"); break; case "The_Plague_Lands": area = new Area("The_Plague_Lands"); break; case "Graveyard": area = new Area("Graveyard"); break; case "Undead_Castle": area = new Area("Undead_Castle"); break; case "WitchHut": area = new Area("WitchHut"); break; } Player player = new Player(pI2[0], int.Parse(pI2[1]), int.Parse(pI2[2]), int.Parse(pI2[3]), area, quests2,tama2, eggs2,items2); return player; }
private void advancedOptions() { advancedOptions: Console.Clear(); Console.WriteLine("Advanced menu"); Console.WriteLine(); Console.WriteLine("Here you can battle other monsters or craft some items if you don't want to visit the traders in the game"); Console.WriteLine(); Console.WriteLine("1 Go to battle menu"); Console.WriteLine("2 Enter a tournament"); Console.WriteLine("3 Start a campaign"); Console.WriteLine("4 Go to crafting menu"); Console.WriteLine("5 Go back to start menu"); try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { Console.Clear(); goto advancedOptions; } switch (choice) { case 1: Console.Clear(); showBattleMenu(); break; case 2: Console.Clear(); //TODO Tournament break; case 3: Console.Clear(); //TODO Campaign break; case 4: Console.Clear(); player = CM.StartCrafting(player); advancedOptions(); break; case 5: Console.Clear(); MonsterMenu(); break; default: Console.Clear(); advancedOptions(); break; } }
internal void startLoadMenu() { Console.Clear(); player = GetPlayer(); tama = player.Monsters[0]; Worker worker = new Worker(); Thread thread1 = new Thread(new ThreadStart(worker.doWork)); Thread thread2 = new Thread(new ThreadStart(MonsterMenu)); thread1.Start(); thread2.Start(); while (!thread1.IsAlive) ; Thread.Sleep(1); thread1.Join(); try { thread1.Start(); } catch (Exception) { Console.WriteLine("Couldn't restart thread"); } while (!thread2.IsAlive) ; Thread.Sleep(1); thread2.Join(); }
internal Player Mount_Anor(Player play) { try_again: Console.Clear(); player = play; Area area = new Area("Mount_Anor", 5); player.Area = area; Console.WriteLine("As you travel towards the mountains you feel an icy wind coming towards you, \n" + "it grows as you get closer and closer to the mountain and as you climb it \n" + "you start to feel your insides turn to ice."); Console.WriteLine(); Console.WriteLine("You are in " + area.Name + " level " + area.Level); Console.WriteLine("The area consist of eagles, iron golems and stone golems"); Console.WriteLine(player.stats()); Console.WriteLine(); Console.WriteLine("1 Go to Orexdale (level 3)"); Console.WriteLine("2 Explore the mountain"); Console.WriteLine("3 Save your progress"); int choice = 0; try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { goto try_again; } switch (choice) { case 1: player = Orexdale(player); break; case 2: Console.Clear(); switch (rng.Next(1, 4)) { case 1: Enemy enemy = MountAnorEnemy(area.Level); Monster tama = chooseMonster(player); Console.WriteLine("Enemy: " + combatStrength(enemy.Tama)); Console.WriteLine("You: " + combatStrength(tama)); player = FM.FightMonster(player, tama, enemy); goto try_again; case 2: int metal2 = exploreAreaMetal(area.Level); Console.WriteLine("You found metal " + metal2); player.Metal += metal2; Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); Console.Clear(); goto try_again; case 3: int money = exploreAreaMoney(area.Level); Console.WriteLine("You found money " + money); player.Money += money; Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); Console.Clear(); goto try_again; } break; case 3: return player; } return player; }
internal Player Graveyard(Player play) { Console.Clear(); player = play; Area area = new Area("Graveyard", 7); player.Area = area; player.updateQuests(null, player.Area, null, 0, 0, 0); Console.WriteLine("The graveyards looks old and ruined as you enter it. \n" + "the graves looks like someone has been digging them all up \n" + "and the air feels cold as ice, as you look around you can \n" + "only see the castle upwards even though you feel like \n" + "someone is watching you"); Console.WriteLine(); Console.WriteLine("You are in " + area.Name + " level " + area.Level); Console.WriteLine(player.stats()); Console.WriteLine(); Console.WriteLine("1 Go to the The Plague Lands"); Console.WriteLine("2 Go to the castle"); Console.WriteLine("3 Save your progress"); int choice = 0; try_again: try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { goto try_again; } switch (choice) { case 1: player = The_Plague_Lands(player); break; case 2: player = Undead_Castle(player); break; case 3: return player; } return player; }
internal Player Eirin(Player play) { Console.Clear(); Area area = new Area("Eirin", 1); player = play; player.Area = area; int choice = 0; try_again: Console.WriteLine("As you approach the area you see a lot of herbs at the side of the road \n" + "You could either continue towards Pladósh a swapish area or turn your head \n" + "towards the desert Saepegox or head towards to huge town Ferrington"); Console.WriteLine(); Console.WriteLine("You are in " + area.Name + " level " + area.Level); Console.WriteLine("The area consists of goblins and gnomes"); Console.WriteLine(); Console.WriteLine(player.stats()); Console.WriteLine(); Console.WriteLine("1 Explore the Eirin"); Console.WriteLine("2 Explore for herbs"); Console.WriteLine("3 Go to Pladósh (level 3)"); Console.WriteLine("4 Go to Saepegox (level 2)"); Console.WriteLine("5 Go to Ferrington (City)"); Console.WriteLine("6 Save your progress"); Console.WriteLine(); try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { Console.Clear(); goto try_again; } switch (choice) { case 1: Console.Clear(); switch (rng.Next(1, 4)) { case 1: Enemy enemy = EirinEnemy(area.Level); Console.WriteLine(); Console.WriteLine("You encounted a " + enemy.Name + " its estimated power " + combatStrength(enemy.Tama)); Monster tama = chooseMonster(player); player = FM.FightMonster(player, tama, enemy); goto try_again; case 2: int herbs2 = exploreAreaHerb(area.Level); Console.WriteLine("You found herbs " + herbs2); player.Herbs += herbs2; Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); Console.Clear(); goto try_again; case 3: int money = exploreAreaMoney(area.Level); Console.WriteLine("You found money " + money); player.Money += money; Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); Console.Clear(); goto try_again; } break; case 2: Console.Clear(); int herbs = 0; switch (rng.Next(1, 3)) { case 1: herbs = exploreAreaHerb(area.Level); Console.WriteLine("You found herbs " + herbs); player.Herbs += herbs; Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); Console.Clear(); goto try_again; case 2: Console.WriteLine("You didn't find anything"); Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); Console.Clear(); goto try_again; } goto try_again; case 3: player = Pladósh(player); break; case 4: player = Saepegox(player); break; case 5: player = Ferrington(player); break; case 6: return player; } return player; }
internal Player Ferrington(Player play) { try_again: Console.Clear(); player = play; Area area = new Area("Ferrington", 1); NPC npc = new NPC("Merchant"); NPC npc2 = new NPC("King's Diplomat"); Item a = IC.CreateAtkItem("Steel sword", Item.equipment.weapon, 20, 5, 100); a.Price = 200; npc.addItem(a); Item b = IC.CreateHPItem("HP potion 20", Item.equipment.potion, 20, 0); b.Price = 5; npc.addItem(b); Item c = IC.CreateArmorItem("Armor potion 20 ", Item.equipment.potion, 20, 0); c.Price = 20; npc.addItem(c); Quest quest = new Quest("The Goblin cave", "Some goblins are rampaging the trade roads, go hunt 8 goblins down and the rest might flee!", 8, 0, "money 100", false, false); Quest quest2 = new Quest("Find the source of the corruption", "Main Quest The king is looking for a hero who will undertake the task, of finding and repelling the corruption", 1, 0, "money 300", false, false); Quest quest3 = new Quest("The Sorcerer", "Find the Sorcerer to stop the corruption", 1, 0, "money 300", false, false); npc.addQuest(quest); npc2.addQuest(quest2); npc2.addQuest(quest3); area.setNPC(npc); area.setNPC2(npc2); player.Area = area; Console.Clear(); Console.WriteLine("You approach the huge city you see a couple of guards standing watch.\n" + "You slowly approach them, they sceptically look at you and you little \n" + "monster, but let you through anyways. Inside the huge city you spot a \n" + "castle straight ahead, to your left you find a bunch of houses \n" + "To your right you spot a merchant so fat he would fall over if you \n" + "touched him. You pass him and go around the town and spot another \n" + "gate leading to Orexdale"); Console.WriteLine(); Console.WriteLine("You are in " + area.Name + " level " + area.Level); Console.WriteLine(player.stats()); Console.WriteLine(); Console.WriteLine("1 Talk to the Merchant"); Console.WriteLine("2 Talk to the Kings Diplomat"); Console.WriteLine("3 Go to the The Fery (castle)"); Console.WriteLine("4 Go to the Eirin (level 1)"); Console.WriteLine("5 Go to the Orexdale (level 3)"); Console.WriteLine("6 Save your progress"); int choice = 0; try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { goto try_again; } switch (choice) { case 1: trader: Console.Clear(); Console.WriteLine("1. Do you wanna buy something?"); Console.WriteLine("2. Do you need a quest?"); Console.WriteLine("3. Return to the area"); Console.WriteLine(); int choice2 = 0, choice3 = 0; try { choice2 = int.Parse(Console.ReadLine()); } catch (Exception) { goto trader; } switch (choice2) { case 1: trader2: Console.Clear(); Console.WriteLine("Your money: " + player.Money); Console.WriteLine(); Console.WriteLine("*** Displaying items ***"); int b2; for (int i = 0; i < area.Npc.Selling.Count; i++) { b2 = i + 1; Console.WriteLine("Item: " + b2 + " " + area.Npc.Selling[i].Name); } try { Console.WriteLine("What item do you want to buy?"); Console.WriteLine("Type 0 if you don't want to buy anything"); choice3 = int.Parse(Console.ReadLine()); } catch (Exception) { goto trader2; } if (choice3 != 0) { if (area.Npc.Selling[choice2 + 1].Price <= player.Money) { player.Inventory.Add(area.Npc.Selling[choice2 + 1]); player.Money -= area.Npc.Selling[choice2 + 1].Price; } else { Console.WriteLine("You can't afford it!"); Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); Console.Clear(); } } goto trader; case 2: quests: Console.Clear(); area.Npc.displayQuests(); Console.WriteLine(); Console.WriteLine("Are you up for one of the challenges?"); Console.WriteLine("Type 0 if you wanna return to the menu"); Console.WriteLine("Else type 1"); int choice4; try { choice4 = int.Parse(Console.ReadLine()); } catch (Exception) { goto quests; } switch (choice4) { case 0: goto trader; default: if (player.checkQuest(area.Npc.Quests[choice4 - 1])) { Console.Clear(); Console.WriteLine("The quest: " + area.Npc.Quests[choice4 - 1].Name + " has been added to your questlog!"); player.Questlog.Add(area.Npc.Quests[choice4 - 1]); Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); } else { player.completeQuest(area.Npc.Quests[choice4 - 1], null); Console.WriteLine("You'r either on the quest or finished it"); Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); } break; } break; case 3: goto try_again; } goto trader; case 2: diplomat: Console.Clear(); area.Npc2.displayQuests(); int choice5 = 0; try { choice5 = int.Parse(Console.ReadLine()); } catch (Exception) { goto diplomat; } switch (choice5) { case 0: goto diplomat; default: switch (choice5) { case 1: if (player.checkQuest(area.Npc2.Quests[0])) { Console.Clear(); Console.WriteLine("The quest: " + area.Npc2.Quests[0].Name + " has been added to your questlog!"); player.Questlog.Add(area.Npc2.Quests[0]); Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); } else { player.completeQuest(area.Npc2.Quests[0], null); Console.WriteLine("You'r either on the quest or finished it"); Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); } break; case 2: if (player.completedQuest(area.Npc2.Quests[0])) { if (player.checkQuest(area.Npc2.Quests[1])) { Console.Clear(); Console.WriteLine("The quest: " + area.Npc2.Quests[1].Name + " has been added to your questlog!"); player.Questlog.Add(area.Npc2.Quests[1]); Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); } else { player.completeQuest(area.Npc2.Quests[1], null); Console.WriteLine("You'r either on the quest or finished it"); Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); } } else { Console.WriteLine("You need to complete 'Find the source of the corruption' before starting it"); Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); } break; default: break; } break; } goto try_again; case 3: player = The_Fery(player); break; case 4: player = Eirin(player); break; case 5: player = Orexdale(player); break; case 6: return player; } return player; }
private Monster chooseMonster(Player player) { try_again: Console.WriteLine(); Console.WriteLine("***** Displaying your monsters *****"); int count = 1; int choice = 0; Monster tama = null; foreach (var item in player.Monsters) { Console.WriteLine("Number: " + count); Console.WriteLine(item.combatStats()); Console.WriteLine(); count++; } try { Console.WriteLine("Which of your monster do you wanna use to fight it?"); choice = int.Parse(Console.ReadLine()) - 1; if (choice >= player.Monsters.Count || choice < 0) { Console.Clear(); goto try_again; } } catch (Exception) { Console.Clear(); goto try_again; } tama = player.Monsters[choice]; return tama; }
internal Player WitchHut(Player play) { try_again: Console.Clear(); player = play; Area area = new Area("WitchHut", 1); NPC npc = new NPC("Witch Doctor"); Quest q1 = new Quest("Learning Brewing", "Go find 20 herbs for the Witch Doctor", 20, 0, "herbs 20", false, false); npc.addQuest(q1); area.setNPC(npc); player.Area = area; Console.Clear(); Console.WriteLine("As you walk towards the hut a witch steps outside and looks at you and you wonder whether to \n" + "confront her or go back"); Console.WriteLine(); Console.WriteLine(player.stats()); Console.WriteLine(); Console.WriteLine("1 Go to Pladósh (level 3)"); Console.WriteLine("2 Talk to the " + npc.Name); Console.WriteLine("3 Save your progress"); int choice = 0; try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { goto try_again; } switch (choice) { case 1: player = Pladósh(player); break; case 2: Witch: Console.Clear(); Console.WriteLine("As you walk towards the witch she stares at you and let out a little squek before she asks you"); Console.WriteLine(); Console.WriteLine("1. Do you wanna brew something?"); Console.WriteLine("2. Or head back where you came from?"); int choice2; try { choice2 = int.Parse(Console.ReadLine()); } catch (Exception) { goto Witch; } switch (choice2) { case 1: bool questCompleted = false; foreach (var item in player.Questlog) { if (item.Name == q1.Name && item.Completed && item.Rewarded) { questCompleted = true; } } if (questCompleted) { PotionMenu(); goto Witch; } else { Console.WriteLine("Before you start brewing you have to do a quest for me"); Console.WriteLine(); Console.WriteLine("Press 1 to accept the quest"); int choice3; try { choice3 = int.Parse(Console.ReadLine()); } catch (Exception) { goto Witch; } switch (choice3) { case 1: Console.Clear(); area.Npc.displayQuests(); if (player.checkQuest(area.Npc.Quests[choice3 - 1])) { Console.Clear(); Console.WriteLine("The quest: " + area.Npc.Quests[choice3 - 1].Name + " has been added to your questlog!"); player.Questlog.Add(area.Npc.Quests[choice3 - 1]); player.updateQuests(null, null, null, player.Herbs, 0, 0); Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); } else { if (player.completeQuest(area.Npc.Quests[choice3 - 1], null)) { player.Herbs -= 20; } else Console.WriteLine("You'r either on the quest or finished it"); Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); } break; default: goto Witch; } } goto Witch; case 2: goto try_again; } break; case 3: return player; } return player; }
/// <summary> /// Takes in a player and displays its inventory and then the player can choose an item which is then /// uesd on the Monster /// </summary> /// <param name="you"></param> /// <param name="tama"></param> /// <returns></returns> private Player useItem(Player you, Monster tama) { combatItems = new List<Item>(); Console.Clear(); Console.WriteLine("*** Displaying your items ***"); int count = 1; for (int i = 0; i < you.Inventory.Count; i++) { if (you.Inventory[i].Equip == Item.equipment.potion) { Console.WriteLine("Number: " + count + " " + you.Inventory[i].Name); count++; combatItems.Add(you.Inventory[i]); } } useItem: Console.WriteLine("What item number do you want to use?"); Console.WriteLine("type 0 if you don't want to use any item"); foreach (var item in combatItems) { Console.WriteLine("It gives you " + item.showStats()); } int choice; try { choice = int.Parse(Console.ReadLine()) - 1; } catch (Exception) { Console.Clear(); goto useItem; } if (choice < 0 || choice > combatItems.Count) { this.you = tama; return you; } tama.CurrentArmor += combatItems[choice].Armor; tama.CurrentAttack += combatItems[choice].Atk; tama.CurrentHealth += combatItems[choice].Hp; you.Inventory.Remove(combatItems[choice]); combatItems = new List<Item>(); this.you = tama; return you; }
/// <summary> /// Takes in a player object to get the items there can be used in the fight and setup a fight between the 2 Monsters /// the user keeps interacting between each attack and can either attack, use item or run from the fight /// </summary> /// <param name="player"></param> /// <param name="you"></param> /// <param name="enemy"></param> /// <returns></returns> internal Player FightMonster(Player player, Monster you, Enemy ene) { this.you = you; old = you; Monster enemy = ene.Tama; enemy.prepareForBattle(); //Configures the attack and armor to itself if it has been modified by a battle before this.you.prepareForBattle(); //Configures the attack and armor to itself if it has been modified by a battle before int choice = 0; Console.Clear(); while (enemy.CurrentHealth > 0 && this.you.CurrentHealth > 0) { fightingMenu: Console.WriteLine("****************"); Console.WriteLine("Enemy: " + enemy.CurrentHealth + " you: " + this.you.CurrentHealth); Console.WriteLine("****************"); Console.WriteLine("Enemy stats: armor: " + enemy.CurrentArmor + " attack: " + enemy.CurrentAttack); Console.WriteLine(); Console.WriteLine("Your stats: armor: " + this.you.CurrentArmor + " attack: " + this.you.CurrentAttack); Console.WriteLine("****************"); Console.WriteLine(); Console.WriteLine("1. Do you wanna attack?"); Console.WriteLine("2. Use an item?"); Console.WriteLine("3. Run from the fight?"); try { choice = Convert.ToInt32(Console.ReadLine()); Console.Clear(); } catch (Exception) { Console.Clear(); goto fightingMenu; } switch (choice) { case 1: int a = attack(this.you, enemy); enemy.CurrentHealth -= a; Console.WriteLine("You did " + a + " damage to it"); Console.WriteLine(); break; case 2: if (player.Inventory.Count <= 0) { goto fightingMenu; } for (int i = 0; i < player.Inventory.Count; i++) { if (!player.Inventory[i].Name.Contains("potion")) { goto fightingMenu; } } player = useItem(player, this.you); goto fightingMenu; case 3: this.you.CurrentHealth = this.you.MaxHealth; player.Monsters.Remove(old); player.Monsters.Add(this.you); return player; default: goto fightingMenu; } if (enemy.CurrentHealth > 0 && this.you.CurrentHealth > 0) { int a = attack(enemy, this.you); this.you.CurrentHealth -= a; Console.WriteLine(ene.Name +" did " + a + " damage to you"); Console.WriteLine(); } } if (enemy.CurrentHealth <= 0) { Console.Clear(); Console.WriteLine("Congratz you won the battle"); Console.WriteLine(); this.you = this.you.grantExp(you, 20 * enemy.Level); player.Money += 5 * enemy.Level; Console.WriteLine("Exp: " + 20 * enemy.Level); Console.WriteLine("Money: " + 5 * enemy.Level); player.updateQuests(ene, null, null, 0, 5 * enemy.Level, 0); Console.WriteLine(); } else { Console.WriteLine("You lost the battle"); Console.WriteLine(); //TODO Decide what to do when the player lost the battle } this.you.CurrentHealth = this.you.MaxHealth; player.Monsters.Remove(old); player.Monsters.Add(this.you); return player; }
internal Player Oasis_Of_Jaagi(Player play) { Console.Clear(); player = play; Area area = new Area("Oasis_Of_Jaagi", 5); player.Area = area; Console.Clear(); Console.WriteLine("You are in " + area.Name + " level " + area.Level); Console.WriteLine(player.stats()); Console.WriteLine(); Console.WriteLine("1 Go to the Saepegox"); Console.WriteLine("2 Save your progress"); int choice = 0; try_again: try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { goto try_again; } switch (choice) { case 1: player = Saepegox(player); break; case 2: return player; } return player; }
internal void startNewtMonsterGame() { Console.Clear(); try_parse: Console.WriteLine("What is your username?"); try { String username = Console.ReadLine(); Console.Clear(); player = new Player(username); ItemCreater ic = new ItemCreater(); player.Inventory.Add(ic.CreateHPItem("HP potion", Item.equipment.potion, 20, 1)); player.Inventory.Add(ic.CreateHPItem("HP potion", Item.equipment.potion, 20, 1)); player.Inventory.Add(ic.CreateHPItem("HP potion", Item.equipment.potion, 20, 1)); player.Inventory.Add(ic.CreateHPItem("HP potion", Item.equipment.potion, 20, 1)); player.Inventory.Add(ic.CreateHPItem("HP potion", Item.equipment.potion, 20, 1)); player.Inventory.Add(ic.CreateHPItem("HP potion", Item.equipment.potion, 20, 1)); tama = new Monster(); player.Monsters.Add(tama); } catch (Exception) { Console.WriteLine("There is no such option available"); goto try_parse; } Console.WriteLine("You start adventure out in the world"); Console.WriteLine(); Console.WriteLine("Press Enter to continue"); Console.Read(); Console.Clear(); Worker worker = new Worker(); Thread thread1 = new Thread(new ThreadStart(worker.doWork)); Thread thread2 = new Thread(new ThreadStart(MonsterMenu)); thread1.Start(); thread2.Start(); while (!thread1.IsAlive) ; Thread.Sleep(1); thread1.Join(); try { thread1.Start(); } catch (Exception) { Console.WriteLine("Couldn't restart thread"); } while (!thread2.IsAlive) ; Thread.Sleep(1); thread2.Join(); }
internal Player Orexdale(Player play) { Console.Clear(); player = play; Area area = new Area("Orexdale", 3); player.Area = area; try_again: Console.WriteLine("You travel out of the gate and look beyond the horizon and see huge open area of grass and river \n" + "you even spot a waterfall across the landscape and far away you see a dark forest with smoke lurking above it \n" + "as you look even further you even spot a few mountains"); Console.WriteLine(); Console.WriteLine("You are in " + area.Name + " level " + area.Level); Console.WriteLine("The area consist of Gnomes, goblinscouts and rivermonsters"); Console.WriteLine(player.stats()); Console.WriteLine(); Console.WriteLine("1 Go to Ferrington (city)"); Console.WriteLine("2 Go to Mount Anor (level 5)"); Console.WriteLine("3 Go to The Plague Lands (level 6)"); Console.WriteLine("4 explore the mountains"); Console.WriteLine("5 Save your progress"); int choice = 0; try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { goto try_again; } switch (choice) { case 1: player = Ferrington(player); break; case 2: player = Mount_Anor(player); break; case 3: player = The_Plague_Lands(player); break; case 4: Console.Clear(); switch (rng.Next(1, 4)) { case 1: Enemy enemy = OrexdaleEnemy(area.Level); Monster tama = chooseMonster(player); Console.WriteLine("Enemy: " + combatStrength(enemy.Tama)); Console.WriteLine("You: " + combatStrength(tama)); player = FM.FightMonster(player, tama, enemy); goto try_again; case 2: int metal2 = exploreAreaMetal(area.Level); Console.WriteLine("You found metal " + metal2); player.Metal += metal2; Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); Console.Clear(); goto try_again; case 3: int money = exploreAreaMoney(area.Level); Console.WriteLine("You found money " + money); player.Money += money; Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); Console.Clear(); goto try_again; } break; case 5: return player; } return player; }
private void exploreTheWorld() { switch (player.Area.Name) { case "Eirin": player = AC.Eirin(player); break; case "Pladósh": player = AC.Pladósh(player); break; case "Saepegox": player = AC.Saepegox(player); break; case "Orexdale": player = AC.Orexdale(player); break; case "The_Stocades": player = AC.The_Stocades(player); break; case "Oasis_Of_Jaagi": player = AC.Oasis_Of_Jaagi(player); break; case "Ferrington": player = AC.Ferrington(player); break; case "The_Fery": player = AC.The_Fery(player); break; case "Mount_Anor": player = AC.Mount_Anor(player); break; case "The_Plague_Lands": player = AC.The_Plague_Lands(player); break; case "Graveyard": player = AC.Graveyard(player); break; case "Undead_Castle": player = AC.Undead_Castle(player); break; case "WitchHut": player = AC.WitchHut(player); break; } MonsterMenu(); }
internal Player Pladósh(Player play) { Console.Clear(); Area area = new Area("Pladósh", 3); player = play; player.Area = area; try_again: int choice = 0; Console.Clear(); Console.WriteLine("As you reach the swamp your feets seems to stick to the ground and a smoke starts to appear over the ground \n" + "As you scout out the area you see a witchhut and decided wether to go visit it or explore the swamp \n"); Console.WriteLine(); Console.WriteLine("You are in " + area.Name + " level " + area.Level); Console.WriteLine("The area consist of Fairies, Fireflies and Swamp Humanoids"); Console.WriteLine(player.stats()); Console.WriteLine(); Console.WriteLine("1 Go to Eirin (level 1)"); Console.WriteLine("2 Explore the swamp"); Console.WriteLine("3 Go to the Withhut"); Console.WriteLine("4 Save your progress"); try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { goto try_again; } switch (choice) { case 1: player = Eirin(player); break; case 2: Console.Clear(); switch (rng.Next(1, 4)) { case 1: Enemy enemy = PlagóshEnemy(area.Level); Monster tama = chooseMonster(player); Console.WriteLine("Enemy: " + combatStrength(enemy.Tama)); Console.WriteLine("You: " + combatStrength(tama)); player = FM.FightMonster(player, tama, enemy); goto try_again; case 2: int herbs2 = exploreAreaHerb(area.Level); Console.WriteLine("You found herbs " + herbs2); player.Herbs += herbs2; Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); Console.Clear(); goto try_again; case 3: int money = exploreAreaMoney(area.Level); Console.WriteLine("You found money " + money); player.Money += money; Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); Console.Clear(); goto try_again; } break; case 3: player = WitchHut(player); break; case 4: return player; } return player; }
private void showBattleMenu() { Console.Clear(); Console.WriteLine("**** Battle menu ****"); Console.WriteLine("Status on your monster: " + tama.ToString()); Console.WriteLine(); Console.WriteLine("1. Battle a random monster level 1"); Console.WriteLine("2. Battle a random monster level 1-5"); Console.WriteLine("3. Battle a random monster level 5-10"); Console.WriteLine("4. Battle a random monster level 10-15"); Console.WriteLine("5. Go back to the Monster menu"); try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { showBattleMenu(); } Random rng = new Random(); Enemy enemy; switch (choice) { case 1: enemy = EC.CreateRandomEnemy(1); player = FM.FightMonster(player, tama, enemy); tama = player.Monsters[player.Monsters.Count - 1]; showBattleMenu(); break; case 2: enemy = EC.CreateRandomEnemy(rng.Next(1, 6)); player = FM.FightMonster(player, tama, enemy); showBattleMenu(); break; case 3: enemy = EC.CreateRandomEnemy(rng.Next(6, 10)); player = FM.FightMonster(player, tama, enemy); showBattleMenu(); break; case 4: enemy = EC.CreateRandomEnemy(rng.Next(10, 16)); player = FM.FightMonster(player, tama, enemy); showBattleMenu(); break; case 5: Console.Clear(); MonsterMenu(); break; default: break; } }
internal Player Saepegox(Player play) { Console.Clear(); player = play; Area area = new Area("Saepegox", 2); player.Area = area; try_again: Console.Clear(); Console.WriteLine("The desert stretches out as far as your eyes can see, you spot a single oasis \n" + "and wonder whether to turn back or head to it \n"); Console.WriteLine(); Console.WriteLine("You are in " + area.Name + " level " + area.Level); Console.WriteLine("The area consist of Mummies, Pharoahs and Sphinxs"); Console.WriteLine(player.stats()); Console.WriteLine(); Console.WriteLine("1 Go to the Eirin (level 1)"); Console.WriteLine("2 Go to the Oasis of Jaagi (level 5)"); Console.WriteLine("3 Explore the area"); Console.WriteLine("4 Save your progress"); int choice = 0; try { choice = int.Parse(Console.ReadLine()); } catch (Exception) { goto try_again; } switch (choice) { case 1: player = Eirin(player); break; case 2: player = Oasis_Of_Jaagi(player); break; case 3: Console.Clear(); switch (rng.Next(1, 3)) { case 1: Enemy enemy = SaepegoxEnemy(area.Level); Monster tama = chooseMonster(player); Console.WriteLine("Enemy: " + combatStrength(enemy.Tama)); Console.WriteLine("You: " + combatStrength(tama)); player = FM.FightMonster(player, tama, enemy); goto try_again; case 2: int money = exploreAreaMoney(area.Level); Console.WriteLine("You found money " + money); player.Money += money; Console.WriteLine(); Console.WriteLine("Press enter to continue"); Console.ReadLine(); Console.Clear(); goto try_again; } break; case 4: return player; } return player; }