Fill overworld-shuffle dungeon items with logic
Prevents maps and compasses from failing fast fill
This commit is contained in:
		
							parent
							
								
									b539892cc0
								
							
						
					
					
						commit
						eb602aedc3
					
				| 
						 | 
					@ -586,14 +586,20 @@ class OOTWorld(World):
 | 
				
			||||||
            fill_restrictive(self.world, self.world.get_all_state(False), any_dungeon_locations,
 | 
					            fill_restrictive(self.world, self.world.get_all_state(False), any_dungeon_locations,
 | 
				
			||||||
                             itempools['any_dungeon'], True, True)
 | 
					                             itempools['any_dungeon'], True, True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # If anything is overworld-only, enforce them as local and not in the remaining dungeon locations
 | 
					        # If anything is overworld-only, fill into local non-dungeon locations
 | 
				
			||||||
        if itempools['overworld'] or self.shuffle_fortresskeys == 'overworld':
 | 
					        if self.shuffle_fortresskeys == 'overworld':
 | 
				
			||||||
            from worlds.generic.Rules import forbid_items_for_player
 | 
					            fortresskeys = filter(lambda item: item.player == self.player and item.type == 'FortressSmallKey', self.world.itempool)
 | 
				
			||||||
            fortresskeys = {'Small Key (Gerudo Fortress)'} if self.shuffle_fortresskeys == 'overworld' else set()
 | 
					            itempools['overworld'].extend(fortresskeys)
 | 
				
			||||||
            local_overworld_items = set(map(lambda item: item.name, itempools['overworld'])).union(fortresskeys)
 | 
					        if itempools['overworld']:
 | 
				
			||||||
            for location in self.world.get_locations():
 | 
					            for item in itempools['overworld']:
 | 
				
			||||||
                if location.player != self.player or location in any_dungeon_locations:
 | 
					                self.world.itempool.remove(item)
 | 
				
			||||||
                    forbid_items_for_player(location, local_overworld_items, self.player)
 | 
					            itempools['overworld'].sort(key=lambda item: 
 | 
				
			||||||
 | 
					                {'GanonBossKey': 4, 'BossKey': 3, 'SmallKey': 2, 'FortressSmallKey': 1}.get(item.type, 0))
 | 
				
			||||||
 | 
					            non_dungeon_locations = [loc for loc in self.get_locations() if not loc.item and loc not in any_dungeon_locations 
 | 
				
			||||||
 | 
					                and loc.type != 'Shop' and (loc.type != 'Song' or self.shuffle_song_items != 'song')]
 | 
				
			||||||
 | 
					            self.world.random.shuffle(non_dungeon_locations)
 | 
				
			||||||
 | 
					            fill_restrictive(self.world, self.world.get_all_state(False), non_dungeon_locations,
 | 
				
			||||||
 | 
					                             itempools['overworld'], True, True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Place songs
 | 
					        # Place songs
 | 
				
			||||||
        # 5 built-in retries because this section can fail sometimes
 | 
					        # 5 built-in retries because this section can fail sometimes
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue