remove some duplicate code
This commit is contained in:
parent
0286a81755
commit
a87a79eb00
12
Fill.py
12
Fill.py
|
@ -257,6 +257,11 @@ def balance_multiworld_progression(world):
|
||||||
|
|
||||||
reachable_locations_count = {player: 0 for player in range(1, world.players + 1)}
|
reachable_locations_count = {player: 0 for player in range(1, world.players + 1)}
|
||||||
|
|
||||||
|
def event_key(location):
|
||||||
|
return location.event and (
|
||||||
|
world.keyshuffle[location.item.player] or not location.item.smallkey) and (
|
||||||
|
world.bigkeyshuffle[location.item.player] or not location.item.bigkey)
|
||||||
|
|
||||||
def get_sphere_locations(sphere_state, locations):
|
def get_sphere_locations(sphere_state, locations):
|
||||||
sphere_state.sweep_for_events(key_only=True, locations=locations)
|
sphere_state.sweep_for_events(key_only=True, locations=locations)
|
||||||
return [loc for loc in locations if sphere_state.can_reach(loc)]
|
return [loc for loc in locations if sphere_state.can_reach(loc)]
|
||||||
|
@ -279,9 +284,7 @@ def balance_multiworld_progression(world):
|
||||||
candidate_items = []
|
candidate_items = []
|
||||||
while True:
|
while True:
|
||||||
for location in balancing_sphere:
|
for location in balancing_sphere:
|
||||||
if location.event and (
|
if event_key(location):
|
||||||
world.keyshuffle[location.item.player] or not location.item.smallkey) and (
|
|
||||||
world.bigkeyshuffle[location.item.player] or not location.item.bigkey):
|
|
||||||
balancing_state.collect(location.item, True, location)
|
balancing_state.collect(location.item, True, location)
|
||||||
if location.item.player in balancing_players and not location.locked:
|
if location.item.player in balancing_players and not location.locked:
|
||||||
candidate_items.append(location)
|
candidate_items.append(location)
|
||||||
|
@ -342,8 +345,7 @@ def balance_multiworld_progression(world):
|
||||||
sphere_locations.append(location)
|
sphere_locations.append(location)
|
||||||
|
|
||||||
for location in sphere_locations:
|
for location in sphere_locations:
|
||||||
if location.event and (world.keyshuffle[location.item.player] or not location.item.smallkey) and (
|
if event_key(location):
|
||||||
world.bigkeyshuffle[location.item.player] or not location.item.bigkey):
|
|
||||||
state.collect(location.item, True, location)
|
state.collect(location.item, True, location)
|
||||||
checked_locations.extend(sphere_locations)
|
checked_locations.extend(sphere_locations)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue