예제 #1
0
        public void UseItem(string itemName)
        {
            Console.Clear();
            Item TestItem = CurrentPlayer.HasItem(itemName);

            if (TestItem != null)
            {
                if (itemName == "torch" && CurrentRoom.Name == "dark room")
                {
                    CurrentRoom.AddDirection("north", room3);
                    CurrentRoom.AddDirection("east", room4);
                    CurrentRoom.Description = "It appears to be a hallway with one side door and a door opposite the way you came.  Strange Colorfull yet indecipherable imagery adorn the walls.";
                    Console.WriteLine("The room blazes with light.  You can finally see!  ");
                    return;
                }
                else if (itemName == "torch" && CurrentRoom.Name == "party room")
                {
                    Console.WriteLine("The room is now LIT! Goblins pour from unseen cracks and paths, loud banging and rhythems start from the strange Boxes. They all start start raving you get crushed to death...");
                    SetPlaying(false);
                    return;
                }
                else if (itemName == "torch" && CurrentRoom.Name == "goblin room")
                {
                    Console.WriteLine("You solve the goblin's Riddle by shoving a burning torch right up his nose! the gobin screeches you see a new path open.");
                    CurrentRoom.AddDirection("east", room5);
                    CurrentRoom.Description = "A burning Goblin in the corner and the Exit to the east.";
                    return;
                }
                else if (itemName == "torch")
                {
                    return;
                }
            }
            else
            {
                System.Console.WriteLine($"You don't Have {itemName}");
            }
        }