From e846f8756985c1c57ac44d63958d67d0a457ad61 Mon Sep 17 00:00:00 2001 From: Fenhl Date: Thu, 17 Mar 2022 02:02:52 +0000 Subject: [PATCH] Separate settings for Open Deku and Open Forest --- EntranceShuffle.py | 2 +- Patches.py | 4 +- SettingsList.py | 82 +++++++++++++++++------------- World.py | 15 +----- data/Glitched World/Overworld.json | 2 +- data/LogicHelpers.json | 2 +- data/World/Overworld.json | 6 +-- data/presets_default.json | 30 +++++++---- data/settings_mapping.json | 1 + 9 files changed, 77 insertions(+), 67 deletions(-) diff --git a/EntranceShuffle.py b/EntranceShuffle.py index 3ccda9f9a..523453357 100644 --- a/EntranceShuffle.py +++ b/EntranceShuffle.py @@ -474,7 +474,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: diff --git a/Patches.py b/Patches.py index a8deb609a..d7d196de5 100644 --- a/Patches.py +++ b/Patches.py @@ -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 @@ -1249,7 +1249,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: diff --git a/SettingsList.py b/SettingsList.py index d76695fee..2cca0338c 100644 --- a/SettingsList.py +++ b/SettingsList.py @@ -2108,48 +2108,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( @@ -3028,6 +3028,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', @@ -3109,6 +3112,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', }, @@ -3135,6 +3141,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', }, @@ -3151,6 +3160,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', }, diff --git a/World.py b/World.py index 8a879b9c6..b72531c66 100644 --- a/World.py +++ b/World.py @@ -65,15 +65,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 or (settings.shuffle_bosses != 'off') - ) - ): - 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 @@ -343,11 +334,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) diff --git a/data/Glitched World/Overworld.json b/data/Glitched World/Overworld.json index 1c52c63ce..3a6ec79fa 100644 --- a/data/Glitched World/Overworld.json +++ b/data/Glitched World/Overworld.json @@ -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", diff --git a/data/LogicHelpers.json b/data/LogicHelpers.json index 32c4eb633..0ba374794 100644 --- a/data/LogicHelpers.json +++ b/data/LogicHelpers.json @@ -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)", diff --git a/data/World/Overworld.json b/data/World/Overworld.json index d9c72fcd0..750fb4d47 100644 --- a/data/World/Overworld.json +++ b/data/World/Overworld.json @@ -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" @@ -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'" } }, { diff --git a/data/presets_default.json b/data/presets_default.json index 34b39392a..3db650801 100644 --- a/data/presets_default.json +++ b/data/presets_default.json @@ -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", @@ -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", @@ -199,7 +201,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", @@ -308,7 +311,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", @@ -411,7 +415,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", @@ -524,7 +529,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", @@ -637,7 +643,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", @@ -860,7 +867,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", @@ -959,7 +967,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", @@ -1062,7 +1071,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", diff --git a/data/settings_mapping.json b/data/settings_mapping.json index aaf65b9e8..792b0e289 100644 --- a/data/settings_mapping.json +++ b/data/settings_mapping.json @@ -154,6 +154,7 @@ "text": "Open", "row_span": [6,6,9], "settings": [ + "open_deku", "open_forest", "open_kakariko", "open_door_of_time",