Skip to content

Commit

Permalink
Make logically requiring Gohma in Closed Forest a setting
Browse files Browse the repository at this point in the history
  • Loading branch information
fenhl committed Feb 28, 2023
1 parent 819b83a commit de84817
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 48 deletions.
8 changes: 6 additions & 2 deletions EntranceShuffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def assume_entrance_pool(entrance_pool):


def build_one_way_targets(world, types_to_include, exclude=(), target_region_names=()):
if world.settings.open_forest == 'closed':
# The logic assumes that this entrance places Link outside the circle on which the Kokiri boy moves,
# but this is not the case if you spawn or warp here.
exclude = ('LW Bridge -> Kokiri Forest', *exclude)
one_way_entrances = []
for pool_type in types_to_include:
one_way_entrances += world.get_shufflable_entrances(type=pool_type)
Expand Down Expand Up @@ -515,8 +519,8 @@ def shuffle_random_entrances(worlds):
entrance_pools['Dungeon'] = world.get_shufflable_entrances(type='Dungeon', only_primary=True)
# The fill algorithm will already make sure gohma is reachable, however it can end up putting
# a forest escape via the hands of spirit on Deku leading to Deku on spirit in logic. This is
# not really a closed forest anymore, so specifically remove Deku Tree from closed forest.
if worlds[0].settings.open_forest == 'closed':
# contrary to the idea of Require Gohma, so specifically place Deku Tree in its vanilla location.
if worlds[0].settings.require_gohma:
entrance_pools['Dungeon'].remove(world.get_entrance('KF Outside Deku Tree -> Deku Tree Lobby'))
if worlds[0].shuffle_special_dungeon_entrances:
entrance_pools['Dungeon'] += world.get_shufflable_entrances(type='DungeonSpecial', only_primary=True)
Expand Down
66 changes: 49 additions & 17 deletions SettingsList.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,8 @@ def __init__(self, name, gui_text, min, max, default, step=1,
'tooltip' : '''\
A precise jump can be used to skip
needing to use the Slingshot to go
around B1 of the Deku Tree. If used
with the "Closed Forest" setting, a
around B1 of the Deku Tree. If using
"Closed Forest Requires Gohma", a
Slingshot will not be guaranteed to
exist somewhere inside the Forest.
This trick applies to both Vanilla
Expand Down Expand Up @@ -3163,30 +3163,28 @@ def __init__(self, name, gui_text, min, max, default, step=1,
'closed': 'Closed Forest',
},
gui_tooltip = '''\
'Open Forest': Mido no longer blocks the path to the
Deku Tree, and the Kokiri boy no longer blocks the path
out of the forest.
'Closed Forest': In the child era, Mido blocks the path
to the Deku Tree, requiring Kokiri Sword and Deku Shield
to access the Deku Tree, and another Kokiri boy blocks
the path out of the forest until Queen Gohma is defeated.
It may be logically required to "escape" the forest
(via one of the shortcuts in the Lost Woods, for example);
the setting "Closed Forest Requires Gohma" in the Detailed
Logic tab can be used to prevent this.
'Closed Deku': The Kokiri boy no longer blocks the path
out of the forest, but Mido still blocks the path to the
Deku Tree, requiring Kokiri Sword and Deku Shield to access
the Deku Tree.
'Closed Forest': Beating Deku Tree is logically required
to leave the forest area (Kokiri Forest/Lost Woods/Sacred Forest
Meadow/Deku Tree), while the Kokiri Sword and a Deku Shield are
required to access the Deku Tree. Items needed for this will be
guaranteed inside the forest area. This setting is incompatible
with starting as adult, and so Starting Age will be locked to Child.
With either "Shuffle Interior Entrances" set to "All", "Shuffle
Overworld Entrances" on, "Randomize Warp Song Destinations" on
or "Randomize Overworld Spawns" on, Closed Forest will instead
be treated as Closed Deku with starting age Child and WILL NOT
guarantee that these items are available in the forest area.
'Open Forest': Mido no longer blocks the path to the
Deku Tree, and the Kokiri boy no longer blocks the path
out of the forest.
''',
shared = True,
disable = {
'closed' : {'settings' : ['starting_age']}
'!closed': {'settings': ['require_gohma']},
'closed': {'settings': ['starting_age']},
},
gui_params = {
'randomize_key': 'randomize_settings',
Expand All @@ -3197,6 +3195,28 @@ def __init__(self, name, gui_text, min, max, default, step=1,
],
},
),
Checkbutton(
name = 'require_gohma',
gui_text = 'Closed Forest Requires Gohma',
gui_tooltip = '''\
Defeating Queen Gohma is logically required to leave the forest
area (Kokiri Forest/Lost Woods/Sacred Forest Meadow/Deku Tree).
Items needed for this will be guaranteed inside the forest area,
and "Shuffle Dungeon Entrances" does not affect the Deku Tree.
This setting is incompatible with starting as adult, and so
Starting Age will be locked to Child. With either "Shuffle
Interior Entrances" set to "All", "Shuffle Overworld Entrances"
on, "Randomize Warp Song Destinations" on, or "Randomize Overworld
Spawns" on, this setting is automatically disabled and WILL NOT
guarantee that these items are available in the forest area.
''',
default = True,
disabled_default = False,
shared = True,
disable = {
True : {'settings' : ['open_forest', 'shuffle_interior_entrances', 'shuffle_bosses', 'shuffle_overworld_entrances', 'warp_songs', 'spawn_positions']}
},
),
Combobox(
name = 'open_kakariko',
gui_text = 'Kakariko Gate',
Expand Down Expand Up @@ -3585,6 +3605,9 @@ def __init__(self, name, gui_text, min, max, default, step=1,
When shuffling any interior entrances, trade quest timers are disabled
and items never revert, even when dying or loading a save.
''',
disable = {
'all' : {'settings': ['require_gohma']},
},
shared = True,
gui_params = {
'randomize_key': 'randomize_settings',
Expand Down Expand Up @@ -3657,6 +3680,9 @@ def __init__(self, name, gui_text, min, max, default, step=1,
'limited': 'Age-Restricted',
'full': 'Full',
},
disable = {
'!off' : {'settings': ['require_gohma']},
},
shared = True,
gui_params = {
'randomize_key': 'randomize_settings',
Expand All @@ -3681,6 +3707,9 @@ def __init__(self, name, gui_text, min, max, default, step=1,
even when dying or loading a save.
''',
default = False,
disable = {
True : {'settings': ['require_gohma']},
},
shared = True,
gui_params = {
'randomize_key': 'randomize_settings',
Expand Down Expand Up @@ -3720,6 +3749,9 @@ def __init__(self, name, gui_text, min, max, default, step=1,
Randomize where each of the 6 warp songs leads to.
''',
default = False,
disable = {
True : {'settings': ['require_gohma']},
},
shared = True,
gui_params = {
'randomize_key': 'randomize_settings',
Expand Down
15 changes: 1 addition & 14 deletions World.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ def __init__(self, id, settings, resolveRandomizedSettings=True):
self.selected_adult_trade_item = ''
self.adult_trade_starting_inventory = ''

if (
settings.open_forest == 'closed'
and (
self.shuffle_special_interior_entrances or settings.shuffle_overworld_entrances
or settings.warp_songs or settings.spawn_positions
)
):
self.settings.open_forest = 'closed_deku'

if settings.triforce_goal_per_world > settings.triforce_count_per_world:
raise ValueError("Triforces required cannot be more than the triforce count.")
self.triforce_goal = settings.triforce_goal_per_world * settings.world_count
Expand Down Expand Up @@ -419,11 +410,7 @@ def resolve_random_settings(self):
if (self.settings.starting_age == 'random'
and ('starting_age' not in dist_keys
or self.distribution.distribution.src_dict['_settings']['starting_age'] == 'random')):
if self.settings.open_forest == 'closed':
# adult is not compatible
self.settings.starting_age = 'child'
else:
self.settings.starting_age = random.choice(['child', 'adult'])
self.settings.starting_age = random.choice(['child', 'adult'])
self.randomized_list.append('starting_age')
if self.settings.chicken_count_random and 'chicken_count' not in dist_keys:
self.settings.chicken_count = random.randint(0, 7)
Expand Down
6 changes: 3 additions & 3 deletions data/Glitched World/Deku Tree MQ.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@
"region_name": "Deku Tree Boss Room",
"dungeon": "Deku Tree",
"events": {
"Deku Tree Clear": "Deku_Shield and (Kokiri_Sword or Sticks)"
"Defeat Gohma": "Deku_Shield and (Kokiri_Sword or Sticks)"
},
"locations": {
"Deku Tree MQ Before Spinning Log Chest": "True",
"Deku Tree MQ After Spinning Log Chest": "can_play(Song_of_Time)",
"Deku Tree MQ GS Basement Graves Room": "Boomerang and can_play(Song_of_Time)",
"Deku Tree MQ GS Basement Back Room": "Boomerang",
"Deku Tree MQ Deku Scrub": "True",
"Deku Tree Queen Gohma Heart": "Deku_Shield and (Kokiri_Sword or Sticks)",
"Queen Gohma": "Deku_Shield and (Kokiri_Sword or Sticks)"
"Deku Tree Queen Gohma Heart": "'Defeat Gohma'",
"Queen Gohma": "'Defeat Gohma'"
},
"exits": {
"Deku Tree Lobby": "True"
Expand Down
8 changes: 3 additions & 5 deletions data/Glitched World/Deku Tree.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,12 @@
"region_name": "Queen Gohma Boss Room",
"dungeon": "Deku Tree",
"events": {
"Deku Tree Clear": "(Nuts or can_use(Slingshot) or has_bombchus or can_use(Hookshot) or can_use(Bow) or can_use(Boomerang)) and
"Defeat Gohma": "(Nuts or can_use(Slingshot) or has_bombchus or can_use(Hookshot) or can_use(Bow) or can_use(Boomerang)) and
((here(has_shield or can_use(Megaton_Hammer)) and (is_adult or Kokiri_Sword or Sticks)) or is_adult)"
},
"locations": {
"Deku Tree Queen Gohma Heart": "(Nuts or can_use(Slingshot) or has_bombchus or can_use(Hookshot) or can_use(Bow) or can_use(Boomerang)) and
((here(has_shield or can_use(Megaton_Hammer)) and (is_adult or Kokiri_Sword or Sticks)) or is_adult)",
"Queen Gohma": "(Nuts or can_use(Slingshot) or has_bombchus or can_use(Hookshot) or can_use(Bow) or can_use(Boomerang)) and
((here(has_shield or can_use(Megaton_Hammer)) and (is_adult or Kokiri_Sword or Sticks)) or is_adult)"
"Deku Tree Queen Gohma Heart": "'Defeat Gohma'",
"Queen Gohma": "'Defeat Gohma'"
},
"exits": {
"Deku Tree Lobby": "True"
Expand Down
4 changes: 2 additions & 2 deletions data/Glitched World/Overworld.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"KF Kokiri Shop": "True",
"KF Outside Deku Tree": "'Showed Mido Sword & Shield' or Sticks or is_adult",
"Lost Woods": "True",
"LW Bridge": "can_leave_forest",
"LW Bridge": "open_forest != 'closed' or is_adult or 'Defeat Gohma'",
"KF Storms Grotto": "can_play(Song_of_Storms)"
}
},
Expand Down Expand Up @@ -192,7 +192,7 @@
"LW Gift from Saria": "True"
},
"exits": {
"Kokiri Forest": "True",
"Kokiri Forest": "True", # Walking through this entrance places Link past the Kokiri guard, so there are no restrictions for Closed Forest here
"Hyrule Field": "True"
}
},
Expand Down
2 changes: 1 addition & 1 deletion data/LogicHelpers.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"can_child_damage": "is_child and (Slingshot or Sticks or Kokiri_Sword or has_explosives or can_use(Dins_Fire))",
"can_cut_shrubs": "is_adult or Sticks or Kokiri_Sword or Boomerang or has_explosives",
"can_dive": "Progressive_Scale",
"can_leave_forest": "open_forest != 'closed' or is_adult or is_glitched or Deku_Tree_Clear",
"can_leave_forest": "is_adult or 'Defeat Gohma' or not require_gohma",
"can_plant_bugs": "is_child and Bugs",
"can_ride_epona": "is_adult and Epona and (can_play(Eponas_Song) or (is_glitched and can_hover))",
"can_stun_deku": "is_adult or (Slingshot or Boomerang or Sticks or Kokiri_Sword or has_explosives or can_use(Dins_Fire) or Nuts or Deku_Shield)",
Expand Down
4 changes: 2 additions & 2 deletions data/World/Bosses.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"Deku Tree Clear": "(Nuts or can_use(Slingshot)) and can_jumpslash"
},
"locations": {
"Deku Tree Queen Gohma Heart": "'Deku Tree Clear'",
"Queen Gohma": "'Deku Tree Clear'"
"Deku Tree Queen Gohma Heart": "'Defeat Gohma'",
"Queen Gohma": "'Defeat Gohma'"
},
"exits": {
"Deku Tree Boss Door": "True"
Expand Down
4 changes: 2 additions & 2 deletions data/World/Overworld.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"KF Kokiri Shop": "True",
"KF Outside Deku Tree": "is_adult or open_forest == 'open' or 'Showed Mido Sword & Shield'",
"Lost Woods": "True",
"LW Bridge From Forest": "can_leave_forest",
"LW Bridge From Forest": "open_forest != 'closed' or is_adult or 'Defeat Gohma'",
"KF Storms Grotto": "can_open_storm_grotto"
}
},
Expand Down Expand Up @@ -376,7 +376,7 @@
"scene": "Lost Woods",
"hint": "LOST_WOODS",
"exits": {
"Kokiri Forest": "True",
"Kokiri Forest": "True", # Walking through this entrance places Link past the Kokiri guard, so there are no restrictions for Closed Forest here
"Hyrule Field": "True",
"Lost Woods": "can_use(Longshot)"
}
Expand Down
1 change: 1 addition & 0 deletions data/settings_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
"row_span": [6,6,9],
"settings": [
"open_forest",
"require_gohma",
"open_kakariko",
"open_door_of_time",
"zora_fountain",
Expand Down

0 comments on commit de84817

Please sign in to comment.