Fix beatable-only prizes and dungeon items in multiworld

This commit is contained in:
Bonta-kun 2019-12-11 11:37:05 +01:00
parent abfb57af23
commit 6d50e905e1
3 changed files with 9 additions and 4 deletions

View File

@ -150,7 +150,7 @@ def fill_dungeons_restrictive(world, shuffled_locations):
sort_order = {"BigKey": 3, "SmallKey": 2}
dungeon_items.sort(key=lambda item: sort_order.get(item.type, 1))
fill_restrictive(world, all_state_base, shuffled_locations, dungeon_items)
fill_restrictive(world, all_state_base, shuffled_locations, dungeon_items, True)

View File

@ -161,7 +161,7 @@ def distribute_items_staleness(world):
logging.getLogger('').debug('Unplaced items: %s - Unfilled Locations: %s', [item.name for item in itempool], [location.name for location in fill_locations])
def fill_restrictive(world, base_state, locations, itempool):
def fill_restrictive(world, base_state, locations, itempool, single_player = False):
def sweep_from_pool():
new_state = base_state.copy()
for item in itempool:
@ -184,12 +184,17 @@ def fill_restrictive(world, base_state, locations, itempool):
maximum_exploration_state = sweep_from_pool()
perform_access_check = True
if world.accessibility == 'none':
if world.accessibility == 'none' and not single_player:
perform_access_check = not world.has_beaten_game(maximum_exploration_state)
for item_to_place in items_to_place:
spot_to_fill = None
for location in locations:
if single_player:
if location.player != item_to_place.player:
continue
if world.accessibility == 'none':
perform_access_check = not world.has_beaten_game(maximum_exploration_state, location.player)
if location.can_fill(maximum_exploration_state, item_to_place, perform_access_check):
spot_to_fill = location
break

View File

@ -312,7 +312,7 @@ def fill_prizes(world, attempts=15):
prize_locs = list(empty_crystal_locations)
random.shuffle(prizepool)
random.shuffle(prize_locs)
fill_restrictive(world, all_state, prize_locs, prizepool)
fill_restrictive(world, all_state, prize_locs, prizepool, True)
except FillError as e:
logging.getLogger('').info("Failed to place dungeon prizes (%s). Will retry %s more times", e, attempts)
for location in empty_crystal_locations: