static void PlayerRetreat(ref Player player, ref Vendor vendor, string[,,] theMap) { if ((rand.Next(0, 101) - player.dexterity) > 50) { BattleVendor.VendorAttack(ref player, ref vendor); } if (player.strength > 0) { YWMenu battleMenu = new YWMenu(); string question = $"Retreat which way"; Dictionary <char, string> choicesDict = new Dictionary <char, string> { { 'N', "North" }, { 'S', "South" }, { 'E', "East" }, { 'W', "West" } }; string[] choice = battleMenu.Menu(question, choicesDict, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages)); switch (choice[1]) { case "North": player.North(theMap); Console.WriteLine("\nYou retreat to the North!"); SharedMethods.WaitForKey(); break; case "South": player.South(theMap); Console.WriteLine("\nYou retreat to the South!"); SharedMethods.WaitForKey(); break; case "East": player.East(theMap); Console.WriteLine("\nYou retreat to the East!"); SharedMethods.WaitForKey(); break; case "West": player.West(theMap); Console.WriteLine("\nYou retreat to the West!"); SharedMethods.WaitForKey(); break; } } }
public static void BattleSequence(ref Player player, ref Vendor vendor, string[,,] theMap) { YWMenu battleMenu = new YWMenu(); string question; bool firstAttackRound = true; Dictionary <char, string> choicesDict = new Dictionary <char, string> { { 'A', "Attack" }, { 'R', "Retreat" } }; do { Console.WriteLine($"\nYou are facing a {vendor.race}!"); question = "What would you like to do"; if ((((rand.Next(0, 101) + vendor.dexterity) > 75) || player.lethargy) && firstAttackRound) { BattleVendor.VendorAttack(ref player, ref vendor); } else if (firstAttackRound) { choicesDict.Add('B', "Bribe"); } if (player.intelligence > 14) { choicesDict.Add('C', "Cast"); } if (player.strength > 0) { string[] choice = battleMenu.Menu(question, choicesDict, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages)); switch (choice[1]) { case "Attack": BattleVendor.PlayerAttack(ref player, ref vendor); break; case "Bribe": BattleVendor.PlayerBribe(ref player, ref vendor); break; case "Cast": BattleVendor.PlayerCast(ref player, ref vendor); break; case "Retreat": BattleVendor.PlayerRetreat(ref player, ref vendor, theMap); break; } if (vendor.strength > 0 && vendor.mad && player.location.SequenceEqual(vendor.location)) { BattleVendor.VendorAttack(ref player, ref vendor); } } if (choicesDict.ContainsKey('B')) { choicesDict.Remove('B'); } if (choicesDict.ContainsKey('C')) { choicesDict.Remove('C'); } firstAttackRound = false; } while (vendor.mad && vendor.strength > 0 && player.strength > 0 && vendor.location.SequenceEqual(player.location)); if (vendor.strength < 1) { vendor.gold = rand.Next(1, 1001); Console.WriteLine($"\nYou killed the evil {vendor.race}"); Console.WriteLine($"You get his hoard of {vendor.gold} Gold Pieces"); Console.WriteLine($"You also get the {vendor.race}'s Sword and Plate armor and Lamp"); player.weapon = "Sword"; player.armor = "Plate"; player.lamp = true; player.gold += vendor.gold; if (vendor.runeStaff) { Console.WriteLine("You've found the RuneStaff!"); player.runeStaff = true; } if (vendor.treasures.Count > 0) { Console.WriteLine($"You've recoverd the {vendor.treasures[0]}"); player.treasures.Add(vendor.treasures[0]); } Console.WriteLine(); } }