示例#1
0
 static void PlayerBribe(ref Player player, ref Vendor vendor)
 {
     if (player.treasures.Count > 0)
     {
         string treasure = player.treasures[rand.Next(player.treasures.Count)];
         Console.WriteLine($"The {vendor.race} says I want the {treasure}. Will you give it to me?");
         YWMenu battleMenu = new YWMenu();
         string question   = $"Give the {vendor.race} the {treasure}";
         Dictionary <char, string> choicesDict = new Dictionary <char, string>
         {
             { 'Y', "Yes" },
             { 'N', "No" }
         };
         string[] choice = battleMenu.Menu(question, choicesDict, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages));
         if (choice[0] == "Y")
         {
             Console.WriteLine($"\nThe {vendor.race} says, ok, just don't tell anyone.");
             player.treasures.Remove(treasure);
             vendor.treasures.Add(treasure);
             vendor.mad = false;
             GameCollections.AllVendorMad = false;
         }
     }
     if (vendor.mad)
     {
         Console.WriteLine($"\nThe {vendor.race} says, all I want is your life!");
     }
 }
示例#2
0
        public static void ViewInstructions()
        {
            int counter = 0;

            string[] choice;
            YWMenu   gameMenu = new YWMenu();

            choice = gameMenu.Menu("Would you like to view the instructions", new Dictionary <char, string>
            {
                { 'Y', "View the Instructions" },
                { 'N', "Start the Game" }
            }, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages));
            if (choice[0] == "Y")
            {
                System.Console.Clear();
                foreach (string item in Instructions.content)
                {
                    if (counter < Console.WindowHeight - 8)
                    {
                        Console.WriteLine(item);
                    }
                    else
                    {
                        counter = 0;
                        Console.WriteLine("Press ENTER to continue.");
                        Console.ReadLine();
                        System.Console.Clear();
                        Console.WriteLine(item);
                    }
                    counter += Convert.ToInt32(Math.Ceiling(Convert.ToDouble(item.Length) / Convert.ToDouble(Console.WindowWidth)));
                }
                Console.WriteLine("Press ENTER to continue.");
                Console.ReadLine();
            }
        }
示例#3
0
 public static void Trade(ref Player player, ref Vendor vendor)
 {
     if (player.treasures.Count < 1 && player.gold < 1000)
     {
         Console.WriteLine($"Sorry, {player.race}. You are too poor to trade.");
         SharedMethods.WaitForKey();
     }
     else
     {
         if (player.treasures.Count > 0)
         {
             List <string> treasuresSold = new List <string>();
             foreach (string item in player.treasures)
             {
                 offerAmount = rand.Next(1, 5001);
                 string question = $"Do you want to sell {item} for {offerAmount}";
                 Dictionary <char, string> choicesDict = new Dictionary <char, string>
                 {
                     { 'Y', "Yes" },
                     { 'N', "No" }
                 };
                 string[] choice = vtMenu.Menu(question, choicesDict, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages));
                 if (choice[0] == "Y")
                 {
                     Console.WriteLine($"\nYou have accepted the Vendor's offer for {item}.");
                     treasuresSold.Add(item);
                     vendor.treasures.Add(item);
                     player.gold += offerAmount;
                 }
             }
             foreach (string item in treasuresSold)
             {
                 player.treasures.Remove(item);
             }
             if (player.gold < 1000)
             {
                 Console.WriteLine($"\nSorry, {player.race}. You are too poor to trade.");
                 SharedMethods.WaitForKey();
             }
         }
         if ((player.gold > 1499) && (player.armor != "Plate"))
         {
             Player.GetPlayerArmor(ref player, new int[] { 1500, 2000, 2500 });
         }
         if ((player.gold > 1499) && (player.weapon != "Sword"))
         {
             Player.GetPlayerWeapon(ref player, new int[] { 1500, 2000, 2500 });
         }
         if ((player.gold > 999) && (!player.lamp))
         {
             Player.GetLamp(ref player, 1000);
         }
         if (player.gold > 999)
         {
             GetPlayerPotion(ref player, 1000);
         }
     }
 }
