From 59f819aebd3643a0c6b68285f0d246c61d190eae Mon Sep 17 00:00:00 2001 From: aerinon Date: Tue, 31 Dec 2019 21:12:53 -0700 Subject: [PATCH] Fixed a couple of generation errors --- DungeonGenerator.py | 2 +- DungeonRandomizer.py | 1 + KeyDoorShuffle.py | 14 +++++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/DungeonGenerator.py b/DungeonGenerator.py index b5feaf74..95eebb40 100644 --- a/DungeonGenerator.py +++ b/DungeonGenerator.py @@ -1482,7 +1482,7 @@ def valid_polarized_assignment(builder, sector_list): sector_mag = sector.magnitude() for i in range(len(sector_mag)): if sector_mag[i] > 0 and other_mag[i] == 0: - return True + return False # dead_ends = 0 # branches = 0 # for sector in sector_list: diff --git a/DungeonRandomizer.py b/DungeonRandomizer.py index 3e97e5ac..a6e5d07c 100755 --- a/DungeonRandomizer.py +++ b/DungeonRandomizer.py @@ -306,6 +306,7 @@ def start(): for _ in range(args.count): main(seed=seed, args=args) seed = random.randint(0, 999999999) + logging.getLogger('').info('Finished run %s', _) else: main(seed=args.seed, args=args) diff --git a/KeyDoorShuffle.py b/KeyDoorShuffle.py index 2f31f308..7d76a0ab 100644 --- a/KeyDoorShuffle.py +++ b/KeyDoorShuffle.py @@ -118,8 +118,9 @@ def analyze_dungeon(key_layout, world, player): raw_avail = chest_keys + len(key_counter.key_only_locations) available = raw_avail - key_counter.used_keys possible_smalls = count_unique_small_doors(key_counter, key_layout.flat_prop) + avail_bigs = count_unique_big_doors(key_counter) if not key_counter.big_key_opened: - if chest_keys == count_locations_big_optional(key_counter.free_locations) and available <= possible_smalls: + if chest_keys == count_locations_big_optional(key_counter.free_locations) and available <= possible_smalls and avail_bigs == 0: key_logic.bk_restricted.update(filter_big_chest(key_counter.free_locations)) if not key_counter.big_key_opened and big_chest_in_locations(key_counter.free_locations): key_logic.sm_restricted.update(find_big_chest_locations(key_counter.free_locations)) @@ -479,6 +480,17 @@ def count_unique_small_doors(key_counter, proposal): return cnt +def count_unique_big_doors(key_counter): + cnt = 0 + counted = set() + for door in key_counter.child_doors: + if door.bigKey and door not in counted: + cnt += 1 + counted.add(door) + counted.add(door.dest) + return cnt + + def count_locations_big_optional(locations, bk=False): cnt = 0 for loc in locations: