private void PlaceFoodInRoom(bool isFirst, int numberOfItems, int foodQuality)
        {
            Rectangle room;

            if (isFirst)
            {
                room = _map.Rooms[0];
            }
            else
            {
                room = _map.Rooms.Last();
            }

            for (int i = 0; i < numberOfItems; i++)
            {
                if (_map.DoesRoomHaveWalkableSpace(room))
                {
                    Point randomRoomLocation = _map.GetRandomLocationInFirstRoom(room);
                    if (randomRoomLocation != null)
                    {
                        Item item = new FoodRation(foodQuality);

                        Point location = _map.GetRandomLocationInFirstRoom(room);
                        _map.AddTreasure(location.X, location.Y, item);
                    }
                }
            }
        }
예제 #2
0
        public bool GetInput(RLRootConsole rootConsole, CommandSystem commandSystem)
        {
            Player     player       = Game.Player;
            MessageLog messageLog   = Game.MessageLog;
            RLKeyPress keyPress     = rootConsole.Keyboard.GetKeyPress();
            bool       didPlayerAct = false;

            if (keyPress != null)
            {
                if (keyPress.Key == RLKey.Escape) // hp Fixme. Implement main menu
                {
                    rootConsole.Close();
                }
                else if (player.Status == "Dead")
                {
                    didPlayerAct = true;
                }
                else if (player.Status == "Stuck")
                {
                    messageLog.Add("You spend a turn trying to get out of your predicament", Swatch.DbBlood);
                    didPlayerAct = true;
                }
                else if (keyPress.Key == RLKey.Up || keyPress.Key == RLKey.Keypad8)
                {
                    didPlayerAct = commandSystem.MovePlayer(Direction.Up);
                }
                else if (keyPress.Key == RLKey.Down || keyPress.Key == RLKey.Keypad2)
                {
                    didPlayerAct = commandSystem.MovePlayer(Direction.Down);
                }
                else if (keyPress.Key == RLKey.Left || keyPress.Key == RLKey.Keypad4)
                {
                    didPlayerAct = commandSystem.MovePlayer(Direction.Left);
                }
                else if (keyPress.Key == RLKey.Right || keyPress.Key == RLKey.Keypad6)
                {
                    didPlayerAct = commandSystem.MovePlayer(Direction.Right);
                }
                else if (keyPress.Key == RLKey.Keypad7)
                {
                    didPlayerAct = commandSystem.MovePlayer(Direction.UpLeft);
                }
                else if (keyPress.Key == RLKey.Keypad9)
                {
                    didPlayerAct = commandSystem.MovePlayer(Direction.UpRight);
                }
                else if (keyPress.Key == RLKey.Keypad1)
                {
                    didPlayerAct = commandSystem.MovePlayer(Direction.DownLeft);
                }
                else if (keyPress.Key == RLKey.Keypad3)
                {
                    didPlayerAct = commandSystem.MovePlayer(Direction.DownRight);
                }
                else if (keyPress.Key == RLKey.Keypad5 || keyPress.Key == RLKey.KeypadPeriod ||
                         keyPress.Key == RLKey.Period || keyPress.Key == RLKey.Comma)
                {
                    didPlayerAct = Game.AttemptMoveDownDungeonLevel();

                    if (!didPlayerAct)
                    {
                        didPlayerAct = Game.AttemptMoveUpDungeonLevel();
                    }

                    if (!didPlayerAct)
                    {
                        didPlayerAct = true;
                    }
                }
                else if (keyPress.Key == RLKey.I)
                {
                    Game.IsInventoryScreenShowing = true;
                    Game.TogglePopupUpdate();
                    didPlayerAct = true;
                }
                else if (keyPress.Key == RLKey.Insert) // hp Debug
                {
                    Game.MoveDownDungeonLevel();

                    messageLog.Add("You Cheater! Instantly went to next Dungeon", Swatch.DbBlood);
                    didPlayerAct = true;
                }
                else if (keyPress.Key == RLKey.Home) // Debug
                {
                    player.LevelUp();

                    messageLog.Add("You Cheater! Instant level Up", Swatch.DbBlood);
                    didPlayerAct = true;
                }
                else if (keyPress.Key == RLKey.PageUp) // Debug
                {
                    player.Body = BodyEquipment.DragonLord();
                    player.Feet = FeetEquipment.DragonLord();
                    if (player.Hand == HandEquipment.Vampiric())
                    {
                        player.Hand = HandEquipment.DragonLord();
                    }
                    else
                    {
                        player.Hand = HandEquipment.Vampiric();
                    }
                    player.Head             = HeadEquipment.DragonLord();
                    player.Health           = player.MaxHealth;
                    player.Mana             = player.MaxMana;
                    player.IsPoisonedImmune = player.Body.GrantsPoisonImmunity;
                    messageLog.Add("You Cheater! Best equipment given and health fully restored", Swatch.DbBlood);
                    didPlayerAct = true;
                }
                else if (keyPress.Key == RLKey.Delete) // Debug
                {
                    messageLog.Add("Debug: Poisoned for 4 turns and hunger set to low", Swatch.DbBlood);
                    player.Hunger = 50;
                    if (player.IsPoisonedImmune == false)
                    {
                        player.State = new AbnormalState(6, "Poisoned", "The Poison has stated to take its full effect", -2, -2, -3, 2, 3);
                    }
                    else
                    {
                        messageLog.Add("Thankfully you are completely immune to poison", Swatch.DbBlood);
                    }
                    didPlayerAct = true;
                }
                else if (keyPress.Key == RLKey.End) // Debug
                {
                    player.Gold += 5000;
                    WeaponScroll    WeaponScroll    = new WeaponScroll();
                    ArmorScroll     ArmorScroll     = new ArmorScroll();
                    BookOfWhirlwind BookOfWhirlwind = new BookOfWhirlwind(4);
                    BookOfHealing   BookOfHealing   = new BookOfHealing(4);
                    BookOfSacrifice BookOfSacrifice = new BookOfSacrifice(4);
                    FoodRation      FoodRation      = new FoodRation(3);
                    RevealMapScroll RevealMapScroll = new RevealMapScroll();
                    SerpentWand     SerpentWand     = new SerpentWand(3);
                    PoisonFlask     PoisonFlask     = new PoisonFlask(3);
                    ExplosiveFlask  ExplosiveFlask  = new ExplosiveFlask(3);
                    VampiricWand    VampiricWand    = new VampiricWand(3);
                    player.Inventory.AddInventoryItem(WeaponScroll);
                    player.Inventory.AddInventoryItem(ArmorScroll);
                    player.Inventory.AddInventoryItem(BookOfWhirlwind);
                    player.Inventory.AddInventoryItem(BookOfHealing);
                    player.Inventory.AddInventoryItem(BookOfSacrifice);
                    player.Inventory.AddInventoryItem(FoodRation);
                    player.Inventory.AddInventoryItem(RevealMapScroll);
                    player.Inventory.AddInventoryItem(SerpentWand);
                    player.Inventory.AddInventoryItem(PoisonFlask);
                    player.Inventory.AddInventoryItem(ExplosiveFlask);
                    player.Inventory.AddInventoryItem(VampiricWand);
                    messageLog.Add("You Cheater! A bunch of gold and Rare Inventory items given", Swatch.DbBlood);
                    didPlayerAct = true;
                }
                else if (keyPress.Key == RLKey.PageDown) // Debug
                {
                    player.Hunger = 1200;

                    messageLog.Add("You Cheater! Hunger set to full", Swatch.DbBlood);
                    didPlayerAct = true;
                }
                else
                {
                    didPlayerAct = commandSystem.HandleKey(keyPress.Key);
                }
            }

            return(didPlayerAct);
        }