示例#4
0
 static string[] GetPlayerSex()
 {
     string[] choice = menu.Menu("Please choose your sex", new Dictionary <char, string>
     {
         { 'F', "FeMale" },
         { 'M', "Male" }
     }, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages));
     return(choice);
 }
示例#5
0
        static string[] GetPlayerRace()
        {
            Dictionary <char, string> choicesDict = new Dictionary <char, string>();

            for (int i = 0; i < GameCollections.Races.Count; i++)
            {
                choicesDict.Add(i.ToString()[0], GameCollections.Races[i].RaceName);
            }
            string[] choice = menu.Menu("Please choose your race", choicesDict, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages));
            return(choice);
        }
示例#6
0
 public static void GetLamp(ref Player player, int cost)
 {
     string[] choice = menu.Menu("Would you like to purchase a lamp", new Dictionary <char, string>
     {
         { 'Y', $"Purchase lamp ({cost} Gold Pieces)" },
         { 'N', "Don't purchase" }
     }, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages));
     if (choice[0] == "Y")
     {
         int numberOnly = Convert.ToInt32(Regex.Replace(choice[1], "[^0-9]", ""));
         player.gold -= numberOnly;
         player.lamp  = true;
     }
 }
示例#7
0
        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;
                }
            }
        }
示例#8
0
        public static string[,,] GetMap(YWMenu gameMenu)
        {
            bool randomMap = false;

            string[] choice = gameMenu.Menu("Would you like the standard 8x8x8 map or a random map", new Dictionary <char, string>
            {
                { 'S', "Standard 8x8x8 Map" },
                { 'R', "Random Map" }
            }, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages));
            System.Console.Clear();
            if (choice[0] == "R")
            {
                randomMap = true;
            }
            string[,,] theMap = Map.CreateMap(randomMap);
            theMap            = Map.PopulateMap(theMap);
            return(theMap);
        }
示例#9
0
        static void PlayerCast(ref Player player, ref Vendor vendor)
        {
            YWMenu battleMenu = new YWMenu();
            string question   = $"What spell do you want to cast";
            Dictionary <char, string> choicesDict = new Dictionary <char, string>
            {
                { 'W', "Web" },
                { 'F', "Fireball" },
                { 'D', "Deathspell" }
            };

            string[] choice = battleMenu.Menu(question, choicesDict, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages));
            switch (choice[0])
            {
            case "W":
                Console.WriteLine($"\nYou've caught the {vendor.race} in a web, now it can't attack");
                vendor.webbedTurns = rand.Next(1, 11);
                player.strength   -= 1;
                break;

            case "F":
                Console.WriteLine($"\nYou blast the {vendor.race} with a fireball.");
                vendor.strength     -= rand.Next(1, 11);
                player.intelligence -= 1;
                player.strength     -= 1;
                break;

            case "D":
                if ((player.intelligence > vendor.intelligence) && (rand.Next(1, 9) < 7))
                {
                    Console.WriteLine($"\nDEATH! The {vendor.race} is dead.");
                    vendor.strength = 0;
                }
                else
                {
                    Console.WriteLine($"\nDEATH! The STUPID {player.race}'s death.");
                    player.strength = 0;
                    SharedMethods.WaitForKey();
                }
                break;
            }
        }
示例#10
0
        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();
            }
        }
示例#11
0
        public static void GetPlayerPotion(ref Player player, int cost)
        {
            Console.WriteLine();
            Dictionary <char, string> choicesDict = new Dictionary <char, string>();

            for (int i = 0; i < GameCollections.Abilities.Count; i++)
            {
                choicesDict.Add(i.ToString()[0], $"{GameCollections.Abilities[i]}, {cost} Gold Pieces");
            }
            choicesDict.Add(choicesDict.Count.ToString()[0], $"None, 0 Gold Pieces");
            string[] choice;
            string   numberOnly;

            do
            {
                choice     = vtMenu.Menu($"You have {player.gold} Gold Pieces to buy items, what type of Potion do you want to purchase", choicesDict, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages));
                numberOnly = Regex.Replace(choice[1], "[^0-9]", "");
                if (!(Convert.ToInt32(numberOnly) > player.gold) && !(choice[1].Split(',')[0] == "None"))
                {
                    switch (choice[1].Split(',')[0])
                    {
                    case "Dexterity":
                        player.IncDexterity(rand.Next(1, 6));
                        Console.WriteLine($"\nDexterity={player.dexterity}");
                        SharedMethods.WaitForKey();
                        break;

                    case "Intelligence":
                        player.IncIntelligence(rand.Next(1, 6));
                        Console.WriteLine($"\nIntelligence={player.intelligence}");
                        SharedMethods.WaitForKey();
                        break;

                    case "Strength":
                        player.IncStrength(rand.Next(1, 6));
                        Console.WriteLine($"\nStrength={player.strength}");
                        SharedMethods.WaitForKey();
                        break;
                    }
                    player.gold -= Convert.ToInt32(numberOnly);
                }
                else
                {
                    if (!(choice[1].Split(',')[0] == "None"))
                    {
                        Console.WriteLine($"\n\tSorry, {player.race}, you don't have that much gold left.");
                    }
                }
            } while (player.gold > 999 && !(choice[1].Split(',')[0] == "None"));
        }
        static int Main()
        {
            // Set the WindowPosition, WindowHeight and WindowWidth
            Console.SetWindowPosition(0, 0);
            System.Console.WindowHeight = System.Console.LargestWindowHeight - 25;
            System.Console.WindowWidth  = System.Console.LargestWindowWidth - 50;
            Random rand     = new Random();
            YWMenu gameMenu = new YWMenu();

            ShowStartingMessage();
            Console.WriteLine("Press ENTER to continue.");
            Console.ReadLine();
            System.Console.Clear();
            Instructions.ViewInstructions();
            System.Console.Clear();
            dynamic dynamicTemp;

            string[,,] theMap   = Map.GetMap(gameMenu);
            string[,,] knownMap = theMap.Clone() as string[, , ];
            bool fallThrough;

            Map.BlankMap(knownMap);
            Player player = Player.CreatePlayer();

            //*** Testing *** int[] locationOfZot = Map.FindOrbOfZot(theMap);
            GameCollections.RuneStaffLocation = Map.FindMonster(theMap, GameCollections.Monsters[new Random().Next(0, GameCollections.Monsters.Count)]);
            Console.Clear();
            Console.WriteLine($"\tOk, {player.race}, you are now entering Zot's castle!\n");
            //*** Testing *** player.strength = 999;
            //*** Testing *** player.intelligence = 999;
            //*** Testing *** player.flares = 999;
            do
            {
                Console.Clear();
                dynamicTemp   = new string[] { "", "" };
                player.turns += 1;
                knownMap[player.location[0], player.location[1], player.location[2]] = theMap[player.location[0], player.location[1], player.location[2]];
                fallThrough = RoomEvents.GetRoomEvent(ref player, ref theMap);
                CheckCurses(ref player, ref knownMap);
                CheckIfDead(player, ref fallThrough);
                if (!fallThrough)
                {
                    if (rand.Next(0, 10) > 8)
                    {
                        Console.WriteLine($"\n{ManipulateListObjects.ReplaceRandomMonster(GameCollections.GameMessages)[rand.Next(0, GameCollections.GameMessages.Count)]}");
                    }
                    //*** Testing *** Console.WriteLine($"locationOfZot: {locationOfZot[0] + 1}, {locationOfZot[1] + 1}, {locationOfZot[2] + 1}");
                    //*** Testing *** Console.WriteLine($"RuneStaffLocation: {GameCollections.RuneStaffLocation[0] + 1}, {GameCollections.RuneStaffLocation[1] + 1}, {GameCollections.RuneStaffLocation[2] + 1}");
                    //*** Testing *** Console.WriteLine($"\nRace'{player.race}', player.sex='{player.sex}', player.dexterity='{player.dexterity}', player.intelligence='{player.intelligence}', player.strength='{player.strength}'\nplayer.armor='{player.armor}', player.weapon='{player.weapon}', player.gold='{player.gold}', player.flares='{player.flares}'\nplayer.blind='{player.blind}', player.bookStuck='{player.bookStuck}', player.forgetfulness='{player.forgetfulness}', player.leech='{player.leech}', player.lethargy='{player.lethargy}'\nplayer.lamp='{player.lamp}', player.orbOfZot='{player.orbOfZot}', player.runeStaff='{player.runeStaff}, player.turns='{player.turns}'\nplayer.treasures='{string.Join(", ", player.treasures)}'");
                    knownMap[player.location[0], player.location[1], player.location[2]] = theMap[player.location[0], player.location[1], player.location[2]];
                    string[] choice = gameMenu.Menu("Your action", GameCollections.availableActions, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages));
                    dynamicTemp = choice;
                    PlayerActions.Action(ref player, choice, ref knownMap, ref theMap);
                }
            } while (!(dynamicTemp[0] == "Q") && GameCollections.ExitCode == 999);

            Console.Clear();
            Console.WriteLine("\t\tThank you for playing Wizard's Castle!");
            ShowStartingMessage();
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("\n\nPress ENTER to Exit.");
            Console.ReadLine();
            return(0);
        }
        public static void Action(ref Player player, string[] action, ref string[,,] knownMap, ref string[,,] theMap)
        {
            YWMenu menu = new YWMenu();

            switch (action[0])
            {
            case "M":
                Map.DisplayLevel(knownMap, player);
                SharedMethods.WaitForKey();
                break;

            case "N":
                if (player.location[0] == 0 && player.location[1] == 0 && player.location[2] == 3)
                {
                    Program.PlayerExit(player);
                    break;
                }
                else
                {
                    player.North(knownMap);
                    break;
                }

            case "S":
                player.South(knownMap);
                break;

            case "E":
                player.East(knownMap);
                break;

            case "W":
                player.West(knownMap);
                break;

            case "F":
                if (player.flares > 0)
                {
                    if (!player.blind)
                    {
                        Map.RevealMap(player.location, theMap, ref knownMap);
                        player.flares -= 1;
                        Map.DisplayLevel(knownMap, player);
                    }
                    else
                    {
                        Console.WriteLine("Lighting a flare won't do you any good since you are BLIND!");
                    }
                }
                else
                {
                    Console.WriteLine("\n{0}\n", ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages)[new Random().Next(0, GameCollections.ErrorMesssages.Count)]);
                }
                SharedMethods.WaitForKey();
                break;

            case "T":
                string teleportTo;
                int[]  teleCoordinates = new int[3];
                if (player.runeStaff == true)
                {
                    do
                    {
                        Console.Clear();
                        Console.WriteLine();
                        Console.Write("\rTeleport where (Example: For Level 3, Row 5, Column 2 type: 3,5,2): ");
                        teleportTo = Console.ReadLine();
                        teleportTo = teleportTo.Replace(" ", "");
                        try
                        {
                            teleCoordinates = Array.ConvertAll(teleportTo.Split(','), int.Parse);
                            if (teleCoordinates[0] - 1 < theMap.GetLength(0) && teleCoordinates[1] - 1 < theMap.GetLength(1) && teleCoordinates[2] - 1 < theMap.GetLength(2))
                            {
                                player.location[0] = teleCoordinates[0] - 1;
                                player.location[1] = teleCoordinates[1] - 1;
                                player.location[2] = teleCoordinates[2] - 1;
                            }
                            else
                            {
                                teleportTo = "";
                                Console.WriteLine("* Invalid * Coordinates");
                                SharedMethods.WaitForKey();
                            }
                        }
                        catch (Exception)
                        {
                            teleportTo = "";
                            Console.WriteLine("* Invalid * Coordinates");
                            SharedMethods.WaitForKey();
                        }
                    } while (teleportTo.Length < 1);
                    Console.WriteLine($"\n\tTeleporting to: ({teleCoordinates[0]}, {teleCoordinates[1]}, {teleCoordinates[2]})");
                    for (int i = 0; i < 30; i++)
                    {
                        Console.Write(".");
                        Thread.Sleep(100);
                    }
                }
                else
                {
                    Console.WriteLine($"\nSorry, {player.race}, but you need the RuneStaff to teleport!\n");
                    SharedMethods.WaitForKey();
                }
                break;

            case "L":
                if (player.lamp == true)
                {
                    if (!player.blind)
                    {
                        string[] choice = menu.Menu("Shine lamp which direction", new Dictionary <char, string>
                        {
                            { 'N', "North" },
                            { 'S', "South" },
                            { 'E', "East" },
                            { 'W', "West" }
                        }, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages));
                        Map.RevealRoom(choice[1], player.location, theMap, ref knownMap);
                        Map.DisplayLevel(knownMap, player);
                    }
                    else
                    {
                        Console.WriteLine($"You're BLIND and can't see anything, silly {player.race}.");
                        SharedMethods.WaitForKey();
                    }
                }
                else
                {
                    Console.WriteLine("\n{0}\n", ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages)[new Random().Next(0, GameCollections.ErrorMesssages.Count)]);
                }
                SharedMethods.WaitForKey();
                break;

            case "D":
                if (knownMap[player.location[0], player.location[1], player.location[2]] == "DownStairs")
                {
                    player.Down();
                }
                else
                {
                    Console.WriteLine("\n{0}\n", ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages)[new Random().Next(0, GameCollections.ErrorMesssages.Count)]);
                    SharedMethods.WaitForKey();
                }
                break;

            case "U":
                if (knownMap[player.location[0], player.location[1], player.location[2]] == "UpStairs")
                {
                    player.Up();
                }
                else
                {
                    Console.WriteLine("\n{0}\n", ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages)[new Random().Next(0, GameCollections.ErrorMesssages.Count)]);
                    SharedMethods.WaitForKey();
                }
                break;

            case "G":
                if (knownMap[player.location[0], player.location[1], player.location[2]] == "Orb")
                {
                    if (!player.blind)
                    {
                        Console.WriteLine(Orb.OrbEvent(ref player, ref theMap));
                    }
                    else
                    {
                        Console.WriteLine("The only thing you see is darkness because you are blind");
                    }
                    SharedMethods.WaitForKey();
                }
                else
                {
                    Console.WriteLine("\n{0}\n", ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages)[new Random().Next(0, GameCollections.ErrorMesssages.Count)]);
                    SharedMethods.WaitForKey();
                }
                break;

            case "O":
                if (knownMap[player.location[0], player.location[1], player.location[2]] == "Book")
                {
                    if (!player.blind)
                    {
                        Console.WriteLine(Book.BookEvent(ref player, ref theMap));
                    }
                    else
                    {
                        Console.WriteLine($"Sorry, {player.race}, it's not written in Braille!");
                    }
                    SharedMethods.WaitForKey();
                }
                else if (knownMap[player.location[0], player.location[1], player.location[2]] == "Chest")
                {
                    Console.WriteLine(Chest.ChestEvent(ref player, ref theMap, ref knownMap));
                    SharedMethods.WaitForKey();
                }
                else
                {
                    Console.WriteLine("\n{0}\n", ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages)[new Random().Next(0, GameCollections.ErrorMesssages.Count)]);
                    SharedMethods.WaitForKey();
                }
                break;

            case "P":
                if (knownMap[player.location[0], player.location[1], player.location[2]] == "Pool")
                {
                    Console.WriteLine(Pool.PoolEvent(ref player));
                    SharedMethods.WaitForKey();
                }
                else
                {
                    Console.WriteLine("\n{0}\n", ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages)[new Random().Next(0, GameCollections.ErrorMesssages.Count)]);
                }
                break;

            case "Z":
                if (knownMap[player.location[0], player.location[1], player.location[2]] == "Vendor")
                {
                    Vendor vendor = Vendor.GetOrCreateVendor(theMap, player, string.Join(string.Empty, new[] { player.location[0], player.location[1], player.location[2] }));
                    VendorTrade.Trade(ref player, ref vendor);
                }
                else
                {
                    Console.WriteLine($"\nSorry, {player.race}, there's no vendor in the room.");
                    SharedMethods.WaitForKey();
                }
                break;

            case "A":
                if (knownMap[player.location[0], player.location[1], player.location[2]] == "Vendor")
                {
                    Vendor vendor = Vendor.GetOrCreateVendor(theMap, player, string.Join(string.Empty, new[] { player.location[0], player.location[1], player.location[2] }));
                    GameCollections.AllVendorMad = true;
                    vendor.mad = true;
                    Console.WriteLine($"\n{Vendor.VendorMadMessage(vendor)}\n");
                    BattleVendor.BattleSequence(ref player, ref vendor, theMap);
                    if (vendor.strength < 1)
                    {
                        theMap[player.location[0], player.location[1], player.location[2]] = "-";
                        SharedMethods.WaitForKey();
                    }
                }
                else if (GameCollections.Monsters.Contains(theMap[player.location[0], player.location[1], player.location[2]]))
                {
                    Monster monster = Monster.GetOrCreateMonster(theMap, player, string.Join(string.Empty, new[] { player.location[0], player.location[1], player.location[2] }));
                    monster.mad = true;
                    Console.WriteLine($"\n{Monster.MonsterMadMessage(monster)}\n");
                    Battle.BattleSequence(ref player, ref monster, theMap);
                    if (monster.strength < 1)
                    {
                        theMap[player.location[0], player.location[1], player.location[2]] = "-";
                    }
                    SharedMethods.WaitForKey();
                }
                else
                {
                    Console.WriteLine("\n{0}\n", ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages)[new Random().Next(0, GameCollections.ErrorMesssages.Count)]);
                    SharedMethods.WaitForKey();
                }
                break;

            case "V":
                Instructions.ViewInstructions();
                break;

            case "Q":
                break;

            default:
                Console.WriteLine("\n{0}\n", ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages)[new Random().Next(0, GameCollections.ErrorMesssages.Count)]);
                SharedMethods.WaitForKey();
                break;
            }
        }
