Exemplo n.º 1
0
        static void Main(string[] args)
        {
            int  counter = 0;
            bool Playing = false;

            Player.Instance.Move(8, 3);
            Player.Attributes.Name = "Vendredi";
            var worldRenderer = new WorldRenderer();
            var util          = new RPGUtilities();

            util.HelpMenu();
            Console.WriteLine("Get started by entering a command.");
            Console.WriteLine("Try the [look] command. You are the @ symbol in the map.");
            while (!(Playing))
            {
                worldRenderer.SetStrategy(new BasicRenderStrategy(), 1);
                Player.Instance.RequestCommand(worldRenderer);
                counter++;
                if (counter == 1000)
                {
                    Playing = true;
                }
            }

            //ConsoleWriter cw = new ConsoleWriter();
            //var worldRenderer = new WorldRenderer();
            //Player.Attributes.Name = "Bob";

            //Console.WriteLine("Render Mode: Basic");
            //worldRenderer.SetStrategy(new BasicRenderStrategy());
            //worldRenderer.Render();

            //Console.WriteLine();

            //Console.WriteLine("Render Mode: Dark");
            //worldRenderer.SetStrategy(new DemonRenderStrategy());
            //worldRenderer.Render();
            //Console.WriteLine("An ASCII Fantasy Map via "); cw.WriteMessage("Multi-Dimensional Matrix", ConsoleColor.Red);
            //Console.WriteLine("");
            //Player.Attributes.Name = "2";
            //Console.WriteLine(Player.Attributes.Name + " = exp");
            //Console.WriteLine(Player.Instance.add_Experience(2) + " = exp");
            Console.ReadLine();
        }
Exemplo n.º 2
0
        public void RequestCommand(WorldRenderer worldRenderer)
        {
            var           cw   = new ConsoleWriter();
            var           util = new RPGUtilities();
            string        command;
            List <string> splitCommand;

            while (String.IsNullOrEmpty(command = Console.ReadLine()) || util.Split(command).Count() > 2)
            {
                Console.Clear();
                cw.WriteMessage("Invalid input ignored; please enter a valid command.\n", ConsoleColor.Red);
            }
            command = command.ToLower();
            int spaces = command.Count(Char.IsWhiteSpace);

            if (spaces == 0)
            {
                int option = util.ExecuteCommand(command);
                if (option == 0)
                {
                    cw.WriteMessage("\nNo such command detected\n", ConsoleColor.Red);
                    return;
                }
                if (option <= 4)
                {
                    Advance(option);
                }
                else if (option == 5)
                {
                    cw.WriteMessage("\n You take a good look around.\n", ConsoleColor.White);
                    Thread.Sleep(1500);
                    if (worldRenderer.GetStrategy() == 1)
                    {
                        worldRenderer.SetStrategy(new BasicRenderStrategy(), 1);
                    }
                    else
                    {
                        worldRenderer.SetStrategy(new DemonRenderStrategy(), 2);
                    }
                    worldRenderer.Render(Get_Position()[0], Get_Position()[1]);
                }
                else if (option == 6)
                {
                    cw.WriteMessage("\n You seek the gods for guidance.\n", ConsoleColor.White);
                    Thread.Sleep(1500);
                    util.HelpMenu();
                }
                else if (option == 11)
                {
                    if (worldRenderer.GetStrategy() == 1)
                    {
                        cw.WriteMessage("\n You take the form of a demon; you may now fly over terrain. \n", ConsoleColor.White);
                        Thread.Sleep(1500);
                        worldRenderer.SetStrategy(new DemonRenderStrategy(), 2);
                        Player.Attributes.Mana -= 10;
                    }
                    else
                    {
                        cw.WriteMessage("\n You return to your human form. \n", ConsoleColor.White);
                        Thread.Sleep(1500);
                        worldRenderer.SetStrategy(new BasicRenderStrategy(), 1);
                    }
                    worldRenderer.Render(Get_Position()[0], Get_Position()[1]);
                }
                else if (option == 12)
                {
                    cw.WriteMessage("\n You reflect on your current condition.\n", ConsoleColor.White);
                    Thread.Sleep(1500);
                    var pa = new PlayerAdapter(Player.instance);
                    pa.GetScore();
                }
            }
        }