Skip to content

Commit 3683191

Browse files
authored
Merge pull request #2948 from Lrauq/region-hint-improvements
Improve region hints & Always fill Snide
2 parents 4c28f97 + 60f8256 commit 3683191

File tree

4 files changed

+191
-50
lines changed

4 files changed

+191
-50
lines changed

randomizer/CompileHints.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,8 @@ def compileHints(spoiler: Spoiler) -> bool:
14201420
Locations.JapesDiddyMountain: [Regions.Mine, Maps.JapesMountain],
14211421
# Forest Diddy Winch naturally needs to find the Winch room very badly rather than Forest Main
14221422
Locations.ForestDiddyCagedBanana: [Regions.WinchRoom, Maps.ForestWinchRoom],
1423+
# Forest Donkey Mill needs to find the Grinder Room rather than Forest Main
1424+
Locations.ForestDonkeyMill: [Regions.GrinderRoom, Maps.ForestMillFront],
14231425
}
14241426
region_exceptions = {
14251427
# Most Galleon ships share a Map but have segmented sections. We want to be sure we're looking for the correct transition for each check.
@@ -1818,9 +1820,21 @@ def compileHints(spoiler: Spoiler) -> bool:
18181820
if candidate_region_name in hintable_region_names:
18191821
region_name_to_hint = candidate_region_name
18201822
hintable_region_names.remove(candidate_region_name)
1821-
1822-
if region_name_to_hint is None:
1823+
# Try to find a scouring-hintable region that actually contains useful info
1824+
valid_region_found = False
1825+
while not valid_region_found:
1826+
# If we somehow run out, kick back to the start of the loop - it handles that case there (RARE)
1827+
if len(hintable_region_names) == 0:
1828+
continue
1829+
# Start with a random one
18231830
region_name_to_hint = hintable_region_names.pop()
1831+
# If the region's hintable items are only in unshuffled locations, it's not an interesting hint
1832+
# Crucially, unshuffled locations still contribute to the count so as to not make the hints lie
1833+
for region_item in spoiler.region_hintable_count[region_name_to_hint].keys():
1834+
region_item_data = spoiler.region_hintable_count[region_name_to_hint][region_item]
1835+
if any(region_item_data["shuffled_locations"]):
1836+
valid_region_found = True
1837+
break
18241838
hint_location = hintset.getRandomHintLocation(random=spoiler.settings.random)
18251839
level_color = "\x05"
18261840
for region_id in Regions:
@@ -1834,7 +1848,7 @@ def compileHints(spoiler: Spoiler) -> bool:
18341848
for region_item in region_items:
18351849
region_item_data = spoiler.region_hintable_count[region_name_to_hint][region_item]
18361850
count = region_item_data["count"]
1837-
if count > max_count:
1851+
if count > max_count and len(region_item_data["shuffled_locations"]) > 0:
18381852
# Find the item in the region with the most *stuff*. This is the most valuable
18391853
max_count = count
18401854
max_plural = region_item_data["plural"]

0 commit comments

Comments
 (0)