Fill: fix placing non_local + non advancement items
This commit is contained in:
		
							parent
							
								
									4520051ec9
								
							
						
					
					
						commit
						fd6e009c4b
					
				
							
								
								
									
										13
									
								
								Fill.py
								
								
								
								
							
							
						
						
									
										13
									
								
								Fill.py
								
								
								
								
							| 
						 | 
				
			
			@ -81,6 +81,7 @@ def distribute_items_restrictive(world: MultiWorld, fill_locations=None):
 | 
			
		|||
    progitempool = []
 | 
			
		||||
    nonexcludeditempool = []
 | 
			
		||||
    localrestitempool = {player: [] for player in range(1, world.players + 1)}
 | 
			
		||||
    nonlocalrestitempool = []
 | 
			
		||||
    restitempool = []
 | 
			
		||||
 | 
			
		||||
    for item in world.itempool:
 | 
			
		||||
| 
						 | 
				
			
			@ -90,11 +91,13 @@ def distribute_items_restrictive(world: MultiWorld, fill_locations=None):
 | 
			
		|||
            nonexcludeditempool.append(item)
 | 
			
		||||
        elif item.name in world.local_items[item.player]:
 | 
			
		||||
            localrestitempool[item.player].append(item)
 | 
			
		||||
        elif item.name in world.non_local_items[item.player]:
 | 
			
		||||
            nonlocalrestitempool.append(item)
 | 
			
		||||
        else:
 | 
			
		||||
            restitempool.append(item)
 | 
			
		||||
 | 
			
		||||
    world.random.shuffle(fill_locations)
 | 
			
		||||
    call_all(world, "fill_hook", progitempool, nonexcludeditempool, localrestitempool, restitempool, fill_locations)
 | 
			
		||||
    call_all(world, "fill_hook", progitempool, nonexcludeditempool, localrestitempool, nonlocalrestitempool, restitempool, fill_locations)
 | 
			
		||||
 | 
			
		||||
    fill_restrictive(world, world.state, fill_locations, progitempool)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -120,6 +123,14 @@ def distribute_items_restrictive(world: MultiWorld, fill_locations=None):
 | 
			
		|||
                world.push_item(spot_to_fill, item_to_place, False)
 | 
			
		||||
                fill_locations.remove(spot_to_fill)
 | 
			
		||||
 | 
			
		||||
    for item_to_place in nonlocalrestitempool:
 | 
			
		||||
        for i, location in enumerate(fill_locations):
 | 
			
		||||
            if location.player != item_to_place.player:
 | 
			
		||||
                world.push_item(fill_locations.pop(i), item_to_place, False)
 | 
			
		||||
                break
 | 
			
		||||
        else:
 | 
			
		||||
            logging.warning(f"Could not place non_local_item {item_to_place} among {fill_locations}, tossing.")
 | 
			
		||||
 | 
			
		||||
    world.random.shuffle(fill_locations)
 | 
			
		||||
 | 
			
		||||
    restitempool, fill_locations = fast_fill(world, restitempool, fill_locations)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -133,7 +133,8 @@ class World(metaclass=AutoWorldRegister):
 | 
			
		|||
        pass
 | 
			
		||||
 | 
			
		||||
    def fill_hook(cls, progitempool: List[Item], nonexcludeditempool: List[Item],
 | 
			
		||||
                  localrestitempool: Dict[int, List[Item]], restitempool: List[Item], fill_locations: List[Location]):
 | 
			
		||||
                  localrestitempool: Dict[int, List[Item]], nonlocalrestitempool: Dict[int, List[Item]],
 | 
			
		||||
                  restitempool: List[Item], fill_locations: List[Location]):
 | 
			
		||||
        """Special method that gets called as part of distribute_items_restrictive (main fill).
 | 
			
		||||
        This gets called once per present world type."""
 | 
			
		||||
        pass
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -320,7 +320,8 @@ class ALTTPWorld(World):
 | 
			
		|||
        return ALttPItem(name, self.player, **as_dict_item_table[name])
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def stage_fill_hook(cls, world, progitempool, nonexcludeditempool, localrestitempool, restitempool, fill_locations):
 | 
			
		||||
    def stage_fill_hook(cls, world, progitempool, nonexcludeditempool, localrestitempool, nonlocalrestitempool,
 | 
			
		||||
                        restitempool, fill_locations):
 | 
			
		||||
        trash_counts = {}
 | 
			
		||||
        standard_keyshuffle_players = set()
 | 
			
		||||
        for player in world.get_game_players("A Link to the Past"):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue