Exemple #1
0
        private void ProcessSearch()
        {
            var room = CurrentRoom();

            if (room.Items == null)
            {
                DescribeCurrentState();
                return;
            }

            foreach (var item in room.Items)
            {
                foreach (var term in item.Value.LookTerms)
                {
                    if (_tokens.Contains(term))
                    {
                        if (InInventory(item.Key))
                        {
                            _gameIO.Write(_gameWorld.Items[item.Key].Description);
                            return;
                        }

                        AddToInventory(item.Key);
                        _gameIO.Write(_gameWorld.Items[item.Key].Found);
                        return;
                    }
                }
            }

            DescribeCurrentState();
        }