Exemplo n.º 1
0
        public void Go(string direction)
        {
            if (CurrentRoom.Name == "RoomB")
            {
                Console.WriteLine("As you walk through the door, you're met with humungous Demon.  What do you do?");
            }
            if (CurrentRoom.UnlockedStatus == false)
            {
                Console.WriteLine("You push on the door.  Locked.");
            }
            if (CurrentRoom.Name == "RoomA" && direction == "go back")
            {
                Console.WriteLine("Can't go that way");
            }
            if (CurrentRoom.Name == "RoomD" && direction == "go forward")
            {
                Console.WriteLine("Can't go that way");
            }

            else
            {
                CurrentRoom = (Room)CurrentRoom.Go(direction);
                // Console.Clear();
                Console.WriteLine(CurrentRoom.Description);
            }
        }
Exemplo n.º 2
0
        public void Go(string direction)
        {
            Console.Clear();
            Room dest = (Room)CurrentRoom.Go(direction);

            CurrentRoom = dest;
            CurrentRoom.Print();
        }
Exemplo n.º 3
0
 public void Go(string direction)
 {
     Console.Clear();
     Room destination = (Room)CurrentRoom.Go(direction);
     // if (CurrentRoom.Name == "tower" && direction == "down")
     // {
     //   CurrentRoom.TowerDrop();
     // }
     // else
     {
         CurrentRoom = destination;
         CurrentRoom.Print();
     }
 }
Exemplo n.º 4
0
        public void UseButton(string itemName)
        {
            Item temp = CurrentPlayer.Inventory.Find(x => x.Name.Contains("fire bomb"));

            if (itemName == "button" && temp != null)
            {
                Console.WriteLine("You Die");
                Playing = false;
            }
            else
            {
                CurrentRoom = CurrentRoom.Go("button");
                System.Console.WriteLine(CurrentRoom.Name);
            }
        }
Exemplo n.º 5
0
        //TODO FIXED!!! This is where you left off
        public void Go(string direction)
        {
            if (CurrentRoom.Location == "Kitchen Drawers" && direction == "north" && CurrentPlayer.Inventory.Count == 0)
            {
                Console.Write("Ooof. You didn't have the proper tools to fight your way to the pantry...");
                string defeat = @" You have died.";
                foreach (char letter in defeat)
                {
                    Console.Write(letter);
                    Thread.Sleep(150);
                }
                Thread.Sleep(5000);
                Console.WriteLine("");
                Quit();
            }
            else if (CurrentRoom.IsLocked == true)
            {
                Console.WriteLine("You need to use an item before you can continue on.");
            }
            else
            {
                CurrentRoom = CurrentRoom.Go(direction);
            }


            // Item item = CurrentRoom.Items.Find(i => i.Name.ToLower() == itemName.ToLower());
            // if (CurrentRoom.Name == "Desolate Kitchen Plains" && CurrentPlayer.Inventory.Contains(Food))
            // {
            //   Console.WriteLine("You have died of starvation... Better luck next time!");
            //   Thread.Sleep(6000);
            //   Reset();
            // }
            // else if (CurrentRoom.Name == "Microwave" && CurrentPlayer.Inventory.!Contains(Food))
            // {
            //   Console.WriteLine("You do not have the qualified equipment to move on. It would be too dangerous to go back. You are stranded... Better luck next time!");
            //   Thread.Sleep(6000);
            //   Reset();
            // }
            // else
            // {
            // }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initiates movememnt from one room to another, if possible.
        /// </summary>
        /// <param name="direction"></param>
        public static void TryGoing(string direction)
        {
            // TODO: implement Monster/CanLeave stuff
            // TODO: push monster check into RoomBase???
            var monster = CurrentRoom.getMonster();

            if (monster == null || monster.isDead())
            {
                RoomId roomId = CurrentRoom.Go(direction);
                if (roomId > RoomId.NoRoom)
                {
                    MoveToRoom(roomId);
                }
                else
                {
                    switch (roomId)
                    {
                    case RoomId.EndGame:
                        IO.OutputNewLine(EndGame(true));
                        break;

                    case RoomId.NoRoom:
                        IO.OutputNewLine(GameStrings.GoInvalidDirection);
                        break;

                    case RoomId.RoomIsLocked:
                        IO.OutputNewLine(GameStrings.DoorIsLocked);
                        break;
                    }
                }
            }
            else
            {
                IO.OutputNewLine($"The {monster.name} blocks your path." +
                                 $"\nYou cannot leave while the {monster.name} is alive.");
            }
        }
Exemplo n.º 7
0
 public void Go(string direction)
 {
     CurrentRoom = CurrentRoom.Go(direction);
 }
Exemplo n.º 8
0
        public void Play()
        {
            Setup();

            // playing = true;
            while (playing)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                System.Console.Write("What would you like to do? ");
                Console.ForegroundColor = ConsoleColor.White;
                string   userInput = Console.ReadLine();
                string[] input     = userInput.ToLower().Split(" ");
                Console.ForegroundColor = ConsoleColor.Blue;
                switch (input[0])
                {
                case "go":
                    if (input.Length == 1)
                    {
                        Console.Clear();
                        System.Console.WriteLine("You must enter a direction alongside the 'go' command");
                    }
                    else
                    {
                        if (input[1] == "n")
                        {
                            var validRoom = CurrentRoom.Go(input[1]);
                            if (validRoom != null)
                            {
                                CurrentRoom = CurrentRoom.Go(input[1]);
                                Console.Clear();
                                System.Console.WriteLine($"You are now in the {CurrentRoom.Name}. {CurrentRoom.Description}");
                            }
                            else
                            {
                                Console.Clear();
                                System.Console.WriteLine("That is not a valid direction from this room.");
                                System.Console.WriteLine($"You are currently in the {CurrentRoom.Name}: {CurrentRoom.Description}");
                            }
                        }
                        if (input[1] == "e")
                        {
                            var validRoom = CurrentRoom.Go(input[1]);
                            if (validRoom != null)
                            {
                                CurrentRoom = CurrentRoom.Go(input[1]);
                                Console.Clear();
                                System.Console.WriteLine($"You are now in the {CurrentRoom.Name}. {CurrentRoom.Description}");
                            }
                            else
                            {
                                Console.Clear();
                                System.Console.WriteLine("That is not a valid direction from this room.");
                                System.Console.WriteLine($"You are currently in the {CurrentRoom.Name}: {CurrentRoom.Description}.");
                            }
                        }
                        if (input[1] == "s")
                        {
                            var validRoom = CurrentRoom.Go(input[1]);
                            if (validRoom != null)
                            {
                                CurrentRoom = CurrentRoom.Go(input[1]);
                                Console.Clear();
                                System.Console.WriteLine($"You are now in the {CurrentRoom.Name}. {CurrentRoom.Description}");
                            }
                            else
                            {
                                Console.Clear();
                                System.Console.WriteLine("That is not a valid direction from this room.");
                                System.Console.WriteLine($"You are currently in the {CurrentRoom.Name}: {CurrentRoom.Description}");
                            }
                        }
                        if (input[1] == "w")
                        {
                            var validRoom = CurrentRoom.Go(input[1]);
                            if (validRoom != null)
                            {
                                CurrentRoom = CurrentRoom.Go(input[1]);
                                Console.Clear();
                                System.Console.WriteLine($"You are now in the {CurrentRoom.Name}. {CurrentRoom.Description}");
                            }
                            else
                            {
                                Console.Clear();
                                System.Console.WriteLine("That is not a valid direction from this room.");
                                System.Console.WriteLine($"You are currently in the {CurrentRoom.Name}: {CurrentRoom.Description}");
                            }
                        }
                        // else
                        // {
                        //     System.Console.WriteLine("That is not a valid direction. Possible directions are n e s w.");
                        // }
                    }
                    break;

                case "look":
                    Console.Clear();
                    System.Console.WriteLine($"You are in the {CurrentRoom.Name}: {CurrentRoom.Description}.");
                    Console.ForegroundColor = ConsoleColor.DarkGreen;
                    System.Console.WriteLine("In the room you find:");
                    if (CurrentRoom.Items.Count > 0)
                    {
                        foreach (var i in CurrentRoom.Items)
                        {
                            Console.WriteLine(i.Name);
                        }
                        Console.ForegroundColor = ConsoleColor.Blue;
                    }
                    else
                    {
                        Console.Clear();
                        System.Console.WriteLine($"You are in the {CurrentRoom.Name}: {CurrentRoom.Description}.");
                        System.Console.WriteLine("There are no items currently in this room.");
                    }
                    break;

                case "help":
                    Console.Clear();
                    System.Console.WriteLine(@"
        Possible Actions
Look - Examines your current surroundings
Go <Direction> - Moves the player from room to room
Use <ItemName> - Uses an item in a room or from your inventory
Take <ItemName> - Places an item into the player inventory and removes it from the room
i - Lists items in your inventory
Goal - Displays objective of game
Quit - Quits the Game");
                    break;

                case "take":
                    Console.Clear();
                    if (input.Length == 1)
                    {
                        System.Console.WriteLine("You must enter an item name alongide the 'take' command");
                    }
                    else
                    {
                        TakeItem(input[1]);
                    }
                    break;

                case "use":
                    Console.Clear();
                    if (input.Length == 1)
                    {
                        System.Console.WriteLine("You must enter an item name alongside the 'use' command");
                    }
                    else
                    {
                        UseItem(input[1]);
                    }
                    break;

                case "i":
                    if (CurrentPlayer.Inventory.Count > 0)
                    {
                        Console.Clear();
                        Console.ForegroundColor = ConsoleColor.DarkGreen;
                        Console.WriteLine("You are currently holding:");
                        foreach (var i in CurrentPlayer.Inventory)
                        {
                            Console.WriteLine(i.Name);
                        }
                        Console.ForegroundColor = ConsoleColor.Blue;
                    }
                    else
                    {
                        System.Console.WriteLine("Your inventory is empty! Take something!");
                    }
                    break;

                case "quit":
                    playing = false;
                    Console.Clear();
                    System.Console.WriteLine("Thanks for playing!");
                    break;

                case "sleep":
                    if (CurrentRoom.Name == "Bedroom")
                    {
                        playing = false;
                        Console.Clear();
                        Console.ForegroundColor = ConsoleColor.Red;
                        System.Console.WriteLine("You decide to go back to sleep, dismissing the troubles and stresses of the day. The consequences of your actions will certainly be a problem for 'future you,' but for now, you choose to seize the day and return to sleep.");
                        System.Console.WriteLine("----------YOU ARE A WINNER!----------");
                        System.Console.WriteLine("Start over? y/n");
                        string again = Console.ReadLine().ToLower();
                        if (again == "y")
                        {
                            Console.Clear(); Reset();
                        }
                        ;
                        if (again == "n")
                        {
                            playing = false;
                        }
                        ;
                    }
                    else
                    {
                        Console.Clear();
                        Console.ForegroundColor = ConsoleColor.DarkRed;
                        System.Console.WriteLine("So you know the secret command, eh? Well too bad for you, you can't sleep in this room!");
                    }
                    break;

                case "goal":
                    Console.Clear();
                    System.Console.WriteLine(@"Goal: Get dressed and do all the other 'prepare for the day' tasks. Then get in your car and drive away
For a list of possible actions type 'help'");
                    break;

                default:
                    System.Console.WriteLine("Please enter a proper action. Type 'help' if you are stuck");
                    break;
                }
            }
            Console.ForegroundColor = ConsoleColor.White;
        }
Exemplo n.º 9
0
 public void Go(string direction)
 {
     CurrentRoom = CurrentRoom.Go(direction);
     CurrentRoom.CallBack(CurrentPlayer, CurrentRoom);
 }
Exemplo n.º 10
0
        public void Play()
        {
            // Console.Clear();
            Console.WriteLine(CurrentRoom.Description);
            if (CurrentRoom.Items.Count != 0)
            {
                for (var i = 0; i < CurrentRoom.Items.Count; i++)
                {
                    System.Console.WriteLine(CurrentRoom.Items[i].Name);
                }
            }
            var choice      = Console.ReadLine().ToLower();
            var splitChoice = choice.Split(" ");

            switch (splitChoice[0])
            {
            case "go":
            case "Go":
            case "g":
                if (splitChoice.Length > 1)
                {
                    CurrentRoom = CurrentRoom.Go(splitChoice[1]);
                }
                break;

            case "take":
            case "Take":
            case "t":
                if (splitChoice.Length > 1)
                {
                    TakeItem(splitChoice[1]);
                }
                break;

            case "use":
            case "Use":
            case "u":
                if (splitChoice.Length > 1)
                {
                    UseItem(splitChoice[1]);
                }
                break;

            case "inventory":
            case "Inventroy":
            case "i":
                if (choice == splitChoice[0])
                {
                    CurrentPlayer.Inventory.ForEach(i => System.Console.WriteLine(i.Name + ":" + i.Description));
                }
                break;

            case "quit":
            {
                QuitGame();
            }
            break;

            case "destroy":
            {
                WinGame();
            }
            break;

            case "help":
            {
                Help();
            }
            break;

            case "look":
            case "Look":
            case "l":
            {
                Look();
            }
            break;
            }

            //get user input
            //input.split(" ")
            //switch input[0]
            //go
            //CurrentRoom.Go(input[1])
            //if succesfull CurrentRoom = Currentroom.(inputGo[1])
            //if(user input != null currentroom.go(input[1])
            //else cw "cant go there"
        }
Exemplo n.º 11
0
        public void play()
        {
            while (Playing)
            {
                Console.WriteLine("Stuck? Try typing help.");
                System.Console.WriteLine("Location: " + CurrentRoom.Name + CurrentRoom.Description);
                System.Console.WriteLine("What do you want to do?");
                string   input     = Console.ReadLine().ToLower().Trim();
                string[] userInput = input.Split(" ");
                switch (input)
                {
                case "use":
                    System.Console.WriteLine("Which item to use?");
                    var Consume = Console.ReadLine().ToLower();
                    UseItem(Consume);

                    // UseItem(userInput[0]);
                    break;

                case "go":
                {
                    System.Console.WriteLine("Which Direction?");
                    var direction   = Console.ReadLine();
                    var splitChoice = direction.ToLower().Split(" "); //will split work???
                    var nextRoom    = CurrentRoom.Go(direction);
                    if (nextRoom != null)
                    {
                        var helmet = CurrentPlayer.Inventory.Find(i => i.Name.Contains("bicycle helmet"));
                        if (nextRoom.Name == "Chapter 4: The Social Security Office. " && !CurrentPlayer.Inventory.Contains(helmet))
                        {
                            lose();
                            System.Console.WriteLine("You fall violently off the bikepath and die");
                        }
                        else if (CurrentRoom.Name == "Chapter 4: The Social Security Office. ")
                        {
                            System.Console.WriteLine("Play again? Type restart to reset the game");
                        }
                        else
                        {
                            CurrentRoom = nextRoom;
                        }
                    }
                    else
                    {
                        Console.WriteLine("You cannot go that way.");
                    }
                }
                break;

                case "take":
                {
                    Console.WriteLine("Which Item to take?");
                    var pickup = Console.ReadLine();
                    TakeItem(pickup);
                }
                break;

                case "inventory":
                {
                    for (int i = 0; i < CurrentPlayer.Inventory.Count; i++)
                    {
                        int displaynum = i + 1;
                        System.Console.WriteLine(CurrentPlayer.Inventory == null);

                        Console.WriteLine("Item: " + displaynum + " " + CurrentPlayer.Inventory[i].Name + CurrentPlayer.Inventory[i].Description);
                    }
                }
                break;

                case "help":
                {
                    help();
                }
                break;

                case "give-up":
                {
                    giveUp();
                }
                break;

                case "restart":
                {
                    Reset();
                }
                break;

                case "description":
                {
                    Console.WriteLine(CurrentRoom.Description);
                }
                break;

                // case "win":
                //   {
                //     Console.WriteLine("You won! Have a nice day!");
                //     Playing = false;
                //   }
                //   break;
                case "lose":
                {
                    lose();
                }
                break;

                default:
                    Console.WriteLine("Invalid Option");
                    break;
                }
            }
        }
Exemplo n.º 12
0
 public void Go(string direction)
 {
     CurrentRoom = (Room)CurrentRoom.Go(direction); //casting
 }
Exemplo n.º 13
0
 public void Go(string direction)
 {
     CurrentRoom = CurrentRoom.Go(direction);
     System.Console.WriteLine($"{CurrentRoom.Name}. {CurrentRoom.Description}.");
 }
Exemplo n.º 14
0
        public void Play()
        {
            Setup();
            while (Playing)
            {
                string   selection = Console.ReadLine().ToLower();
                string[] input     = selection.Split(" ");
                switch (input[0])
                {
                case "help":
                    Help();
                    break;

                case "reset":
                    Reset();
                    break;

                case "quit":
                    Quit();
                    break;

                case "take":
                    if (input[1] == "torch")
                    {
                        TakeTorch("torch");
                    }
                    break;

                case "pick":
                    if (input[1] == "mace")
                    {
                        PickMace("mace");
                    }
                    break;

                case "grab":
                    if (input[1] == "key")
                    {
                        GrabKey("key");
                    }
                    break;

                case "light":
                    if (input[1] == "torch")
                    {
                        UseItem("torch");
                    }
                    break;

                case "attack":
                    if (input[1] == "mace")
                    {
                        AttackMace("mace");
                    }
                    break;

                case "use":
                    if (input[1] == "key")
                    {
                        UseItem("key");
                    }
                    break;

                case "inventory":
                    Inventory();
                    break;

                case "look":
                    Look();
                    break;

                case "north":

                    if (CurrentRoom.Directions.ContainsKey("north"))
                    {
                        CurrentRoom = CurrentRoom.Go("north");
                        Console.WriteLine("You are in the Dragon's Dungeon Room. QUICK! Type 'use torch' to show the dragon you're friendly, or he'll roast you to death!");
                    }
                    else
                    {
                        Console.WriteLine("You hit a wall");
                    }
                    break;

                case "south":

                    if (CurrentRoom.Directions.ContainsKey("south"))
                    {
                        CurrentRoom = CurrentRoom.Go("south");
                        Console.WriteLine("You are in the Equipment Room, find a 'torch'!");
                    }
                    else
                    {
                        Console.WriteLine("You hit a wall");
                    }

                    break;

                case "east":

                    if (CurrentRoom.Directions.ContainsKey("east"))
                    {
                        CurrentRoom = CurrentRoom.Go("east");
                        Console.WriteLine("You are in the Goblin's Lair, he may be on vacation as he is nowhere to be seen. Grab the key by typing 'grab key' then head 'north'.");
                    }
                    else
                    {
                        Console.WriteLine("You hit a wall");
                    }
                    break;

                case "west":

                    if (CurrentRoom.Directions.ContainsKey("west"))
                    {
                        // if(CurrentRoom.Directions.ContainsKey("east"))
                        // {
                        //need to add a parameter above the east script, if(CurrentRoom == ")
                        // }

                        CurrentRoom = CurrentRoom.Go("west");
                        Quit();
                        Console.WriteLine("You are now in the bar room! Have a good time brotha! You Win!");
                    }
                    else
                    {
                        Console.WriteLine("The door locks behind you, you cannot go back into the equipment room.");    //redundant
                    }
                    break;
                // Item item = CurrentPlayer.Inventory.Find(i => i.Name == ItemName);
                //  if (item != null) .....
                //  prevent user for using the go west command... or (item = null)... allow user to go west.

                //then repeat for dragon room.. north. user needs to use keey.. check player inventory in useitem() or create new method for key.

                default:
                    // Console.Clear();
                    Console.WriteLine("I cannot identify your input, please try again or type 'help'");
                    break;
                }
            }
        }
Exemplo n.º 15
0
 public void Go(string direction) //north, east, south, west
 {
     CurrentRoom = CurrentRoom.Go(direction);
 }