Exemplo n.º 1
0
        public void UseItem(string itemName)
        {
            Item choice = CurrentPlayer.Inventory.Find(item => item.Name == itemName);

            if (choice != null)
            {
                if (choice.Name == "shia labeouf" && CurrentRoom.Name == "tunnel door")
                {
                    Console.Clear();
                    Console.WriteLine("You begin to sob uncontrollably! Seeing this, Shia Labeouf springs to action! He sprints to and begins screaming at you 'Just do it!!!' His motivation gives you the confidence you need! You begin yelling back at the lady! Things are going great... Till suddenly Shia takes an axe to the woman... Oh my god! He definitely just murdered that woman... The two of you leave. Actual murders Shia Labeouf and his trusty accomplice " + CurrentPlayer.Name + " ride off into the sunset! You Win!!!");
                    CurrentPlayer.Inventory.Remove(choice);
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine(@"
            _________________________________________________________________________________
            |                                                                               |
            |   @       @     @  @     @       @       @             @   @   @     @   @    |
            |     @   @     @      @   @       @        @     @     @    @   @ @   @   @    |
            |       @       @      @   @       @         @   @ @   @     @   @  @  @   @    |
            |       @       @      @   @       @          @ @   @ @      @   @   @ @        |
            |       @         @  @       @ @ @             @     @       @   @     @   @    |
            |_______________________________________________________________________________|
          ");
                    Playing = false;
                }
                else if (choice.Name == "flashlight" && CurrentRoom.Name == "dark tunnel")
                {
                    Console.Clear();
                    Console.WriteLine("The tunnel brightens! Though you kind of wish it didn't... There's dismembered body's and blood everywhere! But you notice a crack in the wall that looks like a way out!");
                    CurrentRoom.AddExit("3) escape tunnel", Rooms[32]);
                    CurrentPlayer.Inventory.Remove(choice);
                }
                else if (choice.Name == "glasses" && CurrentRoom.Name == "clock room")
                {
                    Console.Clear();
                    Console.WriteLine("You put on the glasses. At first things are blurry, but you feel your perception rise. One clock stands out more than the rest... It's a digital clock where the numbers decend slowly down as time continues. But you notice the time is not changing, It's stuck on 1:58...");
                    CurrentPlayer.Inventory.Remove(choice);
                }
                else
                {
                    Console.Clear();
                    if (choice.Name == "shia labeouf")
                    {
                        Console.WriteLine("You see him out of the corner of you eyes following about 30 feet back. He's down on all fours, but it's not his time yet");
                    }
                    else if (choice.Name == "flashlight")
                    {
                        Console.WriteLine("It turns on, but you turn it off quickly feeling as though it maybe be more useful later...");
                    }
                    else if (choice.Name == "glasses")
                    {
                        Console.WriteLine("You put them on and struggle to see. Obviously... Why would they be your prescription??? You do feel as though your perception rises... Maybe that could be useful.");
                    }
                    else if (choice.Name == "envelope")
                    {
                        Console.WriteLine("You open the envelope to find 86 cents in assorted coins. Who tips in change?");
                    }
                }
            }
            else
            {
                Console.WriteLine("You take the " + itemName + " and place it in your mouth... weird...");
            }
        }
Exemplo n.º 2
0
        private KeyboardState UpdateInput(KeyboardState oldState, Floor floor, SpriteManager spriteManager)
        {
            KeyboardState newState = Keyboard.GetState();

            //checking if at the top of the map
            if (Location.Y != 0)
            {
                if (oldState.IsKeyDown(Keys.Up) && !(newState.IsKeyDown(Keys.Up)))
                {
                    dir = 1;
                    move(floor, new Vector2(0, 1));
                }
            }
            //checking right
            if (Location.X != 26)
            {
                if (oldState.IsKeyDown(Keys.Right) && !(newState.IsKeyDown(Keys.Right)))
                {
                    dir = 2;
                    move(floor, new Vector2(-1, 0));
                }
            }
            //checking down
            if (Location.Y != 26)
            {
                if (oldState.IsKeyDown(Keys.Down) && !(newState.IsKeyDown(Keys.Down)))
                {
                    dir = 3;
                    move(floor, new Vector2(0, -1));
                }
            }
            //checking left
            if (Location.X != 0)
            {
                if (oldState.IsKeyDown(Keys.Left) && !(newState.IsKeyDown(Keys.Left)))
                {
                    dir = 4;
                    move(floor, new Vector2(1, 0));
                }
            }
            if (oldState.IsKeyDown(Keys.Enter) && !(newState.IsKeyDown(Keys.Enter)))
            {
                //ROTATE ADJACENT ROOMS

                if (newState.IsKeyDown(Keys.A) && Location.X > 0 && rotationEnergy >= 5)
                {
                    rotate(floor, spriteManager, new Vector2(1, 0));
                }
                else if (newState.IsKeyDown(Keys.D) && Location.X < 26 && rotationEnergy >= 5)
                {
                    rotate(floor, spriteManager, new Vector2(-1, 0));
                }
                else if (newState.IsKeyDown(Keys.W) && Location.Y > 0 && rotationEnergy >= 5)
                {
                    rotate(floor, spriteManager, new Vector2(0, 1));
                }
                else if (newState.IsKeyDown(Keys.S) && Location.Y < 26 && rotationEnergy >= 5)
                {
                    rotate(floor, spriteManager, new Vector2(0, -1));
                }
                else if ((newState.GetPressedKeys().Length == 0) && rotationEnergy >= 2)
                {
                    //Rotate current room
                    rotate(floor, spriteManager, Vector2.Zero);
                }
                //else
                //spriteManager.PlayCue("error");
            }

            if (oldState.IsKeyDown(Keys.Back) && !(newState.IsKeyDown(Keys.Back)) && level >= 5)
            {
                if (newState.IsKeyDown(Keys.A) && Location.X > 0)
                {
                    if (SubtractEnergy(10))
                    {
                        CurrentRoom.AddExit(4);
                        floor[Location.X - 1, Location.Y].AddExit(2);
                    }
                }
                else if (newState.IsKeyDown(Keys.D) && Location.X < 26)
                {
                    if (SubtractEnergy(10))
                    {
                        CurrentRoom.AddExit(2);
                        floor[Location.X + 1, Location.Y].AddExit(4);
                    }
                }
                else if (newState.IsKeyDown(Keys.W) && Location.Y > 0)
                {
                    if (SubtractEnergy(10))
                    {
                        CurrentRoom.AddExit(1);
                        floor[Location.X, Location.Y - 1].AddExit(3);
                    }
                }
                else if (newState.IsKeyDown(Keys.S) && Location.Y < 26)
                {
                    if (SubtractEnergy(10))
                    {
                        CurrentRoom.AddExit(3);
                        floor[Location.X, Location.Y + 1].AddExit(1);
                    }
                }
            }
            //if (oldState.IsKeyDown(Keys.Delete) && !(newState.IsKeyDown(Keys.Delete)))
            //{
            //    if (newState.IsKeyDown(Keys.A) && Location.X > 0)
            //    {
            //        CurrentRoom.RemoveExit(4);
            //        floor[Location.X - 1, Location.Y].RemoveExit(2);
            //    }
            //    else if (newState.IsKeyDown(Keys.D) && Location.X < 26)
            //    {
            //        CurrentRoom.RemoveExit(2);
            //        floor[Location.X + 1, Location.Y].RemoveExit(4);
            //    }
            //    else if (newState.IsKeyDown(Keys.W) && Location.Y > 0)
            //    {
            //        CurrentRoom.RemoveExit(1);
            //        floor[Location.X, Location.Y - 1].RemoveExit(3);
            //    }
            //    else if (newState.IsKeyDown(Keys.S) && Location.Y < 26)
            //    {
            //        CurrentRoom.RemoveExit(3);
            //        floor[Location.X, Location.Y + 1].RemoveExit(1);
            //    }

            //}
            if (oldState.IsKeyDown(Keys.Home) && !(newState.IsKeyDown(Keys.Home)))
            {
                SpriteManager.SkipTurn = !SpriteManager.SkipTurn;
            }
            if (oldState.IsKeyDown(Keys.E) && !(newState.IsKeyDown(Keys.E)))
            {
                Item check = checkInventory(ItemList.Get("Energy Potion"));
                if (check != null)
                {
                    check.Use(this);
                }
            }
            if (oldState.IsKeyDown(Keys.P) && !(newState.IsKeyDown(Keys.P)))
            {
                Item check = checkInventory(ItemList.Get("Potion"));
                if (check != null)
                {
                    check.Use(this);
                }
            }
            //if (oldState.IsKeyDown(Keys.F) && !newState.IsKeyDown(Keys.F))
            //{
            //    AddItem(ItemList.Get("Elixir of Strength"));
            //    AddItem(ItemList.Get("Stoneskin Potion"));
            //}
            if (oldState.IsKeyDown(Keys.Escape) && !newState.IsKeyDown(Keys.Escape))
            {
                SpriteManager.ShowOptions();
            }
            if (oldState.IsKeyDown(Keys.Space) && !newState.IsKeyDown(Keys.Space))
            {
                turnTaken = true;
            }
            if (oldState.IsKeyDown(Keys.I) && !newState.IsKeyDown(Keys.I))
            {
                ShowInventory();
            }
            if (oldState.IsKeyDown(Keys.C) && !newState.IsKeyDown(Keys.C))
            {
                ShowStatus();
            }
            if (oldState.IsKeyDown(Keys.H) && !newState.IsKeyDown(Keys.H))
            {
                UI.ShowMessage("Controls:  ");
                UI.ShowMessage("Skip Turn: SPACE  Quick Use Energy Potion: E  Quick Use Potion: P");
                UI.ShowMessage("Status: C  Inventory: I  Volume Controls: ESC  Help: H  Move: ARROWS");
                UI.ShowMessage("Rotate Room: ENTER  Rotate Adjacent room: W,A,S,D + ENTER");
                UI.ShowMessage("Rotating rooms consumes your energy. 2 for your room, 5 for adjacent");
                if (level >= 5)
                {
                    UI.ShowMessage("(Level 5)Alternate Exit blasts a hole into an adjacent room");
                    UI.ShowMessage("Alternate Exit: W,A,S,D + BACKSPACE  Costs 10 energy");
                }
            }
            oldState = newState;
            return(oldState);
        }