Пример #1
0
        private bool GenerateDungeonItems(Region region, InventoryItemType insertedItem, bool logInsertedItem = false)
        {
            var retVal       = false;
            var tempItemPool = GetDungeonItemPool(region);

            tempItemPool.Add(insertedItem);

            PlaceItems(new List <Region> {
                region
            }, tempItemPool, region);

            haveItems.RemoveAll(x => x == InventoryItemType.BigKey);
            haveItems.RemoveAll(x => x == InventoryItemType.Compass);
            haveItems.RemoveAll(x => x == InventoryItemType.Key);
            haveItems.RemoveAll(x => x == InventoryItemType.Map);

            if (tempItemPool.Count > 0 || !romLocations.CanDefeatDungeon(region, haveItems))
            {
                romLocations.ResetRegion(region);
                log?.RemoveOrderedItems(region);
            }
            else
            {
                if (logInsertedItem)
                {
                    var insertedLocation = romLocations.Locations.First(x => x.Region == region && x.Item != null && ((InventoryItem)x.Item).Type == insertedItem);
                    log?.AddOrderedItem(insertedLocation);
                }
                retVal = true;
            }

            // we're going to add this back a little later anyway
            haveItems.Remove(insertedItem);

            return(retVal);
        }