From 9f7d62a08182e262f5bdfe69e1b33a19cb2c58c9 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 31 Dec 2021 12:52:29 -0600 Subject: [PATCH] Fixed spoiler log and pooling issues with custom TFH amounts --- BaseClasses.py | 6 ++++++ ItemList.py | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index 54ef0860..7e3b4763 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -2834,6 +2834,12 @@ class Spoiler(object): 'triforcepool': self.world.treasure_hunt_total, 'code': {p: Settings.make_code(self.world, p) for p in range(1, self.world.players + 1)} } + if self.world.custom: + for p in range(1, self.world.players + 1): + if self.world.customitemarray[p]["triforcepiecesgoal"] > 0: + self.metadata['triforcegoal'][p] = max(min(self.world.customitemarray[p]["triforcepiecesgoal"], 99), 1) + if self.world.customitemarray[p]["triforcepieces"] > 0: + self.metadata['triforcepool'][p] = max(min(self.world.customitemarray[p]["triforcepieces"], 168), self.metadata['triforcegoal'][p]) def parse_data(self): self.medallions = OrderedDict() diff --git a/ItemList.py b/ItemList.py index 30dcc6c3..6f9dfaba 100644 --- a/ItemList.py +++ b/ItemList.py @@ -263,7 +263,7 @@ def generate_itempool(world, player): # set up item pool if world.custom: - (pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_icon, lamps_needed_for_dark_rooms) = make_custom_item_pool(world.progressive, world.shuffle[player], world.difficulty[player], world.timer, world.goal[player], world.mode[player], world.swords[player], world.retro[player], world.bombbag[player], world.customitemarray) + (pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_total, treasure_hunt_icon, lamps_needed_for_dark_rooms) = make_custom_item_pool(world.progressive, world.shuffle[player], world.difficulty[player], world.timer, world.goal[player], world.mode[player], world.swords[player], world.retro[player], world.bombbag[player], world.customitemarray) world.rupoor_cost = min(world.customitemarray[player]["rupoorcost"], 9999) else: (pool, placed_items, precollected_items, clock_mode, lamps_needed_for_dark_rooms) = get_pool_core(world.progressive, world.shuffle[player], world.difficulty[player], world.treasure_hunt_total[player], world.timer, world.goal[player], world.mode[player], world.swords[player], world.retro[player], world.bombbag[player], world.doorShuffle[player], world.logic[player]) @@ -345,6 +345,7 @@ def generate_itempool(world, player): world.treasure_hunt_icon[player] = 'Triforce Piece' if world.custom: world.treasure_hunt_count[player] = treasure_hunt_count + world.treasure_hunt_total[player] = treasure_hunt_total world.itempool.extend([item for item in get_dungeon_item_pool(world) if item.player == player and ((item.smallkey and world.keyshuffle[player]) @@ -955,7 +956,12 @@ def make_custom_item_pool(progressive, shuffle, difficulty, timer, goal, mode, s pool.append(thisbottle) if customitemarray["triforcepieces"] > 0 or customitemarray["triforcepiecesgoal"] > 0: - treasure_hunt_count = max(min(customitemarray["triforcepiecesgoal"], 99), 1) #To display, count must be between 1 and 99. + treasure_hunt_count = 20 + treasure_hunt_total = 30 + if customitemarray["triforcepiecesgoal"] > 0: + treasure_hunt_count = max(min(customitemarray["triforcepiecesgoal"], 99), 1) #To display, count must be between 1 and 99. + if customitemarray["triforcepieces"] > 0: + treasure_hunt_total = max(min(customitemarray["triforcepieces"], 168), treasure_hunt_count) #168 max to ensure other progression can fit. treasure_hunt_icon = 'Triforce Piece' # Ensure game is always possible to complete here, force sufficient pieces if the player is unwilling. if (customitemarray["triforcepieces"] < treasure_hunt_count) and (goal in ['triforcehunt', 'trinity']) and (customitemarray["triforce"] == 0): @@ -1003,7 +1009,7 @@ def make_custom_item_pool(progressive, shuffle, difficulty, timer, goal, mode, s # print("Placing " + str(nothings) + " Nothings") pool.extend(['Nothing'] * nothings) - return (pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_icon, lamps_needed_for_dark_rooms) + return (pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_total, treasure_hunt_icon, lamps_needed_for_dark_rooms) # A quick test to ensure all combinations generate the correct amount of items. def test():