Example #1
0
        public void MoveTo(Location loc)
        {
            if (loc.ItemRequiredToEnter != null)
            {
                bool playerHasRequiredItem = false;
                foreach (InventoryItem ii in this.Inventory)
                {
                    if (ii.Details.ID == loc.ItemRequiredToEnter.ID)
                    {
                        playerHasRequiredItem = true;
                        break;
                    }
                }

                if (!playerHasRequiredItem)
                {
                    Console.WriteLine("You must have a {0} to enter this location.", loc.ItemRequiredToEnter.Name);
                    return;
                }
            }

            CurrentHitPoints = MaximumHitPoints;
            CurrentLocation  = loc;
            GameEngine.QuestProcessor(this, loc);
            GameEngine.MonsterProcessor(this, loc);
        }