Generation improvements

Potential fix for overworld problem
This commit is contained in:
aerinon
2020-12-08 11:24:44 -07:00
parent 5c9c9947f3
commit 85d05f625b
5 changed files with 8 additions and 5 deletions

View File

@@ -1861,12 +1861,12 @@ def check_required_paths(paths, world, player):
if dungeon_name in world.dungeon_layouts[player].keys(): if dungeon_name in world.dungeon_layouts[player].keys():
builder = world.dungeon_layouts[player][dungeon_name] builder = world.dungeon_layouts[player][dungeon_name]
if len(paths[dungeon_name]) > 0: if len(paths[dungeon_name]) > 0:
states_to_explore = {} states_to_explore = defaultdict(list)
for path in paths[dungeon_name]: for path in paths[dungeon_name]:
if type(path) is tuple: if type(path) is tuple:
states_to_explore[tuple([path[0]])] = path[1] states_to_explore[tuple([path[0]])] = path[1]
else: else:
states_to_explore[tuple(builder.path_entrances)] = path states_to_explore[tuple(builder.path_entrances)].append(path)
cached_initial_state = None cached_initial_state = None
for start_regs, dest_regs in states_to_explore.items(): for start_regs, dest_regs in states_to_explore.items():
if type(dest_regs) is not list: if type(dest_regs) is not list:
@@ -1935,13 +1935,14 @@ def check_if_regions_visited(state, check_paths):
if state.visited_at_all(region_target): if state.visited_at_all(region_target):
valid = True valid = True
break break
else: elif not breaking_region:
breaking_region = region_target breaking_region = region_target
return valid, breaking_region return valid, breaking_region
def check_for_pinball_fix(state, bad_region, world, player): def check_for_pinball_fix(state, bad_region, world, player):
pinball_region = world.get_region('Skull Pinball', player) pinball_region = world.get_region('Skull Pinball', player)
# todo: lobby shuffle
if bad_region.name == 'Skull 2 West Lobby' and state.visited_at_all(pinball_region): # revisit this for entrance shuffle if bad_region.name == 'Skull 2 West Lobby' and state.visited_at_all(pinball_region): # revisit this for entrance shuffle
door = world.get_door('Skull Pinball WS', player) door = world.get_door('Skull Pinball WS', player)
room = world.get_room(door.roomIndex, player) room = world.get_room(door.roomIndex, player)

View File

@@ -1575,6 +1575,8 @@ def assign_crystal_switch_sectors(dungeon_map, crystal_switches, crystal_barrier
valid = global_pole.is_valid_choice(dungeon_map, builder_choice, test_set) valid = global_pole.is_valid_choice(dungeon_map, builder_choice, test_set)
assign_sector(switch_choice, builder_choice, crystal_switches, global_pole) assign_sector(switch_choice, builder_choice, crystal_switches, global_pole)
return crystal_switches return crystal_switches
if len(crystal_switches) == 0:
raise GenerationException('No crystal switches to assign')
sector_list = list(crystal_switches) sector_list = list(crystal_switches)
choices = random.sample(sector_list, k=len(population)) choices = random.sample(sector_list, k=len(population))
for i, choice in enumerate(choices): for i, choice in enumerate(choices):

View File

@@ -25,7 +25,7 @@ from Fill import distribute_items_cutoff, distribute_items_staleness, distribute
from ItemList import generate_itempool, difficulties, fill_prizes, fill_specific_items from ItemList import generate_itempool, difficulties, fill_prizes, fill_specific_items
from Utils import output_path, parse_player_names from Utils import output_path, parse_player_names
__version__ = '0.2.0.18u' __version__ = '0.2.0.19u'
class EnemizerError(RuntimeError): class EnemizerError(RuntimeError):
pass pass

2
Rom.py
View File

@@ -27,7 +27,7 @@ from EntranceShuffle import door_addresses, exit_ids
JAP10HASH = '03a63945398191337e896e5771f77173' JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = '185a0f74ab0e2ce8899c8d7d309ca68c' RANDOMIZERBASEHASH = '7264ffb7c430dde5d6bfe6030b79a575'
class JsonRom(object): class JsonRom(object):

Binary file not shown.