From 8e8206ef0b8ad01919cdf5f47028c050bb9dddd4 Mon Sep 17 00:00:00 2001 From: CookieCat Date: Sun, 12 May 2024 23:09:50 -0400 Subject: [PATCH] Fix range options not being corrected properly --- worlds/ahit/Options.py | 52 +++++++++++++----------------------------- worlds/ahit/Rules.py | 11 ++++++--- 2 files changed, 24 insertions(+), 39 deletions(-) diff --git a/worlds/ahit/Options.py b/worlds/ahit/Options.py index 0cc80bf902..2184a9ae80 100644 --- a/worlds/ahit/Options.py +++ b/worlds/ahit/Options.py @@ -9,45 +9,25 @@ if TYPE_CHECKING: def adjust_options(world: "HatInTimeWorld"): - world.options.HighestChapterCost.value = max( - world.options.HighestChapterCost.value, - world.options.LowestChapterCost.value) + if world.options.HighestChapterCost < world.options.LowestChapterCost: + world.options.HighestChapterCost.value, world.options.LowestChapterCost.value = \ + world.options.LowestChapterCost.value, world.options.HighestChapterCost.value - world.options.LowestChapterCost.value = min( - world.options.LowestChapterCost.value, - world.options.HighestChapterCost.value) + if world.options.FinalChapterMaxCost < world.options.FinalChapterMinCost: + world.options.FinalChapterMaxCost.value, world.options.FinalChapterMinCost.value = \ + world.options.FinalChapterMinCost.value, world.options.FinalChapterMaxCost.value - world.options.FinalChapterMinCost.value = min( - world.options.FinalChapterMinCost.value, - world.options.FinalChapterMaxCost.value) + if world.options.BadgeSellerMaxItems < world.options.BadgeSellerMinItems: + world.options.BadgeSellerMaxItems.value, world.options.BadgeSellerMinItems.value = \ + world.options.BadgeSellerMinItems.value, world.options.BadgeSellerMaxItems.value - world.options.FinalChapterMaxCost.value = max( - world.options.FinalChapterMaxCost.value, - world.options.FinalChapterMinCost.value) + if world.options.NyakuzaThugMaxShopItems < world.options.NyakuzaThugMinShopItems: + world.options.NyakuzaThugMaxShopItems.value, world.options.NyakuzaThugMinShopItems.value = \ + world.options.NyakuzaThugMinShopItems.value, world.options.NyakuzaThugMaxShopItems.value - world.options.BadgeSellerMinItems.value = min( - world.options.BadgeSellerMinItems.value, - world.options.BadgeSellerMaxItems.value) - - world.options.BadgeSellerMaxItems.value = max( - world.options.BadgeSellerMinItems.value, - world.options.BadgeSellerMaxItems.value) - - world.options.NyakuzaThugMinShopItems.value = min( - world.options.NyakuzaThugMinShopItems.value, - world.options.NyakuzaThugMaxShopItems.value) - - world.options.NyakuzaThugMaxShopItems.value = max( - world.options.NyakuzaThugMinShopItems.value, - world.options.NyakuzaThugMaxShopItems.value) - - world.options.DWShuffleCountMin.value = min( - world.options.DWShuffleCountMin.value, - world.options.DWShuffleCountMax.value) - - world.options.DWShuffleCountMax.value = max( - world.options.DWShuffleCountMin.value, - world.options.DWShuffleCountMax.value) + if world.options.DWShuffleCountMax < world.options.DWShuffleCountMin: + world.options.DWShuffleCountMax.value, world.options.DWShuffleCountMin.value = \ + world.options.DWShuffleCountMin.value, world.options.DWShuffleCountMax.value total_tps: int = get_total_time_pieces(world) if world.options.HighestChapterCost.value > total_tps-5: @@ -60,7 +40,7 @@ def adjust_options(world: "HatInTimeWorld"): world.options.FinalChapterMaxCost.value = min(50, total_tps) if world.options.FinalChapterMinCost.value > total_tps: - world.options.FinalChapterMinCost.value = min(50, total_tps-5) + world.options.FinalChapterMinCost.value = min(50, total_tps) # Don't allow Rush Hour goal if DLC2 content is disabled if world.options.EndGoal.value == 2 and world.options.EnableDLC2.value == 0: diff --git a/worlds/ahit/Rules.py b/worlds/ahit/Rules.py index 7b6278dc91..720f500be3 100644 --- a/worlds/ahit/Rules.py +++ b/worlds/ahit/Rules.py @@ -202,9 +202,14 @@ def set_rules(world: "HatInTimeWorld"): last_cost = cost if final_chapter is not None: - world.chapter_timepiece_costs[final_chapter] = world.random.randint( - world.options.FinalChapterMinCost.value, - world.options.FinalChapterMaxCost.value) + final_chapter_cost: int + if world.options.FinalChapterMinCost.value == world.options.FinalChapterMaxCost.value: + final_chapter_cost = world.options.FinalChapterMaxCost.value + else: + final_chapter_cost = world.random.randint(world.options.FinalChapterMinCost.value, + world.options.FinalChapterMaxCost.value) + + world.chapter_timepiece_costs[final_chapter] = final_chapter_cost add_rule(world.multiworld.get_entrance("Telescope -> Mafia Town", world.player), lambda state: state.has("Time Piece", world.player, world.chapter_timepiece_costs[ChapterIndex.MAFIA]))