Merge branch 'Ambrosia' into Bias
This commit is contained in:
@@ -778,7 +778,7 @@ def handle_split_dungeons(dungeon_builders, recombinant_builders, entrances_map,
|
||||
|
||||
def main_dungeon_generation(dungeon_builders, recombinant_builders, connections_tuple, world, player):
|
||||
entrances_map, potentials, connections = connections_tuple
|
||||
enabled_entrances = {}
|
||||
enabled_entrances = world.enabled_entrances[player] = {}
|
||||
sector_queue = deque(dungeon_builders.values())
|
||||
last_key, loops = None, 0
|
||||
logging.getLogger('').info(world.fish.translate("cli", "cli", "generating.dungeon"))
|
||||
@@ -1607,7 +1607,7 @@ def find_key_door_candidates(region, checked, world, player):
|
||||
if d2.type == DoorType.Normal:
|
||||
room_b = world.get_room(d2.roomIndex, player)
|
||||
pos_b, kind_b = room_b.doorList[d2.doorListPos]
|
||||
valid = kind in okay_normals and kind_b in okay_normals
|
||||
valid = kind in okay_normals and kind_b in okay_normals and valid_key_door_pair(d, d2)
|
||||
else:
|
||||
valid = kind in okay_normals
|
||||
if valid and 0 <= d2.doorListPos < 4:
|
||||
@@ -1624,6 +1624,12 @@ def find_key_door_candidates(region, checked, world, player):
|
||||
return candidates, checked_doors
|
||||
|
||||
|
||||
def valid_key_door_pair(door1, door2):
|
||||
if door1.roomIndex != door2.roomIndex:
|
||||
return True
|
||||
return len(door1.entrance.parent_region.exits) <= 1 or len(door2.entrance.parent_region.exits) <= 1
|
||||
|
||||
|
||||
def reassign_key_doors(builder, world, player):
|
||||
logger = logging.getLogger('')
|
||||
logger.debug('Key doors for %s', builder.name)
|
||||
@@ -1940,14 +1946,18 @@ def check_required_paths(paths, world, player):
|
||||
if dungeon_name in world.dungeon_layouts[player].keys():
|
||||
builder = world.dungeon_layouts[player][dungeon_name]
|
||||
if len(paths[dungeon_name]) > 0:
|
||||
states_to_explore = defaultdict(list)
|
||||
states_to_explore = {}
|
||||
for path in paths[dungeon_name]:
|
||||
if type(path) is tuple:
|
||||
states_to_explore[tuple([path[0]])] = path[1]
|
||||
states_to_explore[tuple([path[0]])] = (path[1], 'any')
|
||||
else:
|
||||
states_to_explore[tuple(builder.path_entrances)].append(path)
|
||||
common_starts = tuple(builder.path_entrances)
|
||||
if common_starts not in states_to_explore:
|
||||
states_to_explore[common_starts] = ([], 'all')
|
||||
states_to_explore[common_starts][0].append(path)
|
||||
cached_initial_state = None
|
||||
for start_regs, dest_regs in states_to_explore.items():
|
||||
for start_regs, info in states_to_explore.items():
|
||||
dest_regs, path_type = info
|
||||
if type(dest_regs) is not list:
|
||||
dest_regs = [dest_regs]
|
||||
check_paths = convert_regions(dest_regs, world, player)
|
||||
@@ -1964,11 +1974,17 @@ def check_required_paths(paths, world, player):
|
||||
cached_initial_state = state
|
||||
else:
|
||||
state = cached_initial_state
|
||||
valid, bad_region = check_if_regions_visited(state, check_paths)
|
||||
if path_type == 'any':
|
||||
valid, bad_region = check_if_any_regions_visited(state, check_paths)
|
||||
else:
|
||||
valid, bad_region = check_if_all_regions_visited(state, check_paths)
|
||||
if not valid:
|
||||
if check_for_pinball_fix(state, bad_region, world, player):
|
||||
explore_state(state, world, player)
|
||||
valid, bad_region = check_if_regions_visited(state, check_paths)
|
||||
if path_type == 'any':
|
||||
valid, bad_region = check_if_any_regions_visited(state, check_paths)
|
||||
else:
|
||||
valid, bad_region = check_if_all_regions_visited(state, check_paths)
|
||||
if not valid:
|
||||
raise Exception('%s cannot reach %s' % (dungeon_name, bad_region.name))
|
||||
|
||||
@@ -2008,7 +2024,7 @@ def explore_state_not_inaccessible(state, world, player):
|
||||
state.add_all_doors_check_unattached(connect_region, world, player)
|
||||
|
||||
|
||||
def check_if_regions_visited(state, check_paths):
|
||||
def check_if_any_regions_visited(state, check_paths):
|
||||
valid = False
|
||||
breaking_region = None
|
||||
for region_target in check_paths:
|
||||
@@ -2020,6 +2036,13 @@ def check_if_regions_visited(state, check_paths):
|
||||
return valid, breaking_region
|
||||
|
||||
|
||||
def check_if_all_regions_visited(state, check_paths):
|
||||
for region_target in check_paths:
|
||||
if not state.visited_at_all(region_target):
|
||||
return False, region_target
|
||||
return True, None
|
||||
|
||||
|
||||
def check_for_pinball_fix(state, bad_region, world, player):
|
||||
pinball_region = world.get_region('Skull Pinball', player)
|
||||
# todo: lobby shuffle
|
||||
@@ -2043,7 +2066,7 @@ class DROptions(Flag):
|
||||
Town_Portal = 0x02 # If on, Players will start with mirror scroll
|
||||
Map_Info = 0x04
|
||||
Debug = 0x08
|
||||
Rails = 0x10 # If on, draws rails
|
||||
# Rails = 0x10 # Unused bit now
|
||||
OriginalPalettes = 0x20
|
||||
Open_PoD_Wall = 0x40 # If on, pre opens the PoD wall, no bow required
|
||||
Open_Desert_Wall = 0x80 # If on, pre opens the desert wall, no fire required
|
||||
|
||||
Reference in New Issue
Block a user