Fix beatable-only prizes and dungeon items in multiworld
This commit is contained in:
		
							parent
							
								
									abfb57af23
								
							
						
					
					
						commit
						6d50e905e1
					
				|  | @ -150,7 +150,7 @@ def fill_dungeons_restrictive(world, shuffled_locations): | ||||||
|     sort_order = {"BigKey": 3, "SmallKey": 2} |     sort_order = {"BigKey": 3, "SmallKey": 2} | ||||||
|     dungeon_items.sort(key=lambda item: sort_order.get(item.type, 1)) |     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) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										9
									
								
								Fill.py
								
								
								
								
							
							
						
						
									
										9
									
								
								Fill.py
								
								
								
								
							|  | @ -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]) |     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(): |     def sweep_from_pool(): | ||||||
|         new_state = base_state.copy() |         new_state = base_state.copy() | ||||||
|         for item in itempool: |         for item in itempool: | ||||||
|  | @ -184,12 +184,17 @@ def fill_restrictive(world, base_state, locations, itempool): | ||||||
|         maximum_exploration_state = sweep_from_pool() |         maximum_exploration_state = sweep_from_pool() | ||||||
| 
 | 
 | ||||||
|         perform_access_check = True |         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) |             perform_access_check = not world.has_beaten_game(maximum_exploration_state) | ||||||
| 
 | 
 | ||||||
|         for item_to_place in items_to_place: |         for item_to_place in items_to_place: | ||||||
|             spot_to_fill = None |             spot_to_fill = None | ||||||
|             for location in locations: |             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): |                 if location.can_fill(maximum_exploration_state, item_to_place, perform_access_check): | ||||||
|                     spot_to_fill = location |                     spot_to_fill = location | ||||||
|                     break |                     break | ||||||
|  |  | ||||||
|  | @ -312,7 +312,7 @@ def fill_prizes(world, attempts=15): | ||||||
|                 prize_locs = list(empty_crystal_locations) |                 prize_locs = list(empty_crystal_locations) | ||||||
|                 random.shuffle(prizepool) |                 random.shuffle(prizepool) | ||||||
|                 random.shuffle(prize_locs) |                 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: |             except FillError as e: | ||||||
|                 logging.getLogger('').info("Failed to place dungeon prizes (%s). Will retry %s more times", e, attempts) |                 logging.getLogger('').info("Failed to place dungeon prizes (%s). Will retry %s more times", e, attempts) | ||||||
|                 for location in empty_crystal_locations: |                 for location in empty_crystal_locations: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue