Example #1
0
        public override string Execute(Player p, string[] text)
        {
            Command c;

            switch (text[0].ToLower())
            {
            case "look":
                c = new Look();
                break;

            case "stare":
                c = new Look();
                break;

            case "inspect":
                c = new Look();
                break;

            case "examine":
                c = new Look();
                break;

            case "eye":
                c = new Look();
                break;

            case "move":
                c = new Move();
                break;

            case "head":
                c = new Move();
                break;

            case "go":
                c = new Move();
                break;

            case "leave":
                c = new Move();
                break;

            case "take":
                c = new Take();
                break;

            default:
                c = new Look();
                break;
            }

            return(c.Execute(p, text));
        }
Example #2
0
        static void Main(string[] args)
        {
            string _input;

            Console.WriteLine();

            Console.Write("Welcome to ");
            ColoredConsoleWrite(ConsoleColor.Red, "Nightmaher");
            Console.WriteLine(".");

            Console.WriteLine();
            ColoredConsoleWrite(ConsoleColor.DarkGray, "   yes, there are a lot of obscure references.");
            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("This is version 0.5.1 'Nightmare-themed Maze. Happy. Hapy.' | Iteration 6 in Progress. ");
            Console.WriteLine();
            Console.WriteLine("What is your name?");
            string name = Console.ReadLine();

            Console.WriteLine("How would you describe yourself? (e.g. 'A mighty programmer')");
            string description = Console.ReadLine() + "!";

            Console.WriteLine();
            Console.WriteLine(name + ", " + description + " It is time to leave the lecture and fall into the world of nightmares.");
            Console.WriteLine();

            Player player = new Player(name, description);

            Bag bag = new Bag(new string[] { "small", "cloth", "bag" }, "bag", "A small cloth bag endorned with a 6-petal star atop a circle.");

            Item redPot    = new Item(new string[] { "potion" }, "red", "A bitter-smelling red potion.");
            Item Gem       = new Item(new string[] { "gem" }, "phosphophyllite", "An emerald-green gem of about three-and-a-half hardness. Pretty.");
            Item woodblade = new Item(new string[] { "blade" }, "wooden", "A mighty-fine wooden training sword. Beware of termites.");
            Item teaTable  = new Item(new string[] { "table" }, "tea", "A tea table lined with an odd antique tablecloth with seemingly infinite supplies of tea and sweets. " +
                                      "Four chairs surround the table at each edge. Centre-table is a vase of more blood-red roses, the sight of which seems mesmerising. ");
            Location teaRoom = new Location("Fancy Tea Room", "You're in a fancy room decorated with odd colours of an antique design. Definitely not to your liking. " +
                                            "There are sweets and tea on the table of seemingly infinite supply; a large door overtaken by roses dominates the wall to your right. " +
                                            "\r\nA dizzying sweet scent starts to fills the room, your gut tells you it's a bad omen. After all, the scent is coming from the blood-red roses. ");

            teaRoom.Inventory.Put(teaTable);

            player.Location = teaRoom;

            player.Inventory.Put(redPot);
            player.Inventory.Put(Gem);
            player.Inventory.Put(bag);
            bag.Inventory.Put(woodblade);

            Command l = new Look();

            Console.ForegroundColor = ConsoleColor.DarkGray;

            while (true)
            {
                Console.Write("Command--> ");

                ConsoleColor originalColor = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.Gray;


                _input = Console.ReadLine();

                Console.ForegroundColor = originalColor;

                Console.WriteLine();
                ColoredConsoleWrite(ConsoleColor.Cyan, (l.Execute(player, _input.Split())));
                Console.WriteLine();
                Console.WriteLine();
            }
        }