Skip to content

Commit

Permalink
Merge pull request #2 from Elagatua/feature/prioritize-dungeon-hints
Browse files Browse the repository at this point in the history
Prioritize dungeon locations for path and barren hints
  • Loading branch information
Elagatua authored Feb 20, 2022
2 parents f84ef71 + fd4be42 commit f35597b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
15 changes: 13 additions & 2 deletions Hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,14 @@ def get_goal_hint(spoiler, world, checked):
# Goal weight to zero mitigates double hinting this goal
# Once all goals in a category are 0, selection is true random
goal.weight = 0
location_tuple = random.choice(goal_locations)

prioritize_dungeon_hints = 'prioritize_dungeons' in world.hint_dist_user and world.hint_dist_user['prioritize_dungeons']
dungeon_goal_locations = list(filter(lambda loc: loc[0].parent_region.dungeon, goal_locations))
if prioritize_dungeon_hints and len(dungeon_goal_locations) > 0:
location_tuple = random.choice(dungeon_goal_locations)
else:
location_tuple = random.choice(goal_locations)

location = location_tuple[0]
world_ids = location_tuple[3]
world_id = random.choice(world_ids)
Expand Down Expand Up @@ -548,7 +555,11 @@ def get_barren_hint(spoiler, world, checked):
# Randomly choose between overworld or dungeon
dungeon_areas = list(filter(lambda area: world.empty_areas[area]['dungeon'], areas))
overworld_areas = list(filter(lambda area: not world.empty_areas[area]['dungeon'], areas))
if not dungeon_areas:

prioritize_dungeon_hints = 'prioritize_dungeons' in world.hint_dist_user and world.hint_dist_user['prioritize_dungeons']
if prioritize_dungeon_hints and len(dungeon_areas) > 0:
world.get_barren_hint_prev = RegionRestriction.DUNGEON
elif not dungeon_areas:
# no dungeons left, default to overworld
world.get_barren_hint_prev = RegionRestriction.OVERWORLD
elif not overworld_areas:
Expand Down
6 changes: 3 additions & 3 deletions data/Hints/triforce_blitz.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"name": "triforce-blitz",
"gui_name": "Triforce Blitz",
"description": "Hint Distribution for the S5 Tournament. 5 Goal Hints, 3 Barren Hints, 5 Sometimes hints, 7 Always hints (including skull mask).",
"description": "Hint Distribution for Triforce Blitz. 3 Path Count Hints, 10 Goal Hints, 5 Barren Hints, 3 Always hints.",
"add_locations": [
{ "location": "Kak 20 Gold Skulltula Reward", "types": ["always"]},
{ "location": "Deku Theater Skull Mask", "types": ["always"]}
{ "location": "Kak 20 Gold Skulltula Reward", "types": ["always"]}
],
"remove_locations": [{"location": "Ganons Castle Shadow Trial Golden Gauntlets Chest", "types": "sometimes"}],
"add_items": [],
Expand All @@ -14,6 +13,7 @@
"named_items_required": true,
"vague_named_items": false,
"use_default_goals": false,
"prioritize_dungeons": true,
"custom_goals": [{
"category": "triforce_hunt",
"priority": 30,
Expand Down

0 comments on commit f35597b

Please sign in to comment.