A lot of generation improvements and bug squashing

This commit is contained in:
aerinon
2021-01-08 16:31:33 -07:00
parent 3053942243
commit d64a4e63a2
9 changed files with 130 additions and 200 deletions

View File

@@ -335,8 +335,9 @@ def adjust_locations_rules(key_logic, rule, accessible_loc, key_layout, key_coun
test_set = None
needed = rule.needed_keys_w_bk
if needed > 0:
accessible_loc.update(key_counter.other_locations)
blocked_loc = key_layout.all_locations-accessible_loc
all_accessible = set(accessible_loc)
all_accessible.update(key_counter.other_locations)
blocked_loc = key_layout.all_locations-all_accessible
for location in blocked_loc:
if location not in key_logic.location_rules.keys():
loc_rule = LocationRule()
@@ -375,8 +376,12 @@ def refine_placement_rules(key_layout, max_ctr):
rules_to_remove.append(rule)
if rule.bk_relevant and len(rule.check_locations_w_bk) == rule.needed_keys_w_bk + 1:
new_restricted = set(max_ctr.free_locations) - rule.check_locations_w_bk
if len(new_restricted - key_logic.bk_restricted) > 0:
key_logic.bk_restricted.update(new_restricted) # bk must be in one of the check_locations
if len(new_restricted | key_logic.bk_restricted) < len(key_layout.all_chest_locations):
if len(new_restricted - key_logic.bk_restricted) > 0:
key_logic.bk_restricted.update(new_restricted) # bk must be in one of the check_locations
changed = True
else:
rules_to_remove.append(rule)
changed = True
if rule.needed_keys_w_bk > key_layout.max_chests or len(rule.check_locations_w_bk) < rule.needed_keys_w_bk:
logging.getLogger('').warning('Invalid rule - what went wrong here??')
@@ -501,6 +506,8 @@ def find_bk_locked_sections(key_layout, world, player):
key_layout.all_chest_locations.update(counter.free_locations)
key_layout.item_locations.update(counter.free_locations)
key_layout.item_locations.update(counter.key_only_locations)
key_layout.all_locations.update(key_layout.item_locations)
key_layout.all_locations.update(counter.other_locations)
if counter.big_key_opened and counter.important_location:
big_chest_allowed_big_key = False
if not counter.big_key_opened: