Skip to content

Commit

Permalink
Separate settings for Open Deku and Open Forest
Browse files Browse the repository at this point in the history
  • Loading branch information
fenhl committed Mar 17, 2022
1 parent 9076069 commit 1d37ea6
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 62 deletions.
2 changes: 1 addition & 1 deletion EntranceShuffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def shuffle_random_entrances(worlds):
# 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':
if not worlds[0].settings.open_forest:
entrance_pools['Dungeon'].remove(world.get_entrance('KF Outside Deku Tree -> Deku Tree Lobby'))

if worlds[0].shuffle_interior_entrances:
Expand Down
4 changes: 2 additions & 2 deletions Patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def patch_rom(spoiler:Spoiler, world:World, rom:Rom):
# Change Pokey to check DT complete flag
rom.write_bytes(0xE5400A, [0x8C, 0x4C])
rom.write_bytes(0xE5400E, [0xB4, 0xA4])
if world.settings.open_forest != 'closed':
if world.settings.open_forest:
rom.write_bytes(0xE5401C, [0x14, 0x0B])

# Fix Shadow Temple to check for different rewards for scene
Expand Down Expand Up @@ -1191,7 +1191,7 @@ def set_entrance_updates(entrances):
else:
rom.write_int32(symbol, 0)

if world.settings.open_forest == 'open':
if world.settings.open_deku:
save_context.write_bits(0xED5, 0x10) # "Showed Mido Sword & Shield"

if world.settings.open_door_of_time:
Expand Down
82 changes: 47 additions & 35 deletions SettingsList.py
Original file line number Diff line number Diff line change
Expand Up @@ -2076,48 +2076,48 @@ def __init__(self, name, gui_text, min, max, default, step=1,
},
shared = True,
),
Combobox(
name = 'open_forest',
gui_text = 'Forest',
default = 'closed',
choices = {
'open': 'Open Forest',
'closed_deku': 'Closed Deku',
'closed': 'Closed Forest',
},
Checkbutton(
name = 'open_deku',
gui_text = 'Open Deku Tree',
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 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.
In the child era, Mido no longer blocks the path
to the Deku Tree, so you can access the area without
requiring Kokiri Sword and Deku Shield.
If "Shuffle Dungeon Entrances" is enabled, the
Deku Tree's mouth is also open in the adult era.
''',
shared = True,
gui_params = {
'randomize_key': 'randomize_settings',
},
),
Checkbutton(
name = 'open_forest',
gui_text = 'Open Forest',
gui_tooltip = '''\
'Open Forest': The Kokiri boy no longer blocks the path out
of the forest.
'Closed Forest': Beating Deku Tree 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. 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, "Open Forest" is automatically
enabled and WILL NOT guarantee that these items are
available in the forest area.
''',
disabled_default = True,
shared = True,
disable = {
'closed' : {'settings' : ['starting_age']}
False : {'settings' : ['starting_age', 'shuffle_interior_entrances', 'shuffle_overworld_entrances', 'warp_songs', 'spawn_positions']}
},
gui_params = {
'randomize_key': 'randomize_settings',
'distribution': [
('open', 1),
('closed_deku', 1),
('closed', 1),
],
},
),
Combobox(
Expand Down Expand Up @@ -2991,6 +2991,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': ['open_forest']},
},
shared = True,
gui_params = {
'randomize_key': 'randomize_settings',
Expand Down Expand Up @@ -3049,6 +3052,9 @@ def __init__(self, name, gui_text, min, max, default, step=1,
''',
default = False,
shared = True,
disable = {
True : {'settings': ['open_forest']},
},
gui_params = {
'randomize_key': 'randomize_settings',
},
Expand All @@ -3075,6 +3081,9 @@ def __init__(self, name, gui_text, min, max, default, step=1,
''',
default = False,
shared = True,
disable = {
True : {'settings': ['open_forest']},
},
gui_params = {
'randomize_key': 'randomize_settings',
},
Expand All @@ -3091,6 +3100,9 @@ def __init__(self, name, gui_text, min, max, default, step=1,
''',
default = False,
shared = True,
disable = {
True : {'settings': ['open_forest']},
},
gui_params = {
'randomize_key': 'randomize_settings',
},
Expand Down
10 changes: 1 addition & 9 deletions World.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ def __init__(self, id, settings, resolveRandomizedSettings=True):
self.ensure_tod_access = self.shuffle_interior_entrances or settings.shuffle_overworld_entrances or settings.spawn_positions
self.disable_trade_revert = self.shuffle_interior_entrances or settings.shuffle_overworld_entrances

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 @@ -335,11 +331,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
2 changes: 1 addition & 1 deletion data/Glitched World/Overworld.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"region_name": "Kokiri Forest",
"hint": "Kokiri Forest",
"events": {
"Showed Mido Sword & Shield": "open_forest == 'open' or (is_child and Kokiri_Sword and Buy_Deku_Shield)"
"Showed Mido Sword & Shield": "open_deku or (is_child and Kokiri_Sword and Buy_Deku_Shield)"
},
"locations": {
"KF Kokiri Sword Chest": "is_child",
Expand Down
2 changes: 1 addition & 1 deletion data/LogicHelpers.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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": "open_forest or is_adult or is_glitched or Deku_Tree_Clear",
"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
6 changes: 3 additions & 3 deletions data/World/Overworld.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"KF House of Twins": "True",
"KF Know It All House": "True",
"KF Kokiri Shop": "True",
"KF Outside Deku Tree": "is_adult or open_forest == 'open' or 'Showed Mido Sword & Shield'",
"KF Outside Deku Tree": "is_adult or open_deku or 'Showed Mido Sword & Shield'",
"Lost Woods": "True",
"LW Bridge From Forest": "can_leave_forest",
"KF Storms Grotto": "can_open_storm_grotto"
Expand All @@ -128,8 +128,8 @@
"exits": {
"Deku Tree Lobby": "
is_child or
(shuffle_dungeon_entrances and (open_forest == 'open' or 'Showed Mido Sword & Shield'))",
"Kokiri Forest": "is_adult or open_forest == 'open' or 'Showed Mido Sword & Shield'"
(shuffle_dungeon_entrances and (open_deku or 'Showed Mido Sword & Shield'))",
"Kokiri Forest": "is_adult or open_deku or 'Showed Mido Sword & Shield'"
}
},
{
Expand Down
30 changes: 20 additions & 10 deletions data/presets_default.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"world_count": 1,
"randomize_settings": false,
"logic_rules": "glitchless",
"open_forest": "closed",
"open_deku": false,
"open_forest": false,
"open_kakariko": "open",
"open_door_of_time": true,
"zora_fountain": "closed",
Expand Down Expand Up @@ -90,7 +91,8 @@
"world_count": 1,
"create_spoiler": true,
"randomize_settings": false,
"open_forest": "closed_deku",
"open_deku": false,
"open_forest": true,
"open_kakariko": "open",
"open_door_of_time": true,
"zora_fountain": "closed",
Expand Down Expand Up @@ -198,7 +200,8 @@
"world_count": 1,
"create_spoiler": true,
"randomize_settings": false,
"open_forest": "open",
"open_deku": true,
"open_forest": true,
"open_kakariko": "open",
"open_door_of_time": true,
"zora_fountain": "closed",
Expand Down Expand Up @@ -306,7 +309,8 @@
"world_count": 1,
"create_spoiler": true,
"randomize_settings": false,
"open_forest": "open",
"open_deku": true,
"open_forest": true,
"open_kakariko": "closed",
"open_door_of_time": true,
"zora_fountain": "closed",
Expand Down Expand Up @@ -409,7 +413,8 @@
"world_count": 1,
"randomize_settings": false,
"logic_rules": "glitchless",
"open_forest": "open",
"open_deku": true,
"open_forest": true,
"open_kakariko": "open",
"open_door_of_time": true,
"zora_fountain": "closed",
Expand Down Expand Up @@ -522,7 +527,8 @@
"world_count": 3,
"create_spoiler": true,
"randomize_settings": false,
"open_forest": "open",
"open_deku": true,
"open_forest": true,
"open_kakariko": "open",
"open_door_of_time": true,
"zora_fountain": "closed",
Expand Down Expand Up @@ -634,7 +640,8 @@
"world_count": 1,
"randomize_settings": false,
"logic_rules": "glitchless",
"open_forest": "closed_deku",
"open_deku": false,
"open_forest": true,
"open_kakariko": "closed",
"open_door_of_time": false,
"zora_fountain": "closed",
Expand Down Expand Up @@ -856,7 +863,8 @@
"world_count": 1,
"create_spoiler": true,
"randomize_settings": false,
"open_forest": "open",
"open_deku": true,
"open_forest": true,
"open_kakariko": "closed",
"open_door_of_time": true,
"zora_fountain": "closed",
Expand Down Expand Up @@ -954,7 +962,8 @@
"world_count": 1,
"create_spoiler": false,
"randomize_settings": false,
"open_forest": "open",
"open_deku": true,
"open_forest": true,
"open_kakariko": "open",
"open_door_of_time": true,
"zora_fountain": "closed",
Expand Down Expand Up @@ -1056,7 +1065,8 @@
"world_count": 1,
"create_spoiler": false,
"randomize_settings": false,
"open_forest": "open",
"open_deku": true,
"open_forest": true,
"open_kakariko": "open",
"open_door_of_time": true,
"zora_fountain": "closed",
Expand Down
1 change: 1 addition & 0 deletions data/settings_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
"text": "Open",
"row_span": [6,6,9],
"settings": [
"open_deku",
"open_forest",
"open_kakariko",
"open_door_of_time",
Expand Down

0 comments on commit 1d37ea6

Please sign in to comment.