Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LttP: extract Dungeon and Boss from core #1787

Merged
merged 11 commits into from
May 20, 2023
11 changes: 6 additions & 5 deletions worlds/oot/Hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,8 @@ def get_woth_hint(world, checked):
locations = world.required_locations
locations = list(filter(lambda location:
location.name not in checked[location.player]
and not (world.woth_dungeon >= world.hint_dist_user['dungeons_woth_limit'] and location.parent_region.dungeon)
and not (world.woth_dungeon >= world.hint_dist_user['dungeons_woth_limit']
and getattr(location.parent_region, "dungeon", None))
and location.name not in world.hint_exclusions
and location.name not in world.hint_type_overrides['woth']
and location.item.name not in world.item_hint_type_overrides['woth'],
Expand All @@ -486,7 +487,7 @@ def get_woth_hint(world, checked):
location = world.hint_rng.choice(locations)
checked[location.player].add(location.name)

if location.parent_region.dungeon:
if getattr(location.parent_region, "dungeon", None):
world.woth_dungeon += 1
location_text = getHint(location.parent_region.dungeon.name, world.clearer_hints).text
else:
Expand Down Expand Up @@ -570,7 +571,7 @@ def get_good_item_hint(world, checked):
checked[location.player].add(location.name)

item_text = getHint(getItemGenericName(location.item), world.clearer_hints).text
if location.parent_region.dungeon:
if getattr(location.parent_region, "dungeon", None):
location_text = getHint(location.parent_region.dungeon.name, world.clearer_hints).text
return (GossipText('#%s# hoards #%s#.' % (attach_name(location_text, location, world), attach_name(item_text, location.item, world)),
['Green', 'Red']), location)
Expand Down Expand Up @@ -613,8 +614,8 @@ def get_specific_item_hint(world, checked):
location = world.hint_rng.choice(locations)
checked[location.player].add(location.name)
item_text = getHint(getItemGenericName(location.item), world.clearer_hints).text
if location.parent_region.dungeon:

if getattr(location.parent_region, "dungeon", None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't isinstance(location.parent_region, OOTRegion) and location.parent_region.dungeon be a better fix for all of these?
The current fix looks as if it can break again if an unrelated world had a "dungeon" attr on its regions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question for @espeon65536, I went for this approach as for the current case, it just assumes that dungeon then has a .name, which for LttP is the case, making it work crossworld. So I preserved the current cross-game dungeon awareness of the original code.

location_text = getHint(location.parent_region.dungeon.name, world.clearer_hints).text
if world.hint_dist_user.get('vague_named_items', False):
return (GossipText('#%s# may be on the hero\'s path.' % (location_text), ['Green']), location)
Expand Down