public void ClimbBridge(ref Player player) { Random rnd = new Random(); int fall = rnd.Next(1, 100); if (fall >= 80) { Console.WriteLine("Noo! You fell in to the river!"); Console.WriteLine("You take 20 damage for falling in to the river!"); Console.WriteLine("Luckily you could swim to the shore on the other side!"); player.TakeHit(20); } else { Console.WriteLine("The side of the Bridge is really slippery!"); Console.WriteLine("Luckly you made it without a scratch!"); } }
static void Start(ref Map map, ref Player player, ref Bandit bandit, ref Spider spider, ref Skeleton skeleton, ref Skeleton1 skeleton1, ref Skeleton2 skeleton2, ref Kraken kraken, ref Bchief bchief, ref DwarfKing dking, ref Zealot zealot, ref Troll troll, ref Snake snake) { List <string> menuItems = new List <string>(); int choice; // Refactored by Michiel and Alex do { Console.Clear(); map.GetLocation().Description(); choice = ShowMenu(map, ref menuItems, ref player); if (choice != menuItems.Count()) { if (validDirections.Contains(menuItems[choice])) { map.Move(menuItems[choice]); } switch (menuItems[choice]) { case ACTION_HEAL: player.HealPlayer(player); player.CheckHealth(player); break; case ACTION_TREASURE: Console.WriteLine("You return to Mana with your spoils and live a happy life"); Console.WriteLine("The game is now technically over, but feel free to wander around."); Console.WriteLine(""); Console.WriteLine("Thanks for playing!"); Console.WriteLine("Made by: Thom Martens, Kevin Rademacher and Bas Overvoorde"); Console.ReadKey(); break; case ACTION_STATS: player.ShowStats(player); Console.ReadKey(); break; case ACTION_INV: player.ShowInventory(); Console.ReadKey(); break; case ACTION_SEARCH: Console.Clear(); Dictionary <string, Objects> list = map.GetLocation().GetItems(); Objects[] obj = list.Values.ToArray(); for (int i = 0; i < obj.Count(); i++) { if (obj[i].GetAcquirable()) { player.PickupItem(obj[i]); } Console.ReadKey(); } player.HasStrBuff(player); player.HasArmBuff(player); break; case ACTION_FIGHT: map.GetLocation().hasEnemy = true; //church fight if (map.GetLocation().GetName() == "Church of Stendarr") { Console.WriteLine("You encounter a {0}!", zealot.GetName()); Console.WriteLine("Health:{0}/{1}", zealot.health, zealot.maxhealth); Console.WriteLine("Strenght:{0}", zealot.GetStr()); // Console.WriteLine("Thoughness: {0}", zealot.GetThough()); Console.WriteLine("Examine: {0}", zealot.Description()); Console.ReadKey(); if (zealot.health > 0) { Console.WriteLine("The {0} hits you with his sword!", zealot.GetName()); player.TakeHit(zealot.GetStr() - player.GetThough()); zealot.health = zealot.health -= player.GetStr(); Console.WriteLine("You strike the {0} with your weapon.", zealot.GetName()); Console.WriteLine("You deal {0} damage", player.GetStr()); if (zealot.health > 0) { Console.WriteLine("The {0} has {1} health left.", zealot.GetName(), zealot.health); } else if (zealot.health <= 0) { zealot.health = 0; Console.WriteLine("The {0} has {1} health left", zealot.GetName(), zealot.health); } Console.ReadKey(); } if (zealot.health <= 0) { Console.WriteLine("The {0} is dead.", zealot.GetName()); map.GetLocation().hasEnemy = false; Console.ReadKey(); } } if (map.GetLocation().GetName() == "Bog") { Console.WriteLine("You encounter a {0}!", snake.GetName()); Console.WriteLine("Health:{0}/{1}", snake.health, snake.maxhealth); Console.WriteLine("Strenght:{0}", snake.GetStr()); // Console.WriteLine("Thoughness: {0}", zealot.GetThough()); Console.WriteLine("Examine: {0}", snake.Description()); Console.ReadKey(); if (snake.health > 0) { Console.WriteLine("The {0} tries to bite you!", snake.GetName()); player.TakeHit(snake.GetStr() - player.GetThough()); snake.health = snake.health -= player.GetStr(); Console.WriteLine("You strike the {0} with your weapon.", snake.GetName()); Console.WriteLine("You deal {0} damage", player.GetStr()); if (snake.health > 0) { Console.WriteLine("The {0} has {1} health left.", snake.GetName(), snake.health); } else if (snake.health <= 0) { snake.health = 0; Console.WriteLine("The {0} has {1} health left", snake.GetName(), snake.health); } Console.ReadKey(); } if (snake.health <= 0) { Console.WriteLine("The {0} is dead.", snake.GetName()); map.GetLocation().hasEnemy = false; Console.ReadKey(); } } if (map.GetLocation().GetName() == "Dragonstar") { Console.WriteLine("You encounter a {0}!", bandit.GetName()); Console.WriteLine("Health:{0}/{1}", bandit.health, bandit.maxhealth); Console.WriteLine("Strenght:{0}", bandit.GetStr()); //Console.WriteLine("Thoughness: {0}", bandit.GetThough()); Console.WriteLine("Examine: {0}", bandit.Description()); Console.ReadKey(); if (bandit.health > 0) { Console.WriteLine("The {0} hits you with his sword!", bandit.GetName()); player.TakeHit(bandit.GetStr() - player.GetThough()); bandit.health = bandit.health -= player.GetStr(); Console.WriteLine("You strike the {0} with your weapon.", bandit.GetName()); if (bandit.health > 0) { Console.WriteLine("The {0} has {1} health left.", bandit.GetName(), bandit.health); } else if (bandit.health <= 0) { bandit.health = 0; Console.WriteLine("The {0} has {1} health left", bandit.GetName(), bandit.health); } Console.ReadKey(); } if (bandit.health <= 0) { Console.WriteLine("The {0} is dead.", bandit.GetName()); map.GetLocation().hasEnemy = false; Console.ReadKey(); } } //forest fight if (map.GetLocation().GetName() == "Woodhearth") { Console.WriteLine("You encounter a {0}!", spider.GetName()); Console.WriteLine("Health:{0}/{1}", spider.health, spider.maxhealth); Console.WriteLine("Strenght:{0}", spider.GetStr()); //Console.WriteLine("Thoughness: {0}", spider.GetThough()); Console.WriteLine("Examine: {0}", spider.Description()); Console.ReadKey(); if (spider.health > 0) { Console.WriteLine("The {0} hits you with his huge fangs!", spider.GetName()); player.TakeHit(spider.GetStr() - player.GetThough()); spider.health = spider.health - player.GetStr(); Console.WriteLine("You strike the {0} with your weapon.", spider.GetName()); if (spider.health > 0) { Console.WriteLine("The {0} has {1} health left.", spider.GetName(), spider.health); } else if (spider.health <= 0) { spider.health = 0; Console.WriteLine("The {0} has {1} health left", spider.GetName(), spider.health); } Console.ReadKey(); } if (spider.health <= 0) { spider.health = 0; Console.WriteLine("The {0} is dead.", spider.GetName()); map.GetLocation().hasEnemy = false; Console.ReadKey(); } } //tombroom fight if (map.GetLocation().GetName() == "Tombroom1") { Console.WriteLine("You encounter a {0}!", skeleton.GetName()); Console.WriteLine("Health:{0}/{1}", skeleton.health, skeleton.maxhealth); Console.WriteLine("Strenght:{0}", skeleton.GetStr()); //Console.WriteLine("Thoughness: {0}", skeleton.GetThough()); Console.WriteLine("Examine: {0}", skeleton.Description()); Console.ReadKey(); if (skeleton.health > 0) { Console.WriteLine("The {0} hits you with his Giant Axe!", skeleton.GetName()); player.TakeHit(skeleton.GetStr() - player.GetThough()); skeleton.health = skeleton.health -= player.GetStr(); Console.WriteLine("You strike the {0} with your weapon.", skeleton.GetName()); if (skeleton.health > 0) { Console.WriteLine("The {0} has {1} health left.", skeleton.GetName(), skeleton.health); } else if (skeleton.health <= 0) { skeleton.health = 0; Console.WriteLine("The {0} has {1} health left", skeleton.GetName(), skeleton.health); } Console.ReadKey(); } if (skeleton.health <= 0) { Console.WriteLine("The {0} is dead.", skeleton.GetName()); map.GetLocation().hasEnemy = false; Console.ReadKey(); } } //tombroom1 fight if (map.GetLocation().GetName() == "Tombroom2") { Console.WriteLine("You encounter a {0}!", skeleton1.GetName()); Console.WriteLine("Health:{0}/{1}", skeleton1.health, skeleton1.maxhealth); Console.WriteLine("Strenght:{0}", skeleton1.GetStr()); //Console.WriteLine("Thoughness: {0}", skeleton1.GetThough()); Console.WriteLine("Examine: {0}", skeleton1.Description()); Console.ReadKey(); if (skeleton1.health > 0) { Console.WriteLine("The {0} shoots at you with his bow!", skeleton1.GetName()); player.TakeHit(skeleton1.GetStr() - player.GetThough()); skeleton1.health = skeleton1.health -= player.GetStr(); Console.WriteLine("You strike the {0} with your weapon.", skeleton1.GetName()); if (skeleton1.health > 0) { Console.WriteLine("The {0} has {1} health left.", skeleton1.GetName(), skeleton1.health); } else if (skeleton1.health <= 0) { skeleton1.health = 0; Console.WriteLine("The {0} has {1} health left", skeleton1.GetName(), skeleton1.health); } Console.ReadKey(); } if (skeleton1.health <= 0) { Console.WriteLine("The {0} is dead.", skeleton1.GetName()); map.GetLocation().hasEnemy = false; Console.ReadKey(); } } //tombroom2 fight if (map.GetLocation().GetName() == "Tombroom3") { Console.WriteLine("You encounter a {0}!", skeleton2.GetName()); Console.WriteLine("Health:{0}/{1}", skeleton2.health, skeleton2.maxhealth); Console.WriteLine("Strenght:{0}", skeleton2.GetStr()); //Console.WriteLine("Thoughness: {0}", skeleton2.GetThough()); Console.WriteLine("Examine: {0}", skeleton2.Description()); Console.ReadKey(); if (skeleton2.health > 0) { Console.WriteLine("The {0} strikes you with his sword!", skeleton2.GetName()); player.TakeHit(skeleton2.GetStr() - player.GetThough()); skeleton2.health = skeleton2.health -= player.GetStr(); Console.WriteLine("You strike the {0} with your weapon.", skeleton2.GetName()); if (skeleton2.health > 0) { Console.WriteLine("The {0} has {1} health left.", skeleton2.GetName(), skeleton2.health); } else if (skeleton2.health <= 0) { skeleton2.health = 0; Console.WriteLine("The {0} has {1} health left", skeleton2.GetName(), skeleton2.health); } Console.ReadKey(); } if (skeleton2.health <= 0) { Console.WriteLine("The {0} is dead.", skeleton2.GetName()); map.GetLocation().hasEnemy = false; Console.ReadKey(); } } //tombroom 3 fight if (map.GetLocation().GetName() == "Tombroom4") { Console.WriteLine("You encounter a {0}!", skeleton.GetName()); Console.WriteLine("Health:{0}/{1}", skeleton.health, skeleton.maxhealth); Console.WriteLine("Strenght:{0}", skeleton.GetStr()); //Console.WriteLine("Thoughness: {0}", skeleton.GetThough()); Console.WriteLine("Examine: {0}", skeleton.Description()); Console.ReadKey(); if (skeleton.health > 0) { Console.WriteLine("The {0} hits you with his Giant Axe!", skeleton.GetName()); player.TakeHit(skeleton.GetStr() - player.GetThough()); skeleton.health = skeleton.health -= player.GetStr(); Console.WriteLine("You strike the {0} with your weapon.", skeleton.GetName()); if (skeleton.health > 0) { Console.WriteLine("The {0} has {1} health left.", skeleton.GetName(), skeleton.health); } else if (skeleton.health <= 0) { skeleton.health = 0; Console.WriteLine("The {0} has {1} health left", skeleton.GetName(), skeleton.health); } Console.ReadKey(); } if (skeleton.health <= 0) { Console.WriteLine("The {0} is dead.", skeleton.GetName()); map.GetLocation().hasEnemy = false; Console.ReadKey(); } } //troll fight if (map.GetLocation().GetName() == "The Hanger") { Console.WriteLine("You encounter a {0}!", troll.GetName()); Console.WriteLine("Health:{0}/{1}", troll.health, troll.maxhealth); Console.WriteLine("Strenght:{0}", troll.GetStr()); //Console.WriteLine("Thoughness: {0}", spider.GetThough()); Console.WriteLine("Examine: {0}", troll.Description()); Console.ReadKey(); if (troll.health > 0) { Console.WriteLine("The {0} hits you with his giant club!", troll.GetName()); player.TakeHit(troll.GetStr() - player.GetThough()); troll.health = troll.health - player.GetStr(); Console.WriteLine("You strike the {0} with your weapon.", troll.GetName()); if (troll.health > 0) { Console.WriteLine("The {0} has {1} health left.", troll.GetName(), troll.health); } else if (troll.health <= 0) { troll.health = 0; Console.WriteLine("The {0} has {1} health left", troll.GetName(), troll.health); } Console.ReadKey(); } if (troll.health <= 0) { troll.health = 0; Console.WriteLine("The {0} is dead.", troll.GetName()); map.GetLocation().hasEnemy = false; Console.ReadKey(); } } break; case ACTION_RUN: map.Run(); Console.WriteLine("You run away to {0}", map.GetLocation().GetName()); Console.ReadKey(); break; case ACTION_BOSS: map.GetLocation().hasBossEnemy = true; //kraken boss if (map.GetLocation().GetName() == "Black Lake") { Console.WriteLine("You encounter a {0}!", kraken.GetName()); Console.WriteLine("Health:{0}/{1}", kraken.health, kraken.maxhealth); Console.WriteLine("Strenght:{0}", kraken.GetStr()); //Console.WriteLine("Thoughness: {0}", kraken.GetThough()); Console.WriteLine("Examine: {0}", kraken.Description()); Console.ReadKey(); if (kraken.health > 0) { Console.WriteLine("The {0} strikes you with his tentacles!", kraken.GetName()); player.TakeHit(kraken.GetStr() - player.GetThough()); kraken.health = kraken.health -= player.GetStr(); Console.WriteLine("You strike the {0} with your weapon.", kraken.GetName()); if (kraken.health > 0) { Console.WriteLine("The {0} has {1} health left.", kraken.GetName(), kraken.health); } else if (kraken.health <= 0) { kraken.health = 0; Console.WriteLine("The {0} has {1} health left", kraken.GetName(), kraken.health); } Console.ReadKey(); } if (kraken.health <= 0) { Console.WriteLine("The {0} is dead.", kraken.GetName()); map.GetLocation().hasBossEnemy = false; Console.ReadKey(); } } //chief bandit if (map.GetLocation().GetName() == "Dragonstar armory") { Console.WriteLine("You encounter the {0}!", bchief.GetName()); Console.WriteLine("Health:{0}/{1}", bchief.health, bchief.maxhealth); Console.WriteLine("Strenght:{0}", bchief.GetStr()); //Console.WriteLine("Thoughness: {0}", bchief.GetThough()); Console.WriteLine("Examine: {0}", bchief.Description()); Console.ReadKey(); if (bchief.health > 0) { Console.WriteLine("The {0} strikes you with his basterdsword!", bchief.GetName()); player.TakeHit(bchief.GetStr() - player.GetThough()); bchief.health = bchief.health -= player.GetStr(); Console.WriteLine("You strike the {0} with your weapon.", bchief.GetName()); Console.WriteLine("The {0} has {1} health left.", bchief.GetName(), bchief.health); Console.ReadKey(); } if (bchief.health <= 0) { Console.WriteLine("The {0} is dead.", bchief.GetName()); map.GetLocation().hasBossEnemy = false; Console.ReadKey(); } } //dwarf king fight if (map.GetLocation().GetName() == "TombTreasureRoom") { Console.WriteLine("You encounter {0}!", dking.GetName()); Console.WriteLine("Health:{0}/{1}", dking.health, dking.maxhealth); Console.WriteLine("Strenght:{0}", dking.GetStr()); //Console.WriteLine("Thoughness: {0}", dking.GetThough()); Console.WriteLine("Examine: {0}", dking.Description()); Console.ReadKey(); if (dking.health > 0) { Console.WriteLine("The {0} strikes you with his Axe!", dking.GetName()); player.TakeHit(dking.GetStr() - player.GetThough()); dking.health = dking.health -= player.GetStr(); Console.WriteLine("You strike the {0} with your weapon.", dking.GetName()); Console.WriteLine("The {0} has {1} health left.", dking.GetName(), dking.health); Console.ReadKey(); } if (dking.health <= 0) { Console.WriteLine("The {0} is dead.", dking.GetName()); map.GetLocation().hasBossEnemy = false; Console.ReadKey(); } } break; case ACTION_INN: player.SetHealth(); Console.WriteLine("You have been healed!"); Console.ReadKey(); break; } } } // When the choice is equal to the total item it means exit has been chosen. while (choice < menuItems.Count() - 1); }
static void Start(ref Map map, ref Player player) { List <string> menuItems = new List <string>(); int choice = 0; Random rdm = new Random(); // Refactored by Michiel and Alex do { Console.Clear(); map.GetLocation().Description(ref map); if (menuItems.Count != 0) { if (menuItems[choice].StartsWith(ACTION_DISCRIPTION_NORTH)) { Program.PrintLine(100, map.GetLocation().GetBlockage(0).GetDiscription(ref map)); } else if (menuItems[choice].StartsWith(ACTION_DISCRIPTION_EAST)) { Program.PrintLine(100, map.GetLocation().GetBlockage(1).GetDiscription(ref map)); } else if (menuItems[choice].StartsWith(ACTION_DISCRIPTION_SOUTH)) { Program.PrintLine(100, map.GetLocation().GetBlockage(2).GetDiscription(ref map)); } else if (menuItems[choice].StartsWith(ACTION_DISCRIPTION_WEST)) { Program.PrintLine(100, map.GetLocation().GetBlockage(3).GetDiscription(ref map)); } } choice = ShowMenu(map, ref menuItems); if (choice != menuItems.Count()) { if (validDirections.Contains(menuItems[choice])) { map.Move(menuItems[choice]); } if (menuItems[choice].StartsWith(ACTION_INTERACT_NORTH)) { map.GetLocation().GetBlockage(0).OnPlayerInteraction(ref player, ref map); } else if (menuItems[choice].StartsWith(ACTION_INTERACT_EAST)) { map.GetLocation().GetBlockage(1).OnPlayerInteraction(ref player, ref map); } else if (menuItems[choice].StartsWith(ACTION_INTERACT_SOUTH)) { map.GetLocation().GetBlockage(2).OnPlayerInteraction(ref player, ref map); } else if (menuItems[choice].StartsWith(ACTION_INTERACT_WEST)) { map.GetLocation().GetBlockage(3).OnPlayerInteraction(ref player, ref map); } switch (menuItems[choice]) { case ACTION_SEARCH: foreach (Objects item in map.GetLocation().GetItems().Values) { player.PickupItem(item); } break; case ACTION_FIGHT: map.GetLocation().GetEnemy().TakeHit(rdm.Next(10, 20)); if (map.GetLocation().GetEnemy().GetHealth() > 0) { player.TakeHit(rdm.Next(5, 20)); if (player.GetHealth() <= 0) { Console.ReadLine(); Quit(); } } else { Program.PrintLine(100, "You have won from you enemy"); if (!map.GetLocation().GetItems().ContainsKey(map.GetLocation().GetEnemy().Loot().GetName())) { map.GetLocation().GetItems().Add(map.GetLocation().GetEnemy().Loot().GetName(), map.GetLocation().GetEnemy().Loot()); } map.GetLocation().SetEnemy(null); } break; case ACTION_RUN: Program.PrintLine(100, "You shouldn't have runned away from your enemy"); Console.ReadLine(); Quit(); break; } } } // When the choice is equal to the total item it means exit has been chosen. while (choice < menuItems.Count() - 1); }