static public void InsertBatteriesInToFlashlight()
        {
            List <string> accessible = Prompt.AccessibleItems();
            Item          flashlight = Item.byName["flashlight"];
            Item          batteries  = Item.byName["flashlightbatteries"];

            if (!Player.inventory.Contains("flashlightbatteries"))
            {
                Console.WriteLine("You aren't carrying any batteries");
            }
            else if ((!accessible.Contains("flashlight")))
            {
                Console.WriteLine("There is no flashlight");
            }
            else if (!flashlight.isOpen)
            {
                Console.WriteLine("Your flashlight is closed.");
            }
            else
            {
                Console.WriteLine("You place the batteries inside the flashlight");
                flashlight.itemsInside.Add("flashlightbatteries");
                Player.inventory.Remove("flashlightbatteries");
                Player.carryCapacity += batteries.size;
            }
        }
Example #2
0
 static public void Parse(List <string> twoWord)
 {
     Console.WriteLine("");
     if (validTwoWordCommands.Contains(twoWord[0]))
     {
         List <string> accessible = Prompt.AccessibleItems();
         if (!accessible.Contains(twoWord[1]))
         {
             Console.WriteLine($"No such item available.");
         }
         else
         {
             Item item = Item.byName[twoWord[1]];
             if (twoWord[0] == "examine")
             {
                 Examine(ref item);
             }
             if (twoWord[0] == "take")
             {
                 Take.Act(ref item);
             }
             if (twoWord[0] == "open")
             {
                 Access.Open(ref item);
             }
             if (twoWord[0] == "drop")
             {
                 Take.Drop(ref item);
             }
             if (new string[] { "turnon", "play" }.Contains(twoWord[0]))
             {
                 Access.TurnOn(ref item);
             }
             if (new string[] { "turnoff", "blowout" }.Contains(twoWord[0]))
             {
                 Access.TurnOff(ref item);
             }
             if (new string[] { "unlock" }.Contains(twoWord[0]))
             {
                 Access.Unlock(ref item);
             }
             if (new string[] { "eat", "drink" }.Contains(twoWord[0]))
             {
                 Take.Eat(ref item);
             }
             if (new string[] { "close" }.Contains(twoWord[0]))
             {
                 Access.Close(ref item);
             }
         }
     }
     else if (MultiWordCommands.validMultiWordCommands.Contains(twoWord[0]))
     {
         MultiWordCommands.Parse(twoWord);
     }
     else
     {
         Console.WriteLine("Invalid Command");
     }
 }
        static public void InsertBatteriesInToTapeDeck()
        {
            List <string> accessible = Prompt.AccessibleItems();
            Item          tapedeck   = Item.byName["tapedeck"];
            Item          batteries  = Item.byName["flashlightbatteries"];

            if (!Player.inventory.Contains("flashlightbatteries"))
            {
                Console.WriteLine("You aren't carrying any batteries");
            }
            else if (!accessible.Contains("tapedeck"))
            {
                Console.WriteLine("There is no tape deck");
            }
            else if (!tapedeck.isOpen)
            {
                Console.WriteLine("The tape deck is closed.");
            }
            else
            {
                Console.WriteLine("You place the batteries inside the tape deck.");
                tapedeck.itemsInside.Add("flashlightbatteries");
                Location.CurrentRoom.obviousItems.Add("flashlightbatteries");
                Player.inventory.Remove("flashlightbatteries");
                Player.carryCapacity += batteries.size;
            }
        }
 public static void Access()
 {
     foreach (string s in Prompt.AccessibleItems())
     {
         Console.WriteLine(s);
     }
 }