fix(algorithm): District algorithm fails if unable to comply with restriction
This commit is contained in:
3
Fill.py
3
Fill.py
@@ -280,9 +280,10 @@ def recovery_placement(item_to_place, locations, world, state, base_state, itemp
|
|||||||
return spot_to_fill
|
return spot_to_fill
|
||||||
return None
|
return None
|
||||||
# explicitly fail these cases
|
# explicitly fail these cases
|
||||||
elif world.algorithm in ['dungeon_only', 'major_only']:
|
elif world.algorithm in ['dungeon_only', 'major_only', 'district']:
|
||||||
raise FillError(f'Rare placement for {world.algorithm} detected. {item_to_place} unable to be placed.'
|
raise FillError(f'Rare placement for {world.algorithm} detected. {item_to_place} unable to be placed.'
|
||||||
f' Try a different seed')
|
f' Try a different seed')
|
||||||
|
# I don't think any algorithm uses fallback placement anymore, vanilla is special. Others simply fail.
|
||||||
else:
|
else:
|
||||||
other_locations = [x for x in locations if x not in attempted]
|
other_locations = [x for x in locations if x not in attempted]
|
||||||
for location in other_locations:
|
for location in other_locations:
|
||||||
|
|||||||
@@ -416,11 +416,11 @@ def filter_locations(item_to_place, locations, world, vanilla_skip=False, potion
|
|||||||
return filtered
|
return filtered
|
||||||
if world.algorithm == 'district':
|
if world.algorithm == 'district':
|
||||||
config = world.item_pool_config
|
config = world.item_pool_config
|
||||||
if ((isinstance(item_to_place,str) and item_to_place == 'Placeholder')
|
if ((isinstance(item_to_place, str) and item_to_place == 'Placeholder')
|
||||||
or item_to_place.name in config.item_pool[item_to_place.player]):
|
or item_to_place.name in config.item_pool[item_to_place.player]):
|
||||||
restricted = config.location_groups[0].locations
|
restricted = config.location_groups[0].locations
|
||||||
filtered = [l for l in locations if l.name in restricted and l.player in restricted[l.name]]
|
filtered = [l for l in locations if l.name in restricted and l.player in restricted[l.name]]
|
||||||
return filtered if len(filtered) > 0 else locations
|
return filtered
|
||||||
elif potion:
|
elif potion:
|
||||||
restricted = config.location_groups[0].locations
|
restricted = config.location_groups[0].locations
|
||||||
filtered = [l for l in locations if l.name not in restricted or l.player not in restricted[l.name]]
|
filtered = [l for l in locations if l.name not in restricted or l.player not in restricted[l.name]]
|
||||||
|
|||||||
Reference in New Issue
Block a user