Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions Hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,22 +1158,35 @@ def get_junk_hint(spoiler: Spoiler, world: World, checked: dict[HintArea | str,
def get_important_check_hint(spoiler: Spoiler, world: World, checked: dict[HintArea | str, set[CheckedKind]]) -> HintReturn:
top_level_locations = []
empty_dungeons = [dungeon for dungeon in world.precompleted_dungeons if world.precompleted_dungeons[dungeon]]
for location in world.get_filled_locations():
locations = [location for location in world.get_filled_locations()]

for location in locations:
hint_area = HintArea.at(location)

if (
hint_area not in top_level_locations
and hint_area not in checked
and hint_area != HintArea.ROOT
and hint_area.dungeon_name not in empty_dungeons # prevent pre-completed dungeons from being hinted
and not location.locked # prevent areas with unshuffled checks from being hinted
):
shuffled_locations_in_region = list(filter(lambda loc: HintArea.at(loc) == hint_area and not loc.locked, locations))

# Don't hint areas with all locations already hinted
if shuffled_locations_in_region and all(map(lambda loc: is_checked([loc], checked), shuffled_locations_in_region)):
continue
top_level_locations.append(hint_area)

if not top_level_locations:
return None

hint_area = random.choice(top_level_locations)
item_count = 0
for location in world.get_filled_locations():

for location in locations:
if HintArea.at(location) == hint_area:
shuffled_locations_in_region = list(filter(lambda loc: HintArea.at(loc) == hint_area and not loc.locked, locations))

if (location.item.majoritem
# exclude locked items
and not location.locked
Expand All @@ -1193,6 +1206,9 @@ def get_important_check_hint(spoiler: Spoiler, world: World, checked: dict[HintA
or world.settings.shuffle_ganon_bosskey == 'dungeons' or world.settings.shuffle_ganon_bosskey == 'tokens'))):
item_count = item_count + 1

if location in shuffled_locations_in_region and len(shuffled_locations_in_region) == 1:
mark_checked(checked, location.name)

mark_checked(checked, hint_area, CheckedKind.IMPORTANT_CHECK)

if item_count == 0:
Expand Down