SM: Optimize a bit (#350)
* SM: Optimize a bit * SM: init bosses only once
This commit is contained in:
		@@ -524,22 +524,22 @@ class SMWorld(World):
 | 
				
			|||||||
            progitempool.sort(
 | 
					            progitempool.sort(
 | 
				
			||||||
                key=lambda item: 1 if (item.name == 'Morph Ball') else 0)
 | 
					                key=lambda item: 1 if (item.name == 'Morph Ball') else 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def post_fill(self):
 | 
					    @classmethod
 | 
				
			||||||
        new_state = CollectionState(self.world)
 | 
					    def stage_post_fill(cls, world):
 | 
				
			||||||
 | 
					        new_state = CollectionState(world)
 | 
				
			||||||
        progitempool = []
 | 
					        progitempool = []
 | 
				
			||||||
        for item in self.world.itempool:
 | 
					        for item in world.itempool:
 | 
				
			||||||
            if item.player == self.player and item.advancement:
 | 
					            if item.game == "Super Metroid" and item.advancement:
 | 
				
			||||||
                progitempool.append(item)
 | 
					                progitempool.append(item)
 | 
				
			||||||
            if item.location.player == self.player and item.game == "Super Metroid" and item.type == "Nothing":
 | 
					 | 
				
			||||||
                item.location.address = None
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for item in progitempool:
 | 
					        for item in progitempool:
 | 
				
			||||||
            new_state.collect(item, True)
 | 
					            new_state.collect(item, True)
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        bossesLoc = ['Draygon', 'Kraid', 'Ridley', 'Phantoon', 'Mother Brain']
 | 
					        bossesLoc = ['Draygon', 'Kraid', 'Ridley', 'Phantoon', 'Mother Brain']
 | 
				
			||||||
 | 
					        for player in world.get_game_players("Super Metroid"):
 | 
				
			||||||
            for bossLoc in bossesLoc:
 | 
					            for bossLoc in bossesLoc:
 | 
				
			||||||
            if (not self.world.get_location(bossLoc, self.player).can_reach(new_state)):
 | 
					                if not world.get_location(bossLoc, player).can_reach(new_state):
 | 
				
			||||||
                self.world.state.smbm[self.player].onlyBossLeft = True
 | 
					                    world.state.smbm[player].onlyBossLeft = True
 | 
				
			||||||
                    break
 | 
					                    break
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -576,5 +576,7 @@ class SMItem(Item):
 | 
				
			|||||||
    game = "Super Metroid"
 | 
					    game = "Super Metroid"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self, name, advancement, type, code, player: int = None):
 | 
					    def __init__(self, name, advancement, type, code, player: int = None):
 | 
				
			||||||
 | 
					        if type == "Nothing":
 | 
				
			||||||
 | 
					            code = None
 | 
				
			||||||
        super(SMItem, self).__init__(name, advancement, code, player)
 | 
					        super(SMItem, self).__init__(name, advancement, code, player)
 | 
				
			||||||
        self.type = type
 | 
					        self.type = type
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user