示例#1
0
文件: Program.cs 项目: RoyWemmers/tba
        // This Method builds the menu
        static int ShowMenu(Map map, ref List <string> menu, ref Player player, ref BloodDrake drake, ref AngryMan angryman)
        {
            int    choice;
            string input;

            menu.Clear();
            ShowDirections(map, ref menu);

            if (map.GetLocation().CheckForItems())
            {
                bool acquirableitems = false;
                Dictionary <string, Objects> list = map.GetLocation().GetItems();
                Objects[] obj = list.Values.ToArray();
                for (int i = 0; i < obj.Count(); i++)
                {
                    if (obj[i].GetAcquirable())
                    {
                        acquirableitems = true;
                    }
                }
                if (acquirableitems)
                {
                    menu.Add(ACTION_SEARCH);
                }
            }
            if ((map.GetYPosition() == 5 && map.GetXPosition() == 1) && drake.IsAlive(drake.GetHealth()))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("On one of the pillars of the bridge is a smalle Blood Drake…");
                Console.WriteLine("The Blood Drake growls at you…");
                Console.WriteLine("It isn’t going to let you pass the bridge…");
                Console.WriteLine();
                Console.ForegroundColor = ConsoleColor.Gray;

                menu.Add("Fight the Blood Drake");
                menu.Add("Go via the side of the bridge");
            }

            if ((map.GetYPosition() == 3 && map.GetXPosition() == 2) && angryman.IsAlive(angryman.GetHealth()))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("When you knock on the door you hear heavy footsteps walking towards the door");
                Console.WriteLine("An angry man opens the door, and screams:");
                Console.WriteLine("If you don't stop bothering me I will kick your teeth in!");
                Console.WriteLine("As you look inside the house you can see a bag of gold.");
                Console.WriteLine("Do you want to fight the man, and take his gold, or will you leave the man.");
                Console.WriteLine();
                Console.ForegroundColor = ConsoleColor.Gray;

                menu.Add("Fight the man");
            }

            if (map.GetYPosition() == 7 && map.GetXPosition() == 1)
            {
                menu.Add("Climb over the wall");
                menu.Remove("Go North");
            }

            if (map.GetYPosition() == 9 && map.GetXPosition() == 1)
            {
                menu.Add("Fight the Boss");
            }

            menu.Add(ACTION_QUIT);
            menu.Add(ACTION_SHOP);
            menu.Add(ACTION_SHOWINVENTORY);

            if (player.HasObject("Health Potion"))
            {
                menu.Add(ACTION_USEHEALTHPOTION);
            }

            do
            {
                for (int i = 0; i < menu.Count(); i++)
                {
                    Console.WriteLine("{0} - {1}", i + 1, menu[i]);
                }
                Console.WriteLine("Please enter your choice: 1 - {0}", menu.Count());
                HealthUI(player.GetName(), player.GetHealth(), player.GetMaxHealth(), player.GetStamina(), player.GetMaxStamina(), player.GetGold());
                input = Console.ReadLine();
                Console.Clear();
                map.GetLocation().Description();
            } while (!int.TryParse(input, out choice) || (choice > menu.Count() || choice < 0));

            //return choice;
            return(choice - 1);
        }
示例#2
0
        static void Welcome(ref Player player)
        {
            Console.Clear();
            Console.WriteLine("Welcome to the world of Flightwood");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("----------------------------------");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Around half a year ago someone obtained a certain power that brought darkness upon this land.");
            Console.WriteLine("Once he infected someone with these powers it strengthened their worst traits,");
            Console.WriteLine("causing most of them to cause death and destruction everywhere they go.");
            Console.WriteLine("They have grouped up and are working together to infect as many people as possible.");
            Console.WriteLine("If this continues, the whole world will come to an end.");
            Console.WriteLine();
            Console.WriteLine("But there is a group of knights that stayed strong in these times of darkness,");
            Console.WriteLine("that are protecting the vulnerable citizens against the darkness of this infection: The Ravens.");
            Console.WriteLine("And you decided to join them!");
            Console.WriteLine();
            Console.WriteLine("After a long travel you see it, the legendary Raven base.");
            Console.WriteLine("You are standing in front of the gates of the big castle that you’ve heard so much stories of.");
            Console.WriteLine();
            Console.WriteLine("You’re about to be one of the Ravens.");
            Console.ReadLine();
            Console.Clear();

            Console.WriteLine("Slowly the tall gates open up in front of you, and you enter the entrance hall of the Raven base.");
            Console.WriteLine("The hall is gigantic, and everything looks very neat. You stand there in silence, waiting for something to happen.");
            Console.WriteLine();
            Console.WriteLine("A few minutes later you heard footsteps coming closer,");
            Console.WriteLine("the person walked towards you from the end of the hall, revealing himself as he walked up to you.");
            Console.WriteLine("The man was wearing shining armor with the logo of the Ravens printed on top of the chestplate,");
            Console.WriteLine("as well as on the cape that flows behind him.");
            Console.WriteLine("His piercing gaze looking right through you as he stuck out his hand waiting for you to shake it.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("“You are the new recruit, aren’t you? I am Avalon, and I will be your commander.");
            Console.WriteLine("It is nice to meet you {0}.”", player.GetName());
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine();
            Console.WriteLine("Both of you started to slowly walk to the big doors at the end of the halls as the conversation continued.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("”As you know, you’re here to fight against the people who got infected.”");
            Console.WriteLine("As of now most of them have gathered in the abandoned town were the source is, they’re protecting it.");
            Console.WriteLine("And we are trying to infiltrate into the town.");
            Console.WriteLine("We are hoping that when the source is destroyed the infection will disappear, and everyone will be saved.”");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Your new commander explained.");
            Console.WriteLine("As you walked through the door you got into a smaller hall that had a lot of doors going to the dorms of the knights.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("“It is late, you should rest and prepare yourself for tomorrow. This is your room.”");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Avalon pointed to one of the doors and then left.");
            Console.ReadLine();
            Console.Clear();

            Console.WriteLine("You entered your room.");
            Console.WriteLine();
            Console.WriteLine("Not much later you fell asleep.");
            Console.ReadLine();
            Console.Clear();

            Console.WriteLine("The next day you woke up from the sound of multiple footsteps marching in the halls outside of your door.");
            Console.WriteLine();
            Console.WriteLine("You put on the typical Raven armor that was neatly put in your room before quickly exiting through the door.");
            Console.ReadLine();
            Console.Clear();

            Console.WriteLine("Outside commander Avalon was waiting for you, ready to explain to you what you are going to do.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("“Alright {0}. In the mornings you will gather with your division,", player.GetName());
            Console.WriteLine("have a quick breakfast and then go out on your assigned mission. Your division is division 8");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Avalon called one of the knights that was walking past them in the hall. The knight was already wearing his helmet,");
            Console.WriteLine("seeming like he has already prepared for whatever he is assigned to do today.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("“Ah Lewis, this is the newest member of your division, {0}. Will you show {0} how everything works?”", player.GetName());
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Avalon introduced you to the knight before rushing off to continue with more important business.");
            Console.WriteLine();
            Console.WriteLine("The man called Lewis then turned to you.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("“It’s nice to meet you. Our division has to go on a mission today,");
            Console.WriteLine("so this is a great opportunity to get introduced with the job.”");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("He then took you to the room where the rest of division 8 was having breakfast,");
            Console.WriteLine("and he explained what we were going to do today.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("“Our Division is assigned to go to a church not far from here, we heard from an anonymous source");
            Console.WriteLine("that there is some sort of artifact there that will be essential to defeating our enemies.”");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine();
            Console.WriteLine("After everything got explained the Division left the Raven base, up to the church.");
            Console.WriteLine("You were told that you needed to head south to find the church.");
            Console.ReadLine();
            Console.Clear();
            Console.WriteLine("There are some tough enemies up ahead.");
            Console.WriteLine("Maybe it is a smart idea for you to train a bit before attempting to fight the strongest");
            Console.WriteLine("enemy in this world!");
            Console.ReadLine();
            Console.Clear();

            player.ShowInventory();

            Console.WriteLine("Press a key to continue..");
            Console.ReadKey();
        }