示例#14
0
        public static void GetPlayerWeapon(ref Player player, int[] costs)
        {
            Console.WriteLine();
            Dictionary <char, string> choicesDict = new Dictionary <char, string>();

            for (int i = 0; i < GameCollections.Weapons.Count; i++)
            {
                choicesDict.Add(i.ToString()[0], $"{GameCollections.Weapons[i]}, {costs[i]} Gold Pieces");
            }
            choicesDict.Add(choicesDict.Count.ToString()[0], $"None, 0 Gold Pieces");
            string[] choice     = menu.Menu($"You have {player.gold} Gold Pieces to buy items, what type of Weapon do you want to purchase", choicesDict, ManipulateListObjects.ReplaceRandomMonster(GameCollections.ErrorMesssages));
            string   numberOnly = Regex.Replace(choice[1], "[^0-9]", "");

            if (!(Convert.ToInt32(numberOnly) > player.gold) && !(choice[1].Split(',')[0] == "None"))
            {
                player.weapon = choice[1].Split(',')[0];
                player.gold  -= Convert.ToInt32(numberOnly);
            }
            else
            {
                if (!(choice[1].Split(',')[0] == "None"))
                {
                    Console.WriteLine($"\n\tSorry, {player.race}, you don't have that much gold left.");
                }
            }
        }