diff --git a/worlds/tunic/__init__.py b/worlds/tunic/__init__.py index bbffd9c1440e..cdd968acce44 100644 --- a/worlds/tunic/__init__.py +++ b/worlds/tunic/__init__.py @@ -7,8 +7,9 @@ from .er_rules import set_er_location_rules from .regions import tunic_regions from .er_scripts import create_er_regions -from .er_data import portal_mapping -from .options import TunicOptions, EntranceRando, tunic_option_groups, tunic_option_presets, TunicPlandoConnections +from .er_data import portal_mapping, RegionInfo, tunic_er_regions +from .options import (TunicOptions, EntranceRando, tunic_option_groups, tunic_option_presets, TunicPlandoConnections, + LaurelsLocation, LogicRules, LaurelsZips, IceGrappling, LadderStorage) from worlds.AutoWorld import WebWorld, World from Options import PlandoConnection from decimal import Decimal, ROUND_HALF_UP @@ -48,10 +49,12 @@ class TunicLocation(Location): class SeedGroup(TypedDict): - logic_rules: int # logic rules value + laurels_zips: bool # laurels_zips value + ice_grappling: int # ice_grappling value + ladder_storage: int # ls value laurels_at_10_fairies: bool # laurels location value fixed_shop: bool # fixed shop value - plando: TunicPlandoConnections # consolidated of plando connections for the seed group + plando: TunicPlandoConnections # consolidated plando connections for the seed group class TunicWorld(World): @@ -77,8 +80,17 @@ class TunicWorld(World): tunic_portal_pairs: Dict[str, str] er_portal_hints: Dict[int, str] seed_groups: Dict[str, SeedGroup] = {} + shop_num: int = 1 # need to make it so that you can walk out of shops, but also that they aren't all connected + er_regions: Dict[str, RegionInfo] # absolutely needed so outlet regions work def generate_early(self) -> None: + if self.options.logic_rules >= LogicRules.option_no_major_glitches: + self.options.laurels_zips.value = LaurelsZips.option_true + self.options.ice_grappling.value = IceGrappling.option_medium + if self.options.logic_rules.value == LogicRules.option_unrestricted: + self.options.ladder_storage.value = LadderStorage.option_medium + + self.er_regions = tunic_er_regions.copy() if self.options.plando_connections: for index, cxn in enumerate(self.options.plando_connections): # making shops second to simplify other things later @@ -99,7 +111,10 @@ def generate_early(self) -> None: self.options.keys_behind_bosses.value = passthrough["keys_behind_bosses"] self.options.sword_progression.value = passthrough["sword_progression"] self.options.ability_shuffling.value = passthrough["ability_shuffling"] - self.options.logic_rules.value = passthrough["logic_rules"] + self.options.laurels_zips.value = passthrough["laurels_zips"] + self.options.ice_grappling.value = passthrough["ice_grappling"] + self.options.ladder_storage.value = passthrough["ladder_storage"] + self.options.ladder_storage_without_items = passthrough["ladder_storage_without_items"] self.options.lanternless.value = passthrough["lanternless"] self.options.maskless.value = passthrough["maskless"] self.options.hexagon_quest.value = passthrough["hexagon_quest"] @@ -118,19 +133,28 @@ def stage_generate_early(cls, multiworld: MultiWorld) -> None: group = tunic.options.entrance_rando.value # if this is the first world in the group, set the rules equal to its rules if group not in cls.seed_groups: - cls.seed_groups[group] = SeedGroup(logic_rules=tunic.options.logic_rules.value, - laurels_at_10_fairies=tunic.options.laurels_location == 3, - fixed_shop=bool(tunic.options.fixed_shop), - plando=tunic.options.plando_connections) + cls.seed_groups[group] = \ + SeedGroup(laurels_zips=bool(tunic.options.laurels_zips), + ice_grappling=tunic.options.ice_grappling.value, + ladder_storage=tunic.options.ladder_storage.value, + laurels_at_10_fairies=tunic.options.laurels_location == LaurelsLocation.option_10_fairies, + fixed_shop=bool(tunic.options.fixed_shop), + plando=tunic.options.plando_connections) continue - + + # off is more restrictive + if not tunic.options.laurels_zips: + cls.seed_groups[group]["laurels_zips"] = False + # lower value is more restrictive + if tunic.options.ice_grappling < cls.seed_groups[group]["ice_grappling"]: + cls.seed_groups[group]["ice_grappling"] = tunic.options.ice_grappling.value # lower value is more restrictive - if tunic.options.logic_rules.value < cls.seed_groups[group]["logic_rules"]: - cls.seed_groups[group]["logic_rules"] = tunic.options.logic_rules.value + if tunic.options.ladder_storage.value < cls.seed_groups[group]["ladder_storage"]: + cls.seed_groups[group]["ladder_storage"] = tunic.options.ladder_storage.value # laurels at 10 fairies changes logic for secret gathering place placement if tunic.options.laurels_location == 3: cls.seed_groups[group]["laurels_at_10_fairies"] = True - # fewer shops, one at windmill + # more restrictive, overrides the option for others in the same group, which is better than failing imo if tunic.options.fixed_shop: cls.seed_groups[group]["fixed_shop"] = True @@ -366,7 +390,10 @@ def fill_slot_data(self) -> Dict[str, Any]: "ability_shuffling": self.options.ability_shuffling.value, "hexagon_quest": self.options.hexagon_quest.value, "fool_traps": self.options.fool_traps.value, - "logic_rules": self.options.logic_rules.value, + "laurels_zips": self.options.laurels_zips.value, + "ice_grappling": self.options.ice_grappling.value, + "ladder_storage": self.options.ladder_storage.value, + "ladder_storage_without_items": self.options.ladder_storage_without_items.value, "lanternless": self.options.lanternless.value, "maskless": self.options.maskless.value, "entrance_rando": int(bool(self.options.entrance_rando.value)), diff --git a/worlds/tunic/docs/en_TUNIC.md b/worlds/tunic/docs/en_TUNIC.md index 27df4ce38be4..b2e1a71897c0 100644 --- a/worlds/tunic/docs/en_TUNIC.md +++ b/worlds/tunic/docs/en_TUNIC.md @@ -83,8 +83,6 @@ Notes: - The `direction` field is not supported. Connections are always coupled. - For a list of entrance names, check `er_data.py` in the TUNIC world folder or generate a game with the Entrance Randomizer option enabled and check the spoiler log. - There is no limit to the number of Shops you can plando. -- If you have more than one shop in a scene, you may be wrong warped when exiting a shop. -- If you have a shop in every scene, and you have an odd number of shops, it will error out. See the [Archipelago Plando Guide](../../../tutorial/Archipelago/plando/en) for more information on Plando and Connection Plando. diff --git a/worlds/tunic/er_data.py b/worlds/tunic/er_data.py index 6316292e564e..343bf3055378 100644 --- a/worlds/tunic/er_data.py +++ b/worlds/tunic/er_data.py @@ -1,6 +1,9 @@ -from typing import Dict, NamedTuple, List +from typing import Dict, NamedTuple, List, TYPE_CHECKING, Optional from enum import IntEnum +if TYPE_CHECKING: + from . import TunicWorld + class Portal(NamedTuple): name: str # human-readable name @@ -9,6 +12,8 @@ class Portal(NamedTuple): tag: str # vanilla tag def scene(self) -> str: # the actual scene name in Tunic + if self.region.startswith("Shop"): + return tunic_er_regions["Shop"].game_scene return tunic_er_regions[self.region].game_scene def scene_destination(self) -> str: # full, nonchanging name to interpret by the mod @@ -458,7 +463,7 @@ def destination_scene(self) -> str: # the vanilla connection Portal(name="Cathedral Main Exit", region="Cathedral", destination="Swamp Redux 2", tag="_main"), - Portal(name="Cathedral Elevator", region="Cathedral", + Portal(name="Cathedral Elevator", region="Cathedral to Gauntlet", destination="Cathedral Arena", tag="_"), Portal(name="Cathedral Secret Legend Room Exit", region="Cathedral Secret Legend Room", destination="Swamp Redux 2", tag="_secret"), @@ -517,6 +522,13 @@ def destination_scene(self) -> str: # the vanilla connection class RegionInfo(NamedTuple): game_scene: str # the name of the scene in the actual game dead_end: int = 0 # if a region has only one exit + outlet_region: Optional[str] = None + is_fake_region: bool = False + + +# gets the outlet region name if it exists, the region if it doesn't +def get_portal_outlet_region(portal: Portal, world: "TunicWorld") -> str: + return world.er_regions[portal.region].outlet_region or portal.region class DeadEnd(IntEnum): @@ -558,11 +570,11 @@ class DeadEnd(IntEnum): "Overworld Ruined Passage Door": RegionInfo("Overworld Redux"), # the small space betweeen the door and the portal "Overworld Old House Door": RegionInfo("Overworld Redux"), # the too-small space between the door and the portal "Overworld Southeast Cross Door": RegionInfo("Overworld Redux"), # the small space betweeen the door and the portal - "Overworld Fountain Cross Door": RegionInfo("Overworld Redux"), # the small space between the door and the portal + "Overworld Fountain Cross Door": RegionInfo("Overworld Redux", outlet_region="Overworld"), "Overworld Temple Door": RegionInfo("Overworld Redux"), # the small space betweeen the door and the portal - "Overworld Town Portal": RegionInfo("Overworld Redux"), # being able to go to or come from the portal - "Overworld Spawn Portal": RegionInfo("Overworld Redux"), # being able to go to or come from the portal - "Cube Cave Entrance Region": RegionInfo("Overworld Redux"), # other side of the bomb wall + "Overworld Town Portal": RegionInfo("Overworld Redux", outlet_region="Overworld"), + "Overworld Spawn Portal": RegionInfo("Overworld Redux", outlet_region="Overworld"), + "Cube Cave Entrance Region": RegionInfo("Overworld Redux", outlet_region="Overworld"), # other side of the bomb wall "Stick House": RegionInfo("Sword Cave", dead_end=DeadEnd.all_cats), "Windmill": RegionInfo("Windmill"), "Old House Back": RegionInfo("Overworld Interiors"), # part with the hc door @@ -591,7 +603,7 @@ class DeadEnd(IntEnum): "Forest Belltower Lower": RegionInfo("Forest Belltower"), "East Forest": RegionInfo("East Forest Redux"), "East Forest Dance Fox Spot": RegionInfo("East Forest Redux"), - "East Forest Portal": RegionInfo("East Forest Redux"), + "East Forest Portal": RegionInfo("East Forest Redux", outlet_region="East Forest"), "Lower Forest": RegionInfo("East Forest Redux"), # bottom of the forest "Guard House 1 East": RegionInfo("East Forest Redux Laddercave"), "Guard House 1 West": RegionInfo("East Forest Redux Laddercave"), @@ -601,7 +613,7 @@ class DeadEnd(IntEnum): "Forest Grave Path Main": RegionInfo("Sword Access"), "Forest Grave Path Upper": RegionInfo("Sword Access"), "Forest Grave Path by Grave": RegionInfo("Sword Access"), - "Forest Hero's Grave": RegionInfo("Sword Access"), + "Forest Hero's Grave": RegionInfo("Sword Access", outlet_region="Forest Grave Path by Grave"), "Dark Tomb Entry Point": RegionInfo("Crypt Redux"), # both upper exits "Dark Tomb Upper": RegionInfo("Crypt Redux"), # the part with the casket and the top of the ladder "Dark Tomb Main": RegionInfo("Crypt Redux"), @@ -614,18 +626,19 @@ class DeadEnd(IntEnum): "Beneath the Well Back": RegionInfo("Sewer"), # the back two portals, and all 4 upper chests "West Garden": RegionInfo("Archipelagos Redux"), "Magic Dagger House": RegionInfo("archipelagos_house", dead_end=DeadEnd.all_cats), - "West Garden Portal": RegionInfo("Archipelagos Redux", dead_end=DeadEnd.restricted), + "West Garden Portal": RegionInfo("Archipelagos Redux", dead_end=DeadEnd.restricted, outlet_region="West Garden by Portal"), + "West Garden by Portal": RegionInfo("Archipelagos Redux", dead_end=DeadEnd.restricted), "West Garden Portal Item": RegionInfo("Archipelagos Redux", dead_end=DeadEnd.restricted), "West Garden Laurels Exit Region": RegionInfo("Archipelagos Redux"), "West Garden after Boss": RegionInfo("Archipelagos Redux"), - "West Garden Hero's Grave Region": RegionInfo("Archipelagos Redux"), + "West Garden Hero's Grave Region": RegionInfo("Archipelagos Redux", outlet_region="West Garden"), "Ruined Atoll": RegionInfo("Atoll Redux"), "Ruined Atoll Lower Entry Area": RegionInfo("Atoll Redux"), "Ruined Atoll Ladder Tops": RegionInfo("Atoll Redux"), # at the top of the 5 ladders in south Atoll "Ruined Atoll Frog Mouth": RegionInfo("Atoll Redux"), "Ruined Atoll Frog Eye": RegionInfo("Atoll Redux"), - "Ruined Atoll Portal": RegionInfo("Atoll Redux"), - "Ruined Atoll Statue": RegionInfo("Atoll Redux"), + "Ruined Atoll Portal": RegionInfo("Atoll Redux", outlet_region="Ruined Atoll"), + "Ruined Atoll Statue": RegionInfo("Atoll Redux", outlet_region="Ruined Atoll"), "Frog Stairs Eye Exit": RegionInfo("Frog Stairs"), "Frog Stairs Upper": RegionInfo("Frog Stairs"), "Frog Stairs Lower": RegionInfo("Frog Stairs"), @@ -633,18 +646,20 @@ class DeadEnd(IntEnum): "Frog's Domain Entry": RegionInfo("frog cave main"), "Frog's Domain": RegionInfo("frog cave main"), "Frog's Domain Back": RegionInfo("frog cave main"), - "Library Exterior Tree Region": RegionInfo("Library Exterior"), + "Library Exterior Tree Region": RegionInfo("Library Exterior", outlet_region="Library Exterior by Tree"), + "Library Exterior by Tree": RegionInfo("Library Exterior"), "Library Exterior Ladder Region": RegionInfo("Library Exterior"), "Library Hall Bookshelf": RegionInfo("Library Hall"), "Library Hall": RegionInfo("Library Hall"), - "Library Hero's Grave Region": RegionInfo("Library Hall"), + "Library Hero's Grave Region": RegionInfo("Library Hall", outlet_region="Library Hall"), "Library Hall to Rotunda": RegionInfo("Library Hall"), "Library Rotunda to Hall": RegionInfo("Library Rotunda"), "Library Rotunda": RegionInfo("Library Rotunda"), "Library Rotunda to Lab": RegionInfo("Library Rotunda"), "Library Lab": RegionInfo("Library Lab"), "Library Lab Lower": RegionInfo("Library Lab"), - "Library Portal": RegionInfo("Library Lab"), + "Library Portal": RegionInfo("Library Lab", outlet_region="Library Lab on Portal Pad"), + "Library Lab on Portal Pad": RegionInfo("Library Lab"), "Library Lab to Librarian": RegionInfo("Library Lab"), "Library Arena": RegionInfo("Library Arena", dead_end=DeadEnd.all_cats), "Fortress Exterior from East Forest": RegionInfo("Fortress Courtyard"), @@ -663,22 +678,22 @@ class DeadEnd(IntEnum): "Fortress Grave Path": RegionInfo("Fortress Reliquary"), "Fortress Grave Path Upper": RegionInfo("Fortress Reliquary", dead_end=DeadEnd.restricted), "Fortress Grave Path Dusty Entrance Region": RegionInfo("Fortress Reliquary"), - "Fortress Hero's Grave Region": RegionInfo("Fortress Reliquary"), + "Fortress Hero's Grave Region": RegionInfo("Fortress Reliquary", outlet_region="Fortress Grave Path"), "Fortress Leaf Piles": RegionInfo("Dusty", dead_end=DeadEnd.all_cats), "Fortress Arena": RegionInfo("Fortress Arena"), - "Fortress Arena Portal": RegionInfo("Fortress Arena"), + "Fortress Arena Portal": RegionInfo("Fortress Arena", outlet_region="Fortress Arena"), "Lower Mountain": RegionInfo("Mountain"), "Lower Mountain Stairs": RegionInfo("Mountain"), "Top of the Mountain": RegionInfo("Mountaintop", dead_end=DeadEnd.all_cats), "Quarry Connector": RegionInfo("Darkwoods Tunnel"), "Quarry Entry": RegionInfo("Quarry Redux"), "Quarry": RegionInfo("Quarry Redux"), - "Quarry Portal": RegionInfo("Quarry Redux"), + "Quarry Portal": RegionInfo("Quarry Redux", outlet_region="Quarry Entry"), "Quarry Back": RegionInfo("Quarry Redux"), "Quarry Monastery Entry": RegionInfo("Quarry Redux"), "Monastery Front": RegionInfo("Monastery"), "Monastery Back": RegionInfo("Monastery"), - "Monastery Hero's Grave Region": RegionInfo("Monastery"), + "Monastery Hero's Grave Region": RegionInfo("Monastery", outlet_region="Monastery Back"), "Monastery Rope": RegionInfo("Quarry Redux"), "Lower Quarry": RegionInfo("Quarry Redux"), "Even Lower Quarry": RegionInfo("Quarry Redux"), @@ -691,19 +706,21 @@ class DeadEnd(IntEnum): "Rooted Ziggurat Middle Bottom": RegionInfo("ziggurat2020_2"), "Rooted Ziggurat Lower Front": RegionInfo("ziggurat2020_3"), # the vanilla entry point side "Rooted Ziggurat Lower Back": RegionInfo("ziggurat2020_3"), # the boss side - "Zig Skip Exit": RegionInfo("ziggurat2020_3", dead_end=DeadEnd.special), # the exit from zig skip, for use with fixed shop on - "Rooted Ziggurat Portal Room Entrance": RegionInfo("ziggurat2020_3"), # the door itself on the zig 3 side - "Rooted Ziggurat Portal": RegionInfo("ziggurat2020_FTRoom"), + "Zig Skip Exit": RegionInfo("ziggurat2020_3", dead_end=DeadEnd.special, outlet_region="Rooted Ziggurat Lower Front"), # the exit from zig skip, for use with fixed shop on + "Rooted Ziggurat Portal Room Entrance": RegionInfo("ziggurat2020_3", outlet_region="Rooted Ziggurat Lower Back"), # the door itself on the zig 3 side + "Rooted Ziggurat Portal": RegionInfo("ziggurat2020_FTRoom", outlet_region="Rooted Ziggurat Portal Room"), + "Rooted Ziggurat Portal Room": RegionInfo("ziggurat2020_FTRoom"), "Rooted Ziggurat Portal Room Exit": RegionInfo("ziggurat2020_FTRoom"), "Swamp Front": RegionInfo("Swamp Redux 2"), # from the main entry to the top of the ladder after south "Swamp Mid": RegionInfo("Swamp Redux 2"), # from the bottom of the ladder to the cathedral door "Swamp Ledge under Cathedral Door": RegionInfo("Swamp Redux 2"), # the ledge with the chest and secret door - "Swamp to Cathedral Treasure Room": RegionInfo("Swamp Redux 2"), # just the door + "Swamp to Cathedral Treasure Room": RegionInfo("Swamp Redux 2", outlet_region="Swamp Ledge under Cathedral Door"), # just the door "Swamp to Cathedral Main Entrance Region": RegionInfo("Swamp Redux 2"), # just the door "Back of Swamp": RegionInfo("Swamp Redux 2"), # the area with hero grave and gauntlet entrance - "Swamp Hero's Grave Region": RegionInfo("Swamp Redux 2"), + "Swamp Hero's Grave Region": RegionInfo("Swamp Redux 2", outlet_region="Back of Swamp"), "Back of Swamp Laurels Area": RegionInfo("Swamp Redux 2"), # the spots you need laurels to traverse "Cathedral": RegionInfo("Cathedral Redux"), + "Cathedral to Gauntlet": RegionInfo("Cathedral Redux"), # the elevator "Cathedral Secret Legend Room": RegionInfo("Cathedral Redux", dead_end=DeadEnd.all_cats), "Cathedral Gauntlet Checkpoint": RegionInfo("Cathedral Arena"), "Cathedral Gauntlet": RegionInfo("Cathedral Arena"), @@ -711,10 +728,10 @@ class DeadEnd(IntEnum): "Far Shore": RegionInfo("Transit"), "Far Shore to Spawn Region": RegionInfo("Transit"), "Far Shore to East Forest Region": RegionInfo("Transit"), - "Far Shore to Quarry Region": RegionInfo("Transit"), - "Far Shore to Fortress Region": RegionInfo("Transit"), - "Far Shore to Library Region": RegionInfo("Transit"), - "Far Shore to West Garden Region": RegionInfo("Transit"), + "Far Shore to Quarry Region": RegionInfo("Transit", outlet_region="Far Shore"), + "Far Shore to Fortress Region": RegionInfo("Transit", outlet_region="Far Shore"), + "Far Shore to Library Region": RegionInfo("Transit", outlet_region="Far Shore"), + "Far Shore to West Garden Region": RegionInfo("Transit", outlet_region="Far Shore"), "Hero Relic - Fortress": RegionInfo("RelicVoid", dead_end=DeadEnd.all_cats), "Hero Relic - Quarry": RegionInfo("RelicVoid", dead_end=DeadEnd.all_cats), "Hero Relic - West Garden": RegionInfo("RelicVoid", dead_end=DeadEnd.all_cats), @@ -728,6 +745,16 @@ class DeadEnd(IntEnum): } +# this is essentially a pared down version of the region connections in rules.py, with some minor differences +# the main purpose of this is to make it so that you can access every region +# most items are excluded from the rules here, since we can assume Archipelago will properly place them +# laurels (hyperdash) can be locked at 10 fairies, requiring access to secret gathering place +# so until secret gathering place has been paired, you do not have hyperdash, so you cannot use hyperdash entrances +# Zip means you need the laurels zips option enabled +# IG# refers to ice grappling difficulties +# LS# refers to ladder storage difficulties +# LS rules are used for region connections here regardless of whether you have being knocked out of the air in logic +# this is because it just means you can reach the entrances in that region via ladder storage traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = { "Overworld": { "Overworld Beach": @@ -735,13 +762,13 @@ class DeadEnd(IntEnum): "Overworld to Atoll Upper": [["Hyperdash"]], "Overworld Belltower": - [["Hyperdash"], ["UR"]], + [["Hyperdash"], ["LS1"]], "Overworld Swamp Upper Entry": - [["Hyperdash"], ["UR"]], + [["Hyperdash"], ["LS1"]], "Overworld Swamp Lower Entry": [], "Overworld Special Shop Entry": - [["Hyperdash"], ["UR"]], + [["Hyperdash"], ["LS1"]], "Overworld Well Ladder": [], "Overworld Ruined Passage Door": @@ -759,11 +786,11 @@ class DeadEnd(IntEnum): "Overworld after Envoy": [], "Overworld Quarry Entry": - [["NMG"]], + [["IG2"], ["LS1"]], "Overworld Tunnel Turret": - [["NMG"], ["Hyperdash"]], + [["IG1"], ["LS1"], ["Hyperdash"]], "Overworld Temple Door": - [["NMG"], ["Forest Belltower Upper", "Overworld Belltower"]], + [["IG2"], ["LS3"], ["Forest Belltower Upper", "Overworld Belltower"]], "Overworld Southeast Cross Door": [], "Overworld Fountain Cross Door": @@ -773,25 +800,28 @@ class DeadEnd(IntEnum): "Overworld Spawn Portal": [], "Overworld Well to Furnace Rail": - [["UR"]], + [["LS2"]], "Overworld Old House Door": [], "Cube Cave Entrance Region": [], + # drop a rudeling, icebolt or ice bomb + "Overworld to West Garden from Furnace": + [["IG3"]], }, "East Overworld": { "Above Ruined Passage": [], "After Ruined Passage": - [["NMG"]], - "Overworld": - [], + [["IG1"], ["LS1"]], + # "Overworld": + # [], "Overworld at Patrol Cave": [], "Overworld above Patrol Cave": [], "Overworld Special Shop Entry": - [["Hyperdash"], ["UR"]] + [["Hyperdash"], ["LS1"]] }, "Overworld Special Shop Entry": { "East Overworld": @@ -800,8 +830,8 @@ class DeadEnd(IntEnum): "Overworld Belltower": { "Overworld Belltower at Bell": [], - "Overworld": - [], + # "Overworld": + # [], "Overworld to West Garden Upper": [], }, @@ -809,19 +839,19 @@ class DeadEnd(IntEnum): "Overworld Belltower": [], }, - "Overworld Swamp Upper Entry": { - "Overworld": - [], - }, - "Overworld Swamp Lower Entry": { - "Overworld": - [], - }, + # "Overworld Swamp Upper Entry": { + # "Overworld": + # [], + # }, + # "Overworld Swamp Lower Entry": { + # "Overworld": + # [], + # }, "Overworld Beach": { - "Overworld": - [], + # "Overworld": + # [], "Overworld West Garden Laurels Entry": - [["Hyperdash"]], + [["Hyperdash"], ["LS1"]], "Overworld to Atoll Upper": [], "Overworld Tunnel Turret": @@ -832,38 +862,37 @@ class DeadEnd(IntEnum): [["Hyperdash"]], }, "Overworld to Atoll Upper": { - "Overworld": - [], + # "Overworld": + # [], "Overworld Beach": [], }, "Overworld Tunnel Turret": { - "Overworld": - [], + # "Overworld": + # [], "Overworld Beach": [], }, "Overworld Well Ladder": { - "Overworld": - [], + # "Overworld": + # [], }, "Overworld at Patrol Cave": { "East Overworld": - [["Hyperdash"]], + [["Hyperdash"], ["LS1"], ["IG1"]], "Overworld above Patrol Cave": [], }, "Overworld above Patrol Cave": { - "Overworld": - [], + # "Overworld": + # [], "East Overworld": [], "Upper Overworld": [], "Overworld at Patrol Cave": [], - "Overworld Belltower at Bell": - [["NMG"]], + # readd long dong if we ever do a misc tricks option }, "Upper Overworld": { "Overworld above Patrol Cave": @@ -878,51 +907,49 @@ class DeadEnd(IntEnum): [], }, "Overworld above Quarry Entrance": { - "Overworld": - [], + # "Overworld": + # [], "Upper Overworld": [], }, "Overworld Quarry Entry": { "Overworld after Envoy": [], - "Overworld": - [["NMG"]], + # "Overworld": + # [["IG1"]], }, "Overworld after Envoy": { - "Overworld": - [], + # "Overworld": + # [], "Overworld Quarry Entry": [], }, "After Ruined Passage": { - "Overworld": - [], + # "Overworld": + # [], "Above Ruined Passage": [], - "East Overworld": - [["NMG"]], }, "Above Ruined Passage": { - "Overworld": - [], + # "Overworld": + # [], "After Ruined Passage": [], "East Overworld": [], }, - "Overworld Ruined Passage Door": { - "Overworld": - [["Hyperdash", "NMG"]], - }, - "Overworld Town Portal": { - "Overworld": - [], - }, - "Overworld Spawn Portal": { - "Overworld": - [], - }, + # "Overworld Ruined Passage Door": { + # "Overworld": + # [["Hyperdash", "Zip"]], + # }, + # "Overworld Town Portal": { + # "Overworld": + # [], + # }, + # "Overworld Spawn Portal": { + # "Overworld": + # [], + # }, "Cube Cave Entrance Region": { "Overworld": [], @@ -933,7 +960,7 @@ class DeadEnd(IntEnum): }, "Old House Back": { "Old House Front": - [["Hyperdash", "NMG"]], + [["Hyperdash", "Zip"]], }, "Furnace Fuse": { "Furnace Ladder Area": @@ -941,9 +968,9 @@ class DeadEnd(IntEnum): }, "Furnace Ladder Area": { "Furnace Fuse": - [["Hyperdash"], ["UR"]], + [["Hyperdash"], ["LS1"]], "Furnace Walking Path": - [["Hyperdash"], ["UR"]], + [["Hyperdash"], ["LS1"]], }, "Furnace Walking Path": { "Furnace Ladder Area": @@ -971,7 +998,7 @@ class DeadEnd(IntEnum): }, "East Forest": { "East Forest Dance Fox Spot": - [["Hyperdash"], ["NMG"]], + [["Hyperdash"], ["IG1"], ["LS1"]], "East Forest Portal": [], "Lower Forest": @@ -979,7 +1006,7 @@ class DeadEnd(IntEnum): }, "East Forest Dance Fox Spot": { "East Forest": - [["Hyperdash"], ["NMG"]], + [["Hyperdash"], ["IG1"]], }, "East Forest Portal": { "East Forest": @@ -995,7 +1022,7 @@ class DeadEnd(IntEnum): }, "Guard House 1 West": { "Guard House 1 East": - [["Hyperdash"], ["UR"]], + [["Hyperdash"], ["LS1"]], }, "Guard House 2 Upper": { "Guard House 2 Lower": @@ -1007,19 +1034,19 @@ class DeadEnd(IntEnum): }, "Forest Grave Path Main": { "Forest Grave Path Upper": - [["Hyperdash"], ["UR"]], + [["Hyperdash"], ["LS2"], ["IG3"]], "Forest Grave Path by Grave": [], }, "Forest Grave Path Upper": { "Forest Grave Path Main": - [["Hyperdash"], ["NMG"]], + [["Hyperdash"], ["IG1"]], }, "Forest Grave Path by Grave": { "Forest Hero's Grave": [], "Forest Grave Path Main": - [["NMG"]], + [["IG1"]], }, "Forest Hero's Grave": { "Forest Grave Path by Grave": @@ -1051,7 +1078,7 @@ class DeadEnd(IntEnum): }, "Dark Tomb Checkpoint": { "Well Boss": - [["Hyperdash", "NMG"]], + [["Hyperdash", "Zip"]], }, "Dark Tomb Entry Point": { "Dark Tomb Upper": @@ -1075,13 +1102,13 @@ class DeadEnd(IntEnum): }, "West Garden": { "West Garden Laurels Exit Region": - [["Hyperdash"], ["UR"]], + [["Hyperdash"], ["LS1"]], "West Garden after Boss": [], "West Garden Hero's Grave Region": [], "West Garden Portal Item": - [["NMG"]], + [["IG2"]], }, "West Garden Laurels Exit Region": { "West Garden": @@ -1093,13 +1120,19 @@ class DeadEnd(IntEnum): }, "West Garden Portal Item": { "West Garden": - [["NMG"]], - "West Garden Portal": - [["Hyperdash", "West Garden"]], + [["IG1"]], + "West Garden by Portal": + [["Hyperdash"]], }, - "West Garden Portal": { + "West Garden by Portal": { "West Garden Portal Item": [["Hyperdash"]], + "West Garden Portal": + [["West Garden"]], + }, + "West Garden Portal": { + "West Garden by Portal": + [], }, "West Garden Hero's Grave Region": { "West Garden": @@ -1107,7 +1140,7 @@ class DeadEnd(IntEnum): }, "Ruined Atoll": { "Ruined Atoll Lower Entry Area": - [["Hyperdash"], ["UR"]], + [["Hyperdash"], ["LS1"]], "Ruined Atoll Ladder Tops": [], "Ruined Atoll Frog Mouth": @@ -1174,11 +1207,17 @@ class DeadEnd(IntEnum): [], }, "Library Exterior Ladder Region": { + "Library Exterior by Tree": + [], + }, + "Library Exterior by Tree": { "Library Exterior Tree Region": [], + "Library Exterior Ladder Region": + [], }, "Library Exterior Tree Region": { - "Library Exterior Ladder Region": + "Library Exterior by Tree": [], }, "Library Hall Bookshelf": { @@ -1223,15 +1262,21 @@ class DeadEnd(IntEnum): "Library Lab": { "Library Lab Lower": [["Hyperdash"]], - "Library Portal": + "Library Lab on Portal Pad": [], "Library Lab to Librarian": [], }, - "Library Portal": { + "Library Lab on Portal Pad": { + "Library Portal": + [], "Library Lab": [], }, + "Library Portal": { + "Library Lab on Portal Pad": + [], + }, "Library Lab to Librarian": { "Library Lab": [], @@ -1240,11 +1285,9 @@ class DeadEnd(IntEnum): "Fortress Exterior from Overworld": [], "Fortress Courtyard Upper": - [["UR"]], - "Fortress Exterior near cave": - [["UR"]], + [["LS2"]], "Fortress Courtyard": - [["UR"]], + [["LS1"]], }, "Fortress Exterior from Overworld": { "Fortress Exterior from East Forest": @@ -1252,15 +1295,15 @@ class DeadEnd(IntEnum): "Fortress Exterior near cave": [], "Fortress Courtyard": - [["Hyperdash"], ["NMG"]], + [["Hyperdash"], ["IG1"], ["LS1"]], }, "Fortress Exterior near cave": { "Fortress Exterior from Overworld": - [["Hyperdash"], ["UR"]], - "Fortress Courtyard": - [["UR"]], + [["Hyperdash"], ["LS1"]], + "Fortress Courtyard": # ice grapple hard: shoot far fire pot, it aggros one of the enemies over to you + [["IG3"], ["LS1"]], "Fortress Courtyard Upper": - [["UR"]], + [["LS2"]], "Beneath the Vault Entry": [], }, @@ -1270,7 +1313,7 @@ class DeadEnd(IntEnum): }, "Fortress Courtyard": { "Fortress Courtyard Upper": - [["NMG"]], + [["IG1"]], "Fortress Exterior from Overworld": [["Hyperdash"]], }, @@ -1296,7 +1339,7 @@ class DeadEnd(IntEnum): }, "Fortress East Shortcut Lower": { "Fortress East Shortcut Upper": - [["NMG"]], + [["IG1"]], }, "Fortress East Shortcut Upper": { "Fortress East Shortcut Lower": @@ -1304,11 +1347,11 @@ class DeadEnd(IntEnum): }, "Eastern Vault Fortress": { "Eastern Vault Fortress Gold Door": - [["NMG"], ["Fortress Exterior from Overworld", "Beneath the Vault Back", "Fortress Courtyard Upper"]], + [["IG2"], ["Fortress Exterior from Overworld", "Beneath the Vault Back", "Fortress Courtyard Upper"]], }, "Eastern Vault Fortress Gold Door": { "Eastern Vault Fortress": - [["NMG"]], + [["IG1"]], }, "Fortress Grave Path": { "Fortress Hero's Grave Region": @@ -1318,7 +1361,7 @@ class DeadEnd(IntEnum): }, "Fortress Grave Path Upper": { "Fortress Grave Path": - [["NMG"]], + [["IG1"]], }, "Fortress Grave Path Dusty Entrance Region": { "Fortress Grave Path": @@ -1346,7 +1389,7 @@ class DeadEnd(IntEnum): }, "Monastery Back": { "Monastery Front": - [["Hyperdash", "NMG"]], + [["Hyperdash", "Zip"]], "Monastery Hero's Grave Region": [], }, @@ -1363,6 +1406,8 @@ class DeadEnd(IntEnum): [["Quarry Connector"]], "Quarry": [], + "Monastery Rope": + [["LS2"]], }, "Quarry Portal": { "Quarry Entry": @@ -1374,7 +1419,7 @@ class DeadEnd(IntEnum): "Quarry Back": [["Hyperdash"]], "Monastery Rope": - [["UR"]], + [["LS2"]], }, "Quarry Back": { "Quarry": @@ -1392,7 +1437,7 @@ class DeadEnd(IntEnum): "Quarry Monastery Entry": [], "Lower Quarry Zig Door": - [["NMG"]], + [["IG3"]], }, "Lower Quarry": { "Even Lower Quarry": @@ -1402,7 +1447,7 @@ class DeadEnd(IntEnum): "Lower Quarry": [], "Lower Quarry Zig Door": - [["Quarry", "Quarry Connector"], ["NMG"]], + [["Quarry", "Quarry Connector"], ["IG3"]], }, "Monastery Rope": { "Quarry Back": @@ -1430,7 +1475,7 @@ class DeadEnd(IntEnum): }, "Rooted Ziggurat Lower Back": { "Rooted Ziggurat Lower Front": - [["Hyperdash"], ["UR"]], + [["Hyperdash"], ["LS2"], ["IG1"]], "Rooted Ziggurat Portal Room Entrance": [], }, @@ -1443,26 +1488,35 @@ class DeadEnd(IntEnum): [], }, "Rooted Ziggurat Portal Room Exit": { - "Rooted Ziggurat Portal": + "Rooted Ziggurat Portal Room": [], }, - "Rooted Ziggurat Portal": { + "Rooted Ziggurat Portal Room": { + "Rooted Ziggurat Portal": + [], "Rooted Ziggurat Portal Room Exit": [["Rooted Ziggurat Lower Back"]], }, + "Rooted Ziggurat Portal": { + "Rooted Ziggurat Portal Room": + [], + }, "Swamp Front": { "Swamp Mid": [], + # get one pillar from the gate, then dash onto the gate, very tricky + "Back of Swamp Laurels Area": + [["Hyperdash", "Zip"]], }, "Swamp Mid": { "Swamp Front": [], "Swamp to Cathedral Main Entrance Region": - [["Hyperdash"], ["NMG"]], + [["Hyperdash"], ["IG2"], ["LS3"]], "Swamp Ledge under Cathedral Door": [], "Back of Swamp": - [["UR"]], + [["LS1"]], # ig3 later? }, "Swamp Ledge under Cathedral Door": { "Swamp Mid": @@ -1476,24 +1530,41 @@ class DeadEnd(IntEnum): }, "Swamp to Cathedral Main Entrance Region": { "Swamp Mid": - [["NMG"]], + [["IG1"]], }, "Back of Swamp": { "Back of Swamp Laurels Area": - [["Hyperdash"], ["UR"]], + [["Hyperdash"], ["LS2"]], "Swamp Hero's Grave Region": [], + "Swamp Mid": + [["LS2"]], + "Swamp Front": + [["LS1"]], + "Swamp to Cathedral Main Entrance Region": + [["LS3"]], + "Swamp to Cathedral Treasure Room": + [["LS3"]] }, "Back of Swamp Laurels Area": { "Back of Swamp": [["Hyperdash"]], + # get one pillar from the gate, then dash onto the gate, very tricky "Swamp Mid": - [["NMG", "Hyperdash"]], + [["IG1", "Hyperdash"], ["Hyperdash", "Zip"]], }, "Swamp Hero's Grave Region": { "Back of Swamp": [], }, + "Cathedral": { + "Cathedral to Gauntlet": + [], + }, + "Cathedral to Gauntlet": { + "Cathedral": + [], + }, "Cathedral Gauntlet Checkpoint": { "Cathedral Gauntlet": [], diff --git a/worlds/tunic/er_rules.py b/worlds/tunic/er_rules.py index 3d1973beb375..65175e41ca14 100644 --- a/worlds/tunic/er_rules.py +++ b/worlds/tunic/er_rules.py @@ -1,8 +1,10 @@ -from typing import Dict, Set, List, Tuple, TYPE_CHECKING +from typing import Dict, FrozenSet, Tuple, TYPE_CHECKING from worlds.generic.Rules import set_rule, forbid_item +from .options import IceGrappling, LadderStorage from .rules import (has_ability, has_sword, has_stick, has_ice_grapple_logic, has_lantern, has_mask, can_ladder_storage, - bomb_walls) -from .er_data import Portal + laurels_zip, bomb_walls) +from .er_data import Portal, get_portal_outlet_region +from .ladder_storage_data import ow_ladder_groups, region_ladders, easy_ls, medium_ls, hard_ls from BaseClasses import Region, CollectionState if TYPE_CHECKING: @@ -82,13 +84,16 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Overworld"].connect( connecting_region=regions["Overworld Belltower"], - rule=lambda state: state.has(laurels, player)) + rule=lambda state: state.has(laurels, player) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) regions["Overworld Belltower"].connect( connecting_region=regions["Overworld"]) + # ice grapple rudeling across rubble, drop bridge, ice grapple rudeling down regions["Overworld Belltower"].connect( connecting_region=regions["Overworld to West Garden Upper"], - rule=lambda state: has_ladder("Ladders to West Bell", state, world)) + rule=lambda state: has_ladder("Ladders to West Bell", state, world) + or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world)) regions["Overworld to West Garden Upper"].connect( connecting_region=regions["Overworld Belltower"], rule=lambda state: has_ladder("Ladders to West Bell", state, world)) @@ -97,32 +102,35 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ connecting_region=regions["Overworld Belltower at Bell"], rule=lambda state: has_ladder("Ladders to West Bell", state, world)) - # long dong, do not make a reverse connection here or to belltower - regions["Overworld above Patrol Cave"].connect( - connecting_region=regions["Overworld Belltower at Bell"], - rule=lambda state: options.logic_rules and state.has(fire_wand, player)) + # long dong, do not make a reverse connection here or to belltower, maybe readd later + # regions["Overworld above Patrol Cave"].connect( + # connecting_region=regions["Overworld Belltower at Bell"], + # rule=lambda state: options.logic_rules and state.has(fire_wand, player)) - # nmg: can laurels through the ruined passage door + # can laurels through the ruined passage door at either corner regions["Overworld"].connect( connecting_region=regions["Overworld Ruined Passage Door"], rule=lambda state: state.has(key, player, 2) - or (state.has(laurels, player) and options.logic_rules)) + or laurels_zip(state, world)) regions["Overworld Ruined Passage Door"].connect( connecting_region=regions["Overworld"], - rule=lambda state: state.has(laurels, player) and options.logic_rules) + rule=lambda state: laurels_zip(state, world)) regions["Overworld"].connect( connecting_region=regions["After Ruined Passage"], rule=lambda state: has_ladder("Ladders near Weathervane", state, world) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["After Ruined Passage"].connect( connecting_region=regions["Overworld"], rule=lambda state: has_ladder("Ladders near Weathervane", state, world)) + # for the hard ice grapple, get to the chest after the bomb wall, grab a slime, and grapple push down + # you can ice grapple through the bomb wall, so no need for shop logic checking regions["Overworld"].connect( connecting_region=regions["Above Ruined Passage"], rule=lambda state: has_ladder("Ladders near Weathervane", state, world) - or state.has(laurels, player)) + or state.has(laurels, player) + or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world)) regions["Above Ruined Passage"].connect( connecting_region=regions["Overworld"], rule=lambda state: has_ladder("Ladders near Weathervane", state, world) @@ -138,7 +146,7 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Above Ruined Passage"].connect( connecting_region=regions["East Overworld"], rule=lambda state: has_ladder("Ladders near Weathervane", state, world) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["East Overworld"].connect( connecting_region=regions["Above Ruined Passage"], rule=lambda state: has_ladder("Ladders near Weathervane", state, world) @@ -147,15 +155,15 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ # nmg: ice grapple the slimes, works both ways consistently regions["East Overworld"].connect( connecting_region=regions["After Ruined Passage"], - rule=lambda state: has_ice_grapple_logic(True, state, world)) + rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["After Ruined Passage"].connect( connecting_region=regions["East Overworld"], - rule=lambda state: has_ice_grapple_logic(True, state, world)) + rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["Overworld"].connect( connecting_region=regions["East Overworld"], rule=lambda state: has_ladder("Ladders near Overworld Checkpoint", state, world) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["East Overworld"].connect( connecting_region=regions["Overworld"], rule=lambda state: has_ladder("Ladders near Overworld Checkpoint", state, world)) @@ -169,7 +177,7 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Overworld at Patrol Cave"].connect( connecting_region=regions["Overworld above Patrol Cave"], rule=lambda state: has_ladder("Ladders near Patrol Cave", state, world) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["Overworld above Patrol Cave"].connect( connecting_region=regions["Overworld at Patrol Cave"], rule=lambda state: has_ladder("Ladders near Patrol Cave", state, world)) @@ -185,7 +193,7 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["East Overworld"].connect( connecting_region=regions["Overworld above Patrol Cave"], rule=lambda state: has_ladder("Ladders near Overworld Checkpoint", state, world) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["Overworld above Patrol Cave"].connect( connecting_region=regions["East Overworld"], rule=lambda state: has_ladder("Ladders near Overworld Checkpoint", state, world)) @@ -193,7 +201,7 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Overworld above Patrol Cave"].connect( connecting_region=regions["Upper Overworld"], rule=lambda state: has_ladder("Ladders near Patrol Cave", state, world) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["Upper Overworld"].connect( connecting_region=regions["Overworld above Patrol Cave"], rule=lambda state: has_ladder("Ladders near Patrol Cave", state, world) @@ -206,13 +214,15 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ connecting_region=regions["Upper Overworld"], rule=lambda state: state.has_any({grapple, laurels}, player)) + # ice grapple push guard captain down the ledge regions["Upper Overworld"].connect( connecting_region=regions["Overworld after Temple Rafters"], - rule=lambda state: has_ladder("Ladder near Temple Rafters", state, world)) + rule=lambda state: has_ladder("Ladder near Temple Rafters", state, world) + or has_ice_grapple_logic(True, IceGrappling.option_medium, state, world)) regions["Overworld after Temple Rafters"].connect( connecting_region=regions["Upper Overworld"], rule=lambda state: has_ladder("Ladder near Temple Rafters", state, world) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["Overworld above Quarry Entrance"].connect( connecting_region=regions["Overworld"], @@ -224,13 +234,11 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Overworld"].connect( connecting_region=regions["Overworld after Envoy"], rule=lambda state: state.has_any({laurels, grapple, gun}, player) - or state.has("Sword Upgrade", player, 4) - or options.logic_rules) + or state.has("Sword Upgrade", player, 4)) regions["Overworld after Envoy"].connect( connecting_region=regions["Overworld"], rule=lambda state: state.has_any({laurels, grapple, gun}, player) - or state.has("Sword Upgrade", player, 4) - or options.logic_rules) + or state.has("Sword Upgrade", player, 4)) regions["Overworld after Envoy"].connect( connecting_region=regions["Overworld Quarry Entry"], @@ -242,10 +250,10 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ # ice grapple through the gate regions["Overworld"].connect( connecting_region=regions["Overworld Quarry Entry"], - rule=lambda state: has_ice_grapple_logic(False, state, world)) + rule=lambda state: has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) regions["Overworld Quarry Entry"].connect( connecting_region=regions["Overworld"], - rule=lambda state: has_ice_grapple_logic(False, state, world)) + rule=lambda state: has_ice_grapple_logic(False, IceGrappling.option_easy, state, world)) regions["Overworld"].connect( connecting_region=regions["Overworld Swamp Upper Entry"], @@ -256,7 +264,8 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Overworld"].connect( connecting_region=regions["Overworld Swamp Lower Entry"], - rule=lambda state: has_ladder("Ladder to Swamp", state, world)) + rule=lambda state: has_ladder("Ladder to Swamp", state, world) + or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world)) regions["Overworld Swamp Lower Entry"].connect( connecting_region=regions["Overworld"], rule=lambda state: has_ladder("Ladder to Swamp", state, world)) @@ -279,20 +288,21 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Overworld"].connect( connecting_region=regions["Overworld Old House Door"], rule=lambda state: state.has(house_key, player) - or has_ice_grapple_logic(False, state, world)) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) - # not including ice grapple through this because it's very tedious to get an enemy here + # lure enemy over and ice grapple through regions["Overworld"].connect( connecting_region=regions["Overworld Southeast Cross Door"], - rule=lambda state: has_ability(holy_cross, state, world)) + rule=lambda state: has_ability(holy_cross, state, world) + or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world)) regions["Overworld Southeast Cross Door"].connect( connecting_region=regions["Overworld"], rule=lambda state: has_ability(holy_cross, state, world)) - # not including ice grapple through this because we're not including it on the other door regions["Overworld"].connect( connecting_region=regions["Overworld Fountain Cross Door"], - rule=lambda state: has_ability(holy_cross, state, world)) + rule=lambda state: has_ability(holy_cross, state, world) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) regions["Overworld Fountain Cross Door"].connect( connecting_region=regions["Overworld"]) @@ -312,7 +322,7 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Overworld"].connect( connecting_region=regions["Overworld Temple Door"], rule=lambda state: state.has_all({"Ring Eastern Bell", "Ring Western Bell"}, player) - or has_ice_grapple_logic(False, state, world)) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) regions["Overworld Temple Door"].connect( connecting_region=regions["Overworld above Patrol Cave"], @@ -325,12 +335,11 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Overworld Beach"].connect( connecting_region=regions["Overworld Tunnel Turret"], rule=lambda state: has_ladder("Ladders in Overworld Town", state, world) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["Overworld"].connect( connecting_region=regions["Overworld Tunnel Turret"], - rule=lambda state: state.has(laurels, player) - or has_ice_grapple_logic(True, state, world)) + rule=lambda state: state.has(laurels, player)) regions["Overworld Tunnel Turret"].connect( connecting_region=regions["Overworld"], rule=lambda state: state.has_any({grapple, laurels}, player)) @@ -341,13 +350,18 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Cube Cave Entrance Region"].connect( connecting_region=regions["Overworld"]) + # drop a rudeling down, icebolt or ice bomb + regions["Overworld"].connect( + connecting_region=regions["Overworld to West Garden from Furnace"], + rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_hard, state, world)) + # Overworld side areas regions["Old House Front"].connect( connecting_region=regions["Old House Back"]) - # nmg: laurels through the gate + # laurels through the gate, use left wall to space yourself regions["Old House Back"].connect( connecting_region=regions["Old House Front"], - rule=lambda state: state.has(laurels, player) and options.logic_rules) + rule=lambda state: laurels_zip(state, world)) regions["Sealed Temple"].connect( connecting_region=regions["Sealed Temple Rafters"]) @@ -388,15 +402,15 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ connecting_region=regions["Forest Belltower Lower"], rule=lambda state: has_ladder("Ladder to East Forest", state, world)) - # nmg: ice grapple up to dance fox spot, and vice versa + # ice grapple up to dance fox spot, and vice versa regions["East Forest"].connect( connecting_region=regions["East Forest Dance Fox Spot"], rule=lambda state: state.has(laurels, player) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["East Forest Dance Fox Spot"].connect( connecting_region=regions["East Forest"], rule=lambda state: state.has(laurels, player) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["East Forest"].connect( connecting_region=regions["East Forest Portal"], @@ -407,7 +421,7 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["East Forest"].connect( connecting_region=regions["Lower Forest"], rule=lambda state: has_ladder("Ladders to Lower Forest", state, world) - or (state.has_all({grapple, fire_wand, ice_dagger}, player) and has_ability(icebolt, state, world))) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["Lower Forest"].connect( connecting_region=regions["East Forest"], rule=lambda state: has_ladder("Ladders to Lower Forest", state, world)) @@ -425,22 +439,24 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ connecting_region=regions["Guard House 2 Upper"], rule=lambda state: has_ladder("Ladders to Lower Forest", state, world)) - # nmg: ice grapple from upper grave path exit to the rest of it + # ice grapple from upper grave path exit to the rest of it regions["Forest Grave Path Upper"].connect( connecting_region=regions["Forest Grave Path Main"], rule=lambda state: state.has(laurels, player) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) + # for the ice grapple, lure a rudeling up top, then grapple push it across regions["Forest Grave Path Main"].connect( connecting_region=regions["Forest Grave Path Upper"], - rule=lambda state: state.has(laurels, player)) + rule=lambda state: state.has(laurels, player) + or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world)) regions["Forest Grave Path Main"].connect( connecting_region=regions["Forest Grave Path by Grave"]) - # nmg: ice grapple or laurels through the gate + # ice grapple or laurels through the gate regions["Forest Grave Path by Grave"].connect( connecting_region=regions["Forest Grave Path Main"], - rule=lambda state: has_ice_grapple_logic(False, state, world) - or (state.has(laurels, player) and options.logic_rules)) + rule=lambda state: has_ice_grapple_logic(False, IceGrappling.option_easy, state, world) + or laurels_zip(state, world)) regions["Forest Grave Path by Grave"].connect( connecting_region=regions["Forest Hero's Grave"], @@ -473,10 +489,10 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Well Boss"].connect( connecting_region=regions["Dark Tomb Checkpoint"]) - # nmg: can laurels through the gate + # can laurels through the gate, no setup needed regions["Dark Tomb Checkpoint"].connect( connecting_region=regions["Well Boss"], - rule=lambda state: state.has(laurels, player) and options.logic_rules) + rule=lambda state: laurels_zip(state, world)) regions["Dark Tomb Entry Point"].connect( connecting_region=regions["Dark Tomb Upper"], @@ -505,12 +521,16 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ connecting_region=regions["West Garden Laurels Exit Region"], rule=lambda state: state.has(laurels, player)) + # you can grapple Garden Knight to aggro it, then ledge it regions["West Garden after Boss"].connect( connecting_region=regions["West Garden"], - rule=lambda state: state.has(laurels, player)) + rule=lambda state: state.has(laurels, player) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) + # ice grapple push Garden Knight off the side regions["West Garden"].connect( connecting_region=regions["West Garden after Boss"], - rule=lambda state: state.has(laurels, player) or has_sword(state, player)) + rule=lambda state: state.has(laurels, player) or has_sword(state, player) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) regions["West Garden"].connect( connecting_region=regions["West Garden Hero's Grave Region"], @@ -519,26 +539,32 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ connecting_region=regions["West Garden"]) regions["West Garden Portal"].connect( + connecting_region=regions["West Garden by Portal"]) + regions["West Garden by Portal"].connect( + connecting_region=regions["West Garden Portal"], + rule=lambda state: has_ability(prayer, state, world) and state.has("Activate West Garden Fuse", player)) + + regions["West Garden by Portal"].connect( connecting_region=regions["West Garden Portal Item"], rule=lambda state: state.has(laurels, player)) regions["West Garden Portal Item"].connect( - connecting_region=regions["West Garden Portal"], - rule=lambda state: state.has(laurels, player) and has_ability(prayer, state, world)) + connecting_region=regions["West Garden by Portal"], + rule=lambda state: state.has(laurels, player)) - # nmg: can ice grapple to and from the item behind the magic dagger house + # can ice grapple to and from the item behind the magic dagger house regions["West Garden Portal Item"].connect( connecting_region=regions["West Garden"], - rule=lambda state: has_ice_grapple_logic(True, state, world)) + rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["West Garden"].connect( connecting_region=regions["West Garden Portal Item"], - rule=lambda state: has_ice_grapple_logic(True, state, world)) + rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_medium, state, world)) # Atoll and Frog's Domain - # nmg: ice grapple the bird below the portal + # ice grapple the bird below the portal regions["Ruined Atoll"].connect( connecting_region=regions["Ruined Atoll Lower Entry Area"], rule=lambda state: state.has(laurels, player) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["Ruined Atoll Lower Entry Area"].connect( connecting_region=regions["Ruined Atoll"], rule=lambda state: state.has(laurels, player) or state.has(grapple, player)) @@ -570,13 +596,17 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Ruined Atoll"].connect( connecting_region=regions["Ruined Atoll Statue"], rule=lambda state: has_ability(prayer, state, world) - and has_ladder("Ladders in South Atoll", state, world)) + and (has_ladder("Ladders in South Atoll", state, world) + # shoot fuse and have the shot hit you mid-LS + or (can_ladder_storage(state, world) and state.has(fire_wand, player) + and options.ladder_storage >= LadderStorage.option_hard))) regions["Ruined Atoll Statue"].connect( connecting_region=regions["Ruined Atoll"]) regions["Frog Stairs Eye Exit"].connect( connecting_region=regions["Frog Stairs Upper"], - rule=lambda state: has_ladder("Ladders to Frog's Domain", state, world)) + rule=lambda state: has_ladder("Ladders to Frog's Domain", state, world) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["Frog Stairs Upper"].connect( connecting_region=regions["Frog Stairs Eye Exit"], rule=lambda state: has_ladder("Ladders to Frog's Domain", state, world)) @@ -605,14 +635,19 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ # Library regions["Library Exterior Tree Region"].connect( + connecting_region=regions["Library Exterior by Tree"]) + regions["Library Exterior by Tree"].connect( + connecting_region=regions["Library Exterior Tree Region"], + rule=lambda state: has_ability(prayer, state, world)) + + regions["Library Exterior by Tree"].connect( connecting_region=regions["Library Exterior Ladder Region"], rule=lambda state: state.has_any({grapple, laurels}, player) and has_ladder("Ladders in Library", state, world)) regions["Library Exterior Ladder Region"].connect( - connecting_region=regions["Library Exterior Tree Region"], - rule=lambda state: has_ability(prayer, state, world) - and ((state.has(laurels, player) and has_ladder("Ladders in Library", state, world)) - or state.has(grapple, player))) + connecting_region=regions["Library Exterior by Tree"], + rule=lambda state: state.has(grapple, player) + or (state.has(laurels, player) and has_ladder("Ladders in Library", state, world))) regions["Library Hall Bookshelf"].connect( connecting_region=regions["Library Hall"], @@ -658,14 +693,19 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ and has_ladder("Ladders in Library", state, world)) regions["Library Lab"].connect( - connecting_region=regions["Library Portal"], - rule=lambda state: has_ability(prayer, state, world) - and has_ladder("Ladders in Library", state, world)) - regions["Library Portal"].connect( + connecting_region=regions["Library Lab on Portal Pad"], + rule=lambda state: has_ladder("Ladders in Library", state, world)) + regions["Library Lab on Portal Pad"].connect( connecting_region=regions["Library Lab"], rule=lambda state: has_ladder("Ladders in Library", state, world) or state.has(laurels, player)) + regions["Library Lab on Portal Pad"].connect( + connecting_region=regions["Library Portal"], + rule=lambda state: has_ability(prayer, state, world)) + regions["Library Portal"].connect( + connecting_region=regions["Library Lab on Portal Pad"]) + regions["Library Lab"].connect( connecting_region=regions["Library Lab to Librarian"], rule=lambda state: has_ladder("Ladders in Library", state, world)) @@ -688,6 +728,11 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ connecting_region=regions["Fortress Exterior near cave"], rule=lambda state: state.has(laurels, player) or has_ability(prayer, state, world)) + # shoot far fire pot, enemy gets aggro'd + regions["Fortress Exterior near cave"].connect( + connecting_region=regions["Fortress Courtyard"], + rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_hard, state, world)) + regions["Fortress Exterior near cave"].connect( connecting_region=regions["Beneath the Vault Entry"], rule=lambda state: has_ladder("Ladder to Beneath the Vault", state, world)) @@ -702,14 +747,14 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Fortress Exterior from Overworld"].connect( connecting_region=regions["Fortress Courtyard"], rule=lambda state: state.has(laurels, player) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["Fortress Courtyard Upper"].connect( connecting_region=regions["Fortress Courtyard"]) # nmg: can ice grapple to the upper ledge regions["Fortress Courtyard"].connect( connecting_region=regions["Fortress Courtyard Upper"], - rule=lambda state: has_ice_grapple_logic(True, state, world)) + rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["Fortress Courtyard Upper"].connect( connecting_region=regions["Fortress Exterior from Overworld"]) @@ -733,17 +778,17 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ # nmg: can ice grapple upwards regions["Fortress East Shortcut Lower"].connect( connecting_region=regions["Fortress East Shortcut Upper"], - rule=lambda state: has_ice_grapple_logic(True, state, world)) + rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) # nmg: ice grapple through the big gold door, can do it both ways regions["Eastern Vault Fortress"].connect( connecting_region=regions["Eastern Vault Fortress Gold Door"], rule=lambda state: state.has_all({"Activate Eastern Vault West Fuses", "Activate Eastern Vault East Fuse"}, player) - or has_ice_grapple_logic(False, state, world)) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) regions["Eastern Vault Fortress Gold Door"].connect( connecting_region=regions["Eastern Vault Fortress"], - rule=lambda state: has_ice_grapple_logic(True, state, world)) + rule=lambda state: has_ice_grapple_logic(False, IceGrappling.option_easy, state, world)) regions["Fortress Grave Path"].connect( connecting_region=regions["Fortress Grave Path Dusty Entrance Region"], @@ -761,7 +806,7 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ # nmg: ice grapple from upper grave path to lower regions["Fortress Grave Path Upper"].connect( connecting_region=regions["Fortress Grave Path"], - rule=lambda state: has_ice_grapple_logic(True, state, world)) + rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["Fortress Arena"].connect( connecting_region=regions["Fortress Arena Portal"], @@ -819,25 +864,25 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Lower Quarry"].connect( connecting_region=regions["Even Lower Quarry"], rule=lambda state: has_ladder("Ladders in Lower Quarry", state, world) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) # nmg: bring a scav over, then ice grapple through the door, only with ER on to avoid soft lock regions["Even Lower Quarry"].connect( connecting_region=regions["Lower Quarry Zig Door"], rule=lambda state: state.has("Activate Quarry Fuse", player) - or (has_ice_grapple_logic(False, state, world) and options.entrance_rando)) + or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world)) # nmg: use ice grapple to get from the beginning of Quarry to the door without really needing mask only with ER on regions["Quarry"].connect( connecting_region=regions["Lower Quarry Zig Door"], - rule=lambda state: has_ice_grapple_logic(True, state, world) and options.entrance_rando) + rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_hard, state, world)) regions["Monastery Front"].connect( connecting_region=regions["Monastery Back"]) - # nmg: can laurels through the gate + # laurels through the gate, no setup needed regions["Monastery Back"].connect( connecting_region=regions["Monastery Front"], - rule=lambda state: state.has(laurels, player) and options.logic_rules) + rule=lambda state: laurels_zip(state, world)) regions["Monastery Back"].connect( connecting_region=regions["Monastery Hero's Grave Region"], @@ -863,14 +908,13 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ connecting_region=regions["Rooted Ziggurat Lower Back"], rule=lambda state: state.has(laurels, player) or (has_sword(state, player) and has_ability(prayer, state, world))) - # unrestricted: use ladder storage to get to the front, get hit by one of the many enemies # nmg: can ice grapple on the voidlings to the double admin fight, still need to pray at the fuse regions["Rooted Ziggurat Lower Back"].connect( connecting_region=regions["Rooted Ziggurat Lower Front"], - rule=lambda state: ((state.has(laurels, player) or has_ice_grapple_logic(True, state, world)) - and has_ability(prayer, state, world) - and has_sword(state, player)) - or can_ladder_storage(state, world)) + rule=lambda state: (state.has(laurels, player) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) + and has_ability(prayer, state, world) + and has_sword(state, player)) regions["Rooted Ziggurat Lower Back"].connect( connecting_region=regions["Rooted Ziggurat Portal Room Entrance"], @@ -882,40 +926,62 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ connecting_region=regions["Rooted Ziggurat Lower Front"]) regions["Rooted Ziggurat Portal"].connect( + connecting_region=regions["Rooted Ziggurat Portal Room"]) + regions["Rooted Ziggurat Portal Room"].connect( + connecting_region=regions["Rooted Ziggurat Portal"], + rule=lambda state: has_ability(prayer, state, world)) + + regions["Rooted Ziggurat Portal Room"].connect( connecting_region=regions["Rooted Ziggurat Portal Room Exit"], rule=lambda state: state.has("Activate Ziggurat Fuse", player)) regions["Rooted Ziggurat Portal Room Exit"].connect( - connecting_region=regions["Rooted Ziggurat Portal"], - rule=lambda state: has_ability(prayer, state, world)) + connecting_region=regions["Rooted Ziggurat Portal Room"]) # Swamp and Cathedral regions["Swamp Front"].connect( connecting_region=regions["Swamp Mid"], rule=lambda state: has_ladder("Ladders in Swamp", state, world) or state.has(laurels, player) - or has_ice_grapple_logic(False, state, world)) # nmg: ice grapple through gate + or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world)) regions["Swamp Mid"].connect( connecting_region=regions["Swamp Front"], rule=lambda state: has_ladder("Ladders in Swamp", state, world) or state.has(laurels, player) - or has_ice_grapple_logic(False, state, world)) # nmg: ice grapple through gate + or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world)) - # nmg: ice grapple through cathedral door, can do it both ways - regions["Swamp Mid"].connect( + # a whole lot of stuff to basically say "you need to pray at the overworld fuse" + swamp_mid_to_cath = regions["Swamp Mid"].connect( connecting_region=regions["Swamp to Cathedral Main Entrance Region"], - rule=lambda state: (has_ability(prayer, state, world) and state.has(laurels, player)) - or has_ice_grapple_logic(False, state, world)) + rule=lambda state: (has_ability(prayer, state, world) + and (state.has(laurels, player) + # blam yourself in the face with a wand shot off the fuse + or (can_ladder_storage(state, world) and state.has(fire_wand, player) + and options.ladder_storage >= LadderStorage.option_hard + and (not options.shuffle_ladders + or state.has_any({"Ladders in Overworld Town", + "Ladder to Swamp", + "Ladders near Weathervane"}, player) + or (state.has("Ladder to Ruined Atoll", player) + and state.can_reach_region("Overworld Beach", player)))))) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) + + if options.ladder_storage >= LadderStorage.option_hard and options.shuffle_ladders: + world.multiworld.register_indirect_condition(regions["Overworld Beach"], swamp_mid_to_cath) + regions["Swamp to Cathedral Main Entrance Region"].connect( connecting_region=regions["Swamp Mid"], - rule=lambda state: has_ice_grapple_logic(False, state, world)) + rule=lambda state: has_ice_grapple_logic(False, IceGrappling.option_easy, state, world)) + # grapple push the enemy by the door down, then grapple to it. Really jank regions["Swamp Mid"].connect( connecting_region=regions["Swamp Ledge under Cathedral Door"], - rule=lambda state: has_ladder("Ladders in Swamp", state, world)) + rule=lambda state: has_ladder("Ladders in Swamp", state, world) + or has_ice_grapple_logic(True, IceGrappling.option_hard, state, world)) + # ice grapple enemy standing at the door regions["Swamp Ledge under Cathedral Door"].connect( connecting_region=regions["Swamp Mid"], rule=lambda state: has_ladder("Ladders in Swamp", state, world) - or has_ice_grapple_logic(True, state, world)) # nmg: ice grapple the enemy at door + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) regions["Swamp Ledge under Cathedral Door"].connect( connecting_region=regions["Swamp to Cathedral Treasure Room"], @@ -930,11 +996,17 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ connecting_region=regions["Back of Swamp"], rule=lambda state: state.has(laurels, player)) - # nmg: can ice grapple down while you're on the pillars + # ice grapple down from the pillar, or do that really annoying laurels zip + # the zip goes to front or mid, just doing mid since mid -> front can be done with laurels alone regions["Back of Swamp Laurels Area"].connect( connecting_region=regions["Swamp Mid"], - rule=lambda state: state.has(laurels, player) - and has_ice_grapple_logic(True, state, world)) + rule=lambda state: laurels_zip(state, world) + or (state.has(laurels, player) + and has_ice_grapple_logic(True, IceGrappling.option_easy, state, world))) + # get one pillar from the gate, then dash onto the gate, very tricky + regions["Swamp Front"].connect( + connecting_region=regions["Back of Swamp Laurels Area"], + rule=lambda state: laurels_zip(state, world)) regions["Back of Swamp"].connect( connecting_region=regions["Swamp Hero's Grave Region"], @@ -942,6 +1014,14 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ regions["Swamp Hero's Grave Region"].connect( connecting_region=regions["Back of Swamp"]) + regions["Cathedral"].connect( + connecting_region=regions["Cathedral to Gauntlet"], + rule=lambda state: (has_ability(prayer, state, world) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) + or options.entrance_rando) # elevator is always there in ER + regions["Cathedral to Gauntlet"].connect( + connecting_region=regions["Cathedral"]) + regions["Cathedral Gauntlet Checkpoint"].connect( connecting_region=regions["Cathedral Gauntlet"]) @@ -1000,337 +1080,141 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_ and state.has_group_unique("Hero Relics", player, 6) and has_sword(state, player)))) - # connecting the regions portals are in to other portals you can access via ladder storage - # using has_stick instead of can_ladder_storage since it's already checking the logic rules - if options.logic_rules == "unrestricted": + if options.ladder_storage: def get_portal_info(portal_sd: str) -> Tuple[str, str]: for portal1, portal2 in portal_pairs.items(): if portal1.scene_destination() == portal_sd: - return portal1.name, portal2.region + return portal1.name, get_portal_outlet_region(portal2, world) if portal2.scene_destination() == portal_sd: - return portal2.name, portal1.region + return portal2.name, get_portal_outlet_region(portal1, world) raise Exception("no matches found in get_paired_region") - ladder_storages: List[Tuple[str, str, Set[str]]] = [ - # LS from Overworld main - # The upper Swamp entrance - ("Overworld", "Overworld Redux, Swamp Redux 2_wall", - {"Ladders near Weathervane", "Ladder to Swamp", "Ladders in Overworld Town"}), - # Upper atoll entrance - ("Overworld", "Overworld Redux, Atoll Redux_upper", - {"Ladders near Weathervane", "Ladder to Swamp", "Ladders in Overworld Town"}), - # Furnace entrance, next to the sign that leads to West Garden - ("Overworld", "Overworld Redux, Furnace_gyro_west", - {"Ladders near Weathervane", "Ladder to Swamp", "Ladders in Overworld Town"}), - # Upper West Garden entry, by the belltower - ("Overworld", "Overworld Redux, Archipelagos Redux_upper", - {"Ladders near Weathervane", "Ladder to Swamp", "Ladders in Overworld Town"}), - # Ruined Passage - ("Overworld", "Overworld Redux, Ruins Passage_east", - {"Ladders near Weathervane", "Ladder to Swamp", "Ladders in Overworld Town"}), - # Well rail, west side. Can ls in town, get extra height by going over the portal pad - ("Overworld", "Overworld Redux, Sewer_west_aqueduct", - {"Ladders near Weathervane", "Ladder to Swamp", "Ladders in Overworld Town", "Ladder to Quarry"}), - # Well rail, east side. Need some height from the temple stairs - ("Overworld", "Overworld Redux, Furnace_gyro_upper_north", - {"Ladders near Weathervane", "Ladder to Swamp", "Ladders in Overworld Town", "Ladder to Quarry"}), - # Quarry entry - ("Overworld", "Overworld Redux, Darkwoods Tunnel_", - {"Ladders near Weathervane", "Ladder to Swamp", "Ladders in Overworld Town", "Ladders in Well"}), - # East Forest entry - ("Overworld", "Overworld Redux, Forest Belltower_", - {"Ladders near Weathervane", "Ladder to Swamp", "Ladders in Overworld Town", "Ladders in Well", - "Ladders near Patrol Cave", "Ladder to Quarry", "Ladders near Dark Tomb"}), - # Fortress entry - ("Overworld", "Overworld Redux, Fortress Courtyard_", - {"Ladders near Weathervane", "Ladder to Swamp", "Ladders in Overworld Town", "Ladders in Well", - "Ladders near Patrol Cave", "Ladder to Quarry", "Ladders near Dark Tomb"}), - # Patrol Cave entry - ("Overworld", "Overworld Redux, PatrolCave_", - {"Ladders near Weathervane", "Ladder to Swamp", "Ladders in Overworld Town", "Ladders in Well", - "Ladders near Overworld Checkpoint", "Ladder to Quarry", "Ladders near Dark Tomb"}), - # Special Shop entry, excluded in non-ER due to soft lock potential - ("Overworld", "Overworld Redux, ShopSpecial_", - {"Ladders near Weathervane", "Ladder to Swamp", "Ladders in Overworld Town", "Ladders in Well", - "Ladders near Overworld Checkpoint", "Ladders near Patrol Cave", "Ladder to Quarry", - "Ladders near Dark Tomb"}), - # Temple Rafters, excluded in non-ER + ladder rando due to soft lock potential - ("Overworld", "Overworld Redux, Temple_rafters", - {"Ladders near Weathervane", "Ladder to Swamp", "Ladders in Overworld Town", "Ladders in Well", - "Ladders near Overworld Checkpoint", "Ladders near Patrol Cave", "Ladder to Quarry", - "Ladders near Dark Tomb"}), - # Spot above the Quarry entrance, - # only gets you to the mountain stairs - ("Overworld above Quarry Entrance", "Overworld Redux, Mountain_", - {"Ladders near Dark Tomb"}), - - # LS from the Overworld Beach - # West Garden entry by the Furnace - ("Overworld Beach", "Overworld Redux, Archipelagos Redux_lower", - {"Ladders in Overworld Town", "Ladder to Ruined Atoll"}), - # West Garden laurels entry - ("Overworld Beach", "Overworld Redux, Archipelagos Redux_lowest", - {"Ladders in Overworld Town", "Ladder to Ruined Atoll"}), - # Swamp lower entrance - ("Overworld Beach", "Overworld Redux, Swamp Redux 2_conduit", - {"Ladders in Overworld Town", "Ladder to Ruined Atoll"}), - # Rotating Lights entrance - ("Overworld Beach", "Overworld Redux, Overworld Cave_", - {"Ladders in Overworld Town", "Ladder to Ruined Atoll"}), - # Swamp upper entrance - ("Overworld Beach", "Overworld Redux, Swamp Redux 2_wall", - {"Ladder to Ruined Atoll"}), - # Furnace entrance, next to the sign that leads to West Garden - ("Overworld Beach", "Overworld Redux, Furnace_gyro_west", - {"Ladder to Ruined Atoll"}), - # Upper West Garden entry, by the belltower - ("Overworld Beach", "Overworld Redux, Archipelagos Redux_upper", - {"Ladder to Ruined Atoll"}), - # Ruined Passage - ("Overworld Beach", "Overworld Redux, Ruins Passage_east", - {"Ladder to Ruined Atoll"}), - # Well rail, west side. Can ls in town, get extra height by going over the portal pad - ("Overworld Beach", "Overworld Redux, Sewer_west_aqueduct", - {"Ladder to Ruined Atoll"}), - # Well rail, east side. Need some height from the temple stairs - ("Overworld Beach", "Overworld Redux, Furnace_gyro_upper_north", - {"Ladder to Ruined Atoll"}), - # Quarry entry - ("Overworld Beach", "Overworld Redux, Darkwoods Tunnel_", - {"Ladder to Ruined Atoll"}), - - # LS from that low spot where you normally walk to swamp - # Only has low ones you can't get to from main Overworld - # West Garden main entry from swamp ladder - ("Overworld Swamp Lower Entry", "Overworld Redux, Archipelagos Redux_lower", - {"Ladder to Swamp"}), - # Maze Cave entry from swamp ladder - ("Overworld Swamp Lower Entry", "Overworld Redux, Maze Room_", - {"Ladder to Swamp"}), - # Hourglass Cave entry from swamp ladder - ("Overworld Swamp Lower Entry", "Overworld Redux, Town Basement_beach", - {"Ladder to Swamp"}), - # Lower Atoll entry from swamp ladder - ("Overworld Swamp Lower Entry", "Overworld Redux, Atoll Redux_lower", - {"Ladder to Swamp"}), - # Lowest West Garden entry from swamp ladder - ("Overworld Swamp Lower Entry", "Overworld Redux, Archipelagos Redux_lowest", - {"Ladder to Swamp"}), - - # from the ladders by the belltower - # Ruined Passage - ("Overworld to West Garden Upper", "Overworld Redux, Ruins Passage_east", - {"Ladders to West Bell"}), - # Well rail, west side. Can ls in town, get extra height by going over the portal pad - ("Overworld to West Garden Upper", "Overworld Redux, Sewer_west_aqueduct", - {"Ladders to West Bell"}), - # Well rail, east side. Need some height from the temple stairs - ("Overworld to West Garden Upper", "Overworld Redux, Furnace_gyro_upper_north", - {"Ladders to West Bell"}), - # Quarry entry - ("Overworld to West Garden Upper", "Overworld Redux, Darkwoods Tunnel_", - {"Ladders to West Bell"}), - # East Forest entry - ("Overworld to West Garden Upper", "Overworld Redux, Forest Belltower_", - {"Ladders to West Bell"}), - # Fortress entry - ("Overworld to West Garden Upper", "Overworld Redux, Fortress Courtyard_", - {"Ladders to West Bell"}), - # Patrol Cave entry - ("Overworld to West Garden Upper", "Overworld Redux, PatrolCave_", - {"Ladders to West Bell"}), - # Special Shop entry, excluded in non-ER due to soft lock potential - ("Overworld to West Garden Upper", "Overworld Redux, ShopSpecial_", - {"Ladders to West Bell"}), - # Temple Rafters, excluded in non-ER and ladder rando due to soft lock potential - ("Overworld to West Garden Upper", "Overworld Redux, Temple_rafters", - {"Ladders to West Bell"}), - - # In the furnace - # Furnace ladder to the fuse entrance - ("Furnace Ladder Area", "Furnace, Overworld Redux_gyro_upper_north", set()), - # Furnace ladder to Dark Tomb - ("Furnace Ladder Area", "Furnace, Crypt Redux_", set()), - # Furnace ladder to the West Garden connector - ("Furnace Ladder Area", "Furnace, Overworld Redux_gyro_west", set()), - - # West Garden - # exit after Garden Knight - ("West Garden", "Archipelagos Redux, Overworld Redux_upper", set()), - # West Garden laurels exit - ("West Garden", "Archipelagos Redux, Overworld Redux_lowest", set()), - - # Atoll, use the little ladder you fix at the beginning - ("Ruined Atoll", "Atoll Redux, Overworld Redux_lower", set()), - ("Ruined Atoll", "Atoll Redux, Frog Stairs_mouth", set()), - ("Ruined Atoll", "Atoll Redux, Frog Stairs_eye", set()), - - # East Forest - # Entrance by the dancing fox holy cross spot - ("East Forest", "East Forest Redux, East Forest Redux Laddercave_upper", set()), - - # From the west side of Guard House 1 to the east side - ("Guard House 1 West", "East Forest Redux Laddercave, East Forest Redux_gate", set()), - ("Guard House 1 West", "East Forest Redux Laddercave, Forest Boss Room_", set()), - - # Upper exit from the Forest Grave Path, use LS at the ladder by the gate switch - ("Forest Grave Path Main", "Sword Access, East Forest Redux_upper", set()), - - # Fortress Exterior - # shop, ls at the ladder by the telescope - ("Fortress Exterior from Overworld", "Fortress Courtyard, Shop_", set()), - # Fortress main entry and grave path lower entry, ls at the ladder by the telescope - ("Fortress Exterior from Overworld", "Fortress Courtyard, Fortress Main_Big Door", set()), - ("Fortress Exterior from Overworld", "Fortress Courtyard, Fortress Reliquary_Lower", set()), - # Upper exits from the courtyard. Use the ramp in the courtyard, then the blocks north of the first fuse - ("Fortress Exterior from Overworld", "Fortress Courtyard, Fortress Reliquary_Upper", set()), - ("Fortress Exterior from Overworld", "Fortress Courtyard, Fortress East_", set()), - - # same as above, except from the east side of the area - ("Fortress Exterior from East Forest", "Fortress Courtyard, Overworld Redux_", set()), - ("Fortress Exterior from East Forest", "Fortress Courtyard, Shop_", set()), - ("Fortress Exterior from East Forest", "Fortress Courtyard, Fortress Main_Big Door", set()), - ("Fortress Exterior from East Forest", "Fortress Courtyard, Fortress Reliquary_Lower", set()), - ("Fortress Exterior from East Forest", "Fortress Courtyard, Fortress Reliquary_Upper", set()), - ("Fortress Exterior from East Forest", "Fortress Courtyard, Fortress East_", set()), - - # same as above, except from the Beneath the Vault entrance ladder - ("Fortress Exterior near cave", "Fortress Courtyard, Overworld Redux_", - {"Ladder to Beneath the Vault"}), - ("Fortress Exterior near cave", "Fortress Courtyard, Fortress Main_Big Door", - {"Ladder to Beneath the Vault"}), - ("Fortress Exterior near cave", "Fortress Courtyard, Fortress Reliquary_Lower", - {"Ladder to Beneath the Vault"}), - ("Fortress Exterior near cave", "Fortress Courtyard, Fortress Reliquary_Upper", - {"Ladder to Beneath the Vault"}), - ("Fortress Exterior near cave", "Fortress Courtyard, Fortress East_", - {"Ladder to Beneath the Vault"}), - - # ls at the ladder, need to gain a little height to get up the stairs - # excluded in non-ER due to soft lock potential - ("Lower Mountain", "Mountain, Mountaintop_", set()), - - # Where the rope is behind Monastery. Connecting here since, if you have this region, you don't need a sword - ("Quarry Monastery Entry", "Quarry Redux, Monastery_back", set()), - - # Swamp to Gauntlet - ("Swamp Mid", "Swamp Redux 2, Cathedral Arena_", - {"Ladders in Swamp"}), - # Swamp to Overworld upper - ("Swamp Mid", "Swamp Redux 2, Overworld Redux_wall", - {"Ladders in Swamp"}), - # Ladder by the hero grave - ("Back of Swamp", "Swamp Redux 2, Overworld Redux_conduit", set()), - ("Back of Swamp", "Swamp Redux 2, Shop_", set()), - # Need to put the cathedral HC code mid-flight - ("Back of Swamp", "Swamp Redux 2, Cathedral Redux_secret", set()), - ] - - for region_name, scene_dest, ladders in ladder_storages: - portal_name, paired_region = get_portal_info(scene_dest) - # this is the only exception, requiring holy cross as well - if portal_name == "Swamp to Cathedral Secret Legend Room Entrance" and region_name == "Back of Swamp": - regions[region_name].connect( - regions[paired_region], - name=portal_name + " (LS) " + region_name, - rule=lambda state: has_stick(state, player) - and has_ability(holy_cross, state, world) - and (has_ladder("Ladders in Swamp", state, world) - or has_ice_grapple_logic(True, state, world) - or not options.entrance_rando)) - # soft locked without this ladder - elif portal_name == "West Garden Exit after Boss" and not options.entrance_rando: - regions[region_name].connect( - regions[paired_region], - name=portal_name + " (LS) " + region_name, - rule=lambda state: has_stick(state, player) - and (state.has("Ladders to West Bell", player))) - # soft locked unless you have either ladder. if you have laurels, you use the other Entrance - elif portal_name in {"Furnace Exit towards West Garden", "Furnace Exit to Dark Tomb"} \ - and not options.entrance_rando: - regions[region_name].connect( - regions[paired_region], - name=portal_name + " (LS) " + region_name, - rule=lambda state: has_stick(state, player) - and state.has_any({"Ladder in Dark Tomb", "Ladders to West Bell"}, player)) - # soft locked for the same reasons as above - elif portal_name in {"Entrance to Furnace near West Garden", "West Garden Entrance from Furnace"} \ - and not options.entrance_rando: - regions[region_name].connect( - regions[paired_region], - name=portal_name + " (LS) " + region_name, - rule=lambda state: has_stick(state, player) and state.has_any(ladders, player) - and state.has_any({"Ladder in Dark Tomb", "Ladders to West Bell"}, player)) - # soft locked if you can't get past garden knight backwards or up the belltower ladders - elif portal_name == "West Garden Entrance near Belltower" and not options.entrance_rando: - regions[region_name].connect( - regions[paired_region], - name=portal_name + " (LS) " + region_name, - rule=lambda state: has_stick(state, player) and state.has_any(ladders, player) - and state.has_any({"Ladders to West Bell", laurels}, player)) - # soft locked if you can't get back out - elif portal_name == "Fortress Courtyard to Beneath the Vault" and not options.entrance_rando: - regions[region_name].connect( - regions[paired_region], - name=portal_name + " (LS) " + region_name, - rule=lambda state: has_stick(state, player) and state.has("Ladder to Beneath the Vault", player) - and has_lantern(state, world)) - elif portal_name == "Atoll Lower Entrance" and not options.entrance_rando: - regions[region_name].connect( - regions[paired_region], - name=portal_name + " (LS) " + region_name, - rule=lambda state: has_stick(state, player) and state.has_any(ladders, player) - and (state.has_any({"Ladders in Overworld Town", grapple}, player) - or has_ice_grapple_logic(True, state, world))) - elif portal_name == "Atoll Upper Entrance" and not options.entrance_rando: - regions[region_name].connect( - regions[paired_region], - name=portal_name + " (LS) " + region_name, - rule=lambda state: has_stick(state, player) and state.has_any(ladders, player) - and state.has(grapple, player) or has_ability(prayer, state, world)) - # soft lock potential - elif portal_name in {"Special Shop Entrance", "Stairs to Top of the Mountain", "Swamp Upper Entrance", - "Swamp Lower Entrance", "Caustic Light Cave Entrance"} and not options.entrance_rando: + # connect ls elevation regions to their destinations + def ls_connect(origin_name: str, portal_sdt: str) -> None: + p_name, paired_region_name = get_portal_info(portal_sdt) + ladder_regions[origin_name].connect( + regions[paired_region_name], + name=p_name + " (LS) " + origin_name) + + # get what non-overworld ladder storage connections we want together + non_ow_ls_list = [] + non_ow_ls_list.extend(easy_ls) + if options.ladder_storage >= LadderStorage.option_medium: + non_ow_ls_list.extend(medium_ls) + if options.ladder_storage >= LadderStorage.option_hard: + non_ow_ls_list.extend(hard_ls) + + # create the ls elevation regions + ladder_regions: Dict[str, Region] = {} + for name in ow_ladder_groups.keys(): + ladder_regions[name] = Region(name, player, world.multiworld) + + # connect the ls elevations to each other where applicable + if options.ladder_storage >= LadderStorage.option_medium: + for i in range(len(ow_ladder_groups) - 1): + ladder_regions[f"LS Elev {i}"].connect(ladder_regions[f"LS Elev {i + 1}"]) + + # connect the applicable overworld regions to the ls elevation regions + for origin_region, ladders in region_ladders.items(): + for ladder_region, region_info in ow_ladder_groups.items(): + # checking if that region has a ladder or ladders for that elevation + common_ladders: FrozenSet[str] = frozenset(ladders.intersection(region_info.ladders)) + if common_ladders: + if options.shuffle_ladders: + regions[origin_region].connect( + connecting_region=ladder_regions[ladder_region], + rule=lambda state, lads=common_ladders: state.has_any(lads, player) + and can_ladder_storage(state, world)) + else: + regions[origin_region].connect( + connecting_region=ladder_regions[ladder_region], + rule=lambda state: can_ladder_storage(state, world)) + + # connect ls elevation regions to the region on the other side of the portals + for ladder_region, region_info in ow_ladder_groups.items(): + for portal_dest in region_info.portals: + ls_connect(ladder_region, "Overworld Redux, " + portal_dest) + + # connect ls elevation regions to regions where you can get an enemy to knock you down, also well rail + if options.ladder_storage >= LadderStorage.option_medium: + for ladder_region, region_info in ow_ladder_groups.items(): + for dest_region in region_info.regions: + ladder_regions[ladder_region].connect( + connecting_region=regions[dest_region], + name=ladder_region + " (LS) " + dest_region) + # well rail, need height off portal pad for one side, and a tiny extra from stairs on the other + ls_connect("LS Elev 3", "Overworld Redux, Sewer_west_aqueduct") + ls_connect("LS Elev 3", "Overworld Redux, Furnace_gyro_upper_north") + + # connect ls elevation regions to portals where you need to get behind the map to enter it + if options.ladder_storage >= LadderStorage.option_hard: + ls_connect("LS Elev 1", "Overworld Redux, EastFiligreeCache_") + ls_connect("LS Elev 2", "Overworld Redux, Town_FiligreeRoom_") + ls_connect("LS Elev 3", "Overworld Redux, Overworld Interiors_house") + ls_connect("LS Elev 5", "Overworld Redux, Temple_main") + + # connect the non-overworld ones + for ls_info in non_ow_ls_list: + # for places where the destination is a region (so you have to get knocked down) + if ls_info.dest_is_region: + # none of the non-ow ones have multiple ladders that can be used, so don't need has_any + if options.shuffle_ladders and ls_info.ladders_req: + regions[ls_info.origin].connect( + connecting_region=regions[ls_info.destination], + name=ls_info.destination + " (LS) " + ls_info.origin, + rule=lambda state, lad=ls_info.ladders_req: can_ladder_storage(state, world) + and state.has(lad, player)) + else: + regions[ls_info.origin].connect( + connecting_region=regions[ls_info.destination], + name=ls_info.destination + " (LS) " + ls_info.origin, + rule=lambda state: can_ladder_storage(state, world)) continue - # soft lock if you don't have the ladder, I regret writing unrestricted logic - elif portal_name == "Temple Rafters Entrance" and not options.entrance_rando: - regions[region_name].connect( - regions[paired_region], - name=portal_name + " (LS) " + region_name, - rule=lambda state: has_stick(state, player) - and state.has_any(ladders, player) - and (state.has("Ladder near Temple Rafters", player) - or (state.has_all({laurels, grapple}, player) - and ((state.has("Ladders near Patrol Cave", player) - and (state.has("Ladders near Dark Tomb", player) - or state.has("Ladder to Quarry", player) - and (state.has(fire_wand, player) or has_sword(state, player)))) - or state.has("Ladders near Overworld Checkpoint", player) - or has_ice_grapple_logic(True, state, world))))) - # if no ladder items are required, just do the basic stick only lambda - elif not ladders or not options.shuffle_ladders: - regions[region_name].connect( - regions[paired_region], - name=portal_name + " (LS) " + region_name, - rule=lambda state: has_stick(state, player)) - # one ladder required - elif len(ladders) == 1: - ladder = ladders.pop() - regions[region_name].connect( - regions[paired_region], - name=portal_name + " (LS) " + region_name, - rule=lambda state: has_stick(state, player) and state.has(ladder, player)) - # if multiple ladders can be used + + portal_name, dest_region = get_portal_info(ls_info.destination) + # these two are special cases + if ls_info.destination == "Atoll Redux, Frog Stairs_mouth": + regions[ls_info.origin].connect( + connecting_region=regions[dest_region], + name=portal_name + " (LS) " + ls_info.origin, + rule=lambda state: can_ladder_storage(state, world) + and (has_ladder("Ladders in South Atoll", state, world) + or state.has(key, player, 2) # can do it from the rope + # ice grapple push a crab into the door + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world) + or options.ladder_storage >= LadderStorage.option_medium)) # use the little ladder + # holy cross mid-ls to get in here + elif ls_info.destination == "Swamp Redux 2, Cathedral Redux_secret": + if ls_info.origin == "Swamp Mid": + regions[ls_info.origin].connect( + connecting_region=regions[dest_region], + name=portal_name + " (LS) " + ls_info.origin, + rule=lambda state: can_ladder_storage(state, world) and has_ability(holy_cross, state, world) + and has_ladder("Ladders in Swamp", state, world)) + else: + regions[ls_info.origin].connect( + connecting_region=regions[dest_region], + name=portal_name + " (LS) " + ls_info.origin, + rule=lambda state: can_ladder_storage(state, world) and has_ability(holy_cross, state, world)) + + elif options.shuffle_ladders and ls_info.ladders_req: + regions[ls_info.origin].connect( + connecting_region=regions[dest_region], + name=portal_name + " (LS) " + ls_info.origin, + rule=lambda state, lad=ls_info.ladders_req: can_ladder_storage(state, world) + and state.has(lad, player)) else: - regions[region_name].connect( - regions[paired_region], - name=portal_name + " (LS) " + region_name, - rule=lambda state: has_stick(state, player) and state.has_any(ladders, player)) + regions[ls_info.origin].connect( + connecting_region=regions[dest_region], + name=portal_name + " (LS) " + ls_info.origin, + rule=lambda state: can_ladder_storage(state, world)) + + for region in ladder_regions.values(): + world.multiworld.regions.append(region) def set_er_location_rules(world: "TunicWorld") -> None: player = world.player - options = world.options forbid_item(world.get_location("Secret Gathering Place - 20 Fairy Reward"), fairies, player) @@ -1439,10 +1323,13 @@ def set_er_location_rules(world: "TunicWorld") -> None: # Ruined Atoll set_rule(world.get_location("Ruined Atoll - [West] Near Kevin Block"), lambda state: state.has(laurels, player)) + # ice grapple push a crab through the door set_rule(world.get_location("Ruined Atoll - [East] Locked Room Lower Chest"), - lambda state: state.has(laurels, player) or state.has(key, player, 2)) + lambda state: state.has(laurels, player) or state.has(key, player, 2) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) set_rule(world.get_location("Ruined Atoll - [East] Locked Room Upper Chest"), - lambda state: state.has(laurels, player) or state.has(key, player, 2)) + lambda state: state.has(laurels, player) or state.has(key, player, 2) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) # Frog's Domain set_rule(world.get_location("Frog's Domain - Side Room Grapple Secret"), @@ -1465,23 +1352,25 @@ def set_er_location_rules(world: "TunicWorld") -> None: lambda state: state.has(laurels, player)) # Ziggurat - # if ER is off, you still need to get past the Admin or you'll get stuck in lower zig + # if ER is off, while you can get the chest, you won't be able to actually get through zig set_rule(world.get_location("Rooted Ziggurat Upper - Near Bridge Switch"), - lambda state: has_sword(state, player) or (state.has(fire_wand, player) and (state.has(laurels, player) - or options.entrance_rando))) + lambda state: has_sword(state, player) or (state.has(fire_wand, player) + and (state.has(laurels, player) + or world.options.entrance_rando))) set_rule(world.get_location("Rooted Ziggurat Lower - After Guarded Fuse"), lambda state: has_sword(state, player) and has_ability(prayer, state, world)) # Bosses set_rule(world.get_location("Fortress Arena - Siege Engine/Vault Key Pickup"), lambda state: has_sword(state, player)) - # nmg - kill Librarian with a lure, or gun I guess set_rule(world.get_location("Librarian - Hexagon Green"), - lambda state: (has_sword(state, player) or options.logic_rules) + lambda state: has_sword(state, player) and has_ladder("Ladders in Library", state, world)) - # nmg - kill boss scav with orb + firecracker, or similar + # can ice grapple boss scav off the side + # the grapple from the other side of the bridge isn't in logic 'cause we don't have a misc tricks option set_rule(world.get_location("Rooted Ziggurat Lower - Hexagon Blue"), - lambda state: has_sword(state, player) or (state.has(grapple, player) and options.logic_rules)) + lambda state: has_sword(state, player) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) # Swamp set_rule(world.get_location("Cathedral Gauntlet - Gauntlet Reward"), @@ -1490,7 +1379,7 @@ def set_er_location_rules(world: "TunicWorld") -> None: lambda state: state.has(laurels, player)) set_rule(world.get_location("Swamp - [South Graveyard] Upper Walkway Dash Chest"), lambda state: state.has(laurels, player)) - # these two swamp checks really want you to kill the big skeleton first + # really hard to do 4 skulls with a big skeleton chasing you around set_rule(world.get_location("Swamp - [South Graveyard] 4 Orange Skulls"), lambda state: has_sword(state, player)) @@ -1541,7 +1430,13 @@ def set_er_location_rules(world: "TunicWorld") -> None: # Bombable Walls for location_name in bomb_walls: - set_rule(world.get_location(location_name), lambda state: state.has(gun, player) or can_shop(state, world)) + set_rule(world.get_location(location_name), + lambda state: state.has(gun, player) + or can_shop(state, world) + or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world)) + # not enough space to ice grapple into here + set_rule(world.get_location("Quarry - [East] Bombable Wall"), + lambda state: state.has(gun, player) or can_shop(state, world)) # Shop set_rule(world.get_location("Shop - Potion 1"), diff --git a/worlds/tunic/er_scripts.py b/worlds/tunic/er_scripts.py index e7c8fd58d0c6..05f6177aa57d 100644 --- a/worlds/tunic/er_scripts.py +++ b/worlds/tunic/er_scripts.py @@ -1,7 +1,7 @@ -from typing import Dict, List, Set, TYPE_CHECKING +from typing import Dict, List, Set, Tuple, TYPE_CHECKING from BaseClasses import Region, ItemClassification, Item, Location from .locations import location_table -from .er_data import Portal, tunic_er_regions, portal_mapping, traversal_requirements, DeadEnd +from .er_data import Portal, portal_mapping, traversal_requirements, DeadEnd, RegionInfo from .er_rules import set_er_region_rules from Options import PlandoConnection from .options import EntranceRando @@ -22,17 +22,18 @@ class TunicERLocation(Location): def create_er_regions(world: "TunicWorld") -> Dict[Portal, Portal]: regions: Dict[str, Region] = {} + for region_name, region_data in world.er_regions.items(): + regions[region_name] = Region(region_name, world.player, world.multiworld) + if world.options.entrance_rando: - portal_pairs = pair_portals(world) + portal_pairs = pair_portals(world, regions) + # output the entrances to the spoiler log here for convenience sorted_portal_pairs = sort_portals(portal_pairs) for portal1, portal2 in sorted_portal_pairs.items(): world.multiworld.spoiler.set_entrance(portal1, portal2, "both", world.player) else: - portal_pairs = vanilla_portals() - - for region_name, region_data in tunic_er_regions.items(): - regions[region_name] = Region(region_name, world.player, world.multiworld) + portal_pairs = vanilla_portals(world, regions) set_er_region_rules(world, regions, portal_pairs) @@ -93,7 +94,18 @@ def place_event_items(world: "TunicWorld", regions: Dict[str, Region]) -> None: region.locations.append(location) -def vanilla_portals() -> Dict[Portal, Portal]: +# all shops are the same shop. however, you cannot get to all shops from the same shop entrance. +# so, we need a bunch of shop regions that connect to the actual shop, but the actual shop cannot connect back +def create_shop_region(world: "TunicWorld", regions: Dict[str, Region]) -> None: + new_shop_name = f"Shop {world.shop_num}" + world.er_regions[new_shop_name] = RegionInfo("Shop", dead_end=DeadEnd.all_cats) + new_shop_region = Region(new_shop_name, world.player, world.multiworld) + new_shop_region.connect(regions["Shop"]) + regions[new_shop_name] = new_shop_region + world.shop_num += 1 + + +def vanilla_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal, Portal]: portal_pairs: Dict[Portal, Portal] = {} # we don't want the zig skip exit for vanilla portals, since it shouldn't be considered for logic here portal_map = [portal for portal in portal_mapping if portal.name != "Ziggurat Lower Falling Entrance"] @@ -105,8 +117,9 @@ def vanilla_portals() -> Dict[Portal, Portal]: portal2_sdt = portal1.destination_scene() if portal2_sdt.startswith("Shop,"): - portal2 = Portal(name="Shop", region="Shop", + portal2 = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}", destination="Previous Region", tag="_") + create_shop_region(world, regions) elif portal2_sdt == "Purgatory, Purgatory_bottom": portal2_sdt = "Purgatory, Purgatory_top" @@ -125,14 +138,15 @@ def vanilla_portals() -> Dict[Portal, Portal]: # pairing off portals, starting with dead ends -def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]: - # separate the portals into dead ends and non-dead ends +def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal, Portal]: portal_pairs: Dict[Portal, Portal] = {} dead_ends: List[Portal] = [] two_plus: List[Portal] = [] player_name = world.player_name portal_map = portal_mapping.copy() - logic_rules = world.options.logic_rules.value + laurels_zips = world.options.laurels_zips.value + ice_grappling = world.options.ice_grappling.value + ladder_storage = world.options.ladder_storage.value fixed_shop = world.options.fixed_shop laurels_location = world.options.laurels_location traversal_reqs = deepcopy(traversal_requirements) @@ -142,19 +156,21 @@ def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]: # if it's not one of the EntranceRando options, it's a custom seed if world.options.entrance_rando.value not in EntranceRando.options.values(): seed_group = world.seed_groups[world.options.entrance_rando.value] - logic_rules = seed_group["logic_rules"] + laurels_zips = seed_group["laurels_zips"] + ice_grappling = seed_group["ice_grappling"] + ladder_storage = seed_group["ladder_storage"] fixed_shop = seed_group["fixed_shop"] laurels_location = "10_fairies" if seed_group["laurels_at_10_fairies"] is True else False + logic_tricks: Tuple[bool, int, int] = (laurels_zips, ice_grappling, ladder_storage) + # marking that you don't immediately have laurels if laurels_location == "10_fairies" and not hasattr(world.multiworld, "re_gen_passthrough"): has_laurels = False - shop_scenes: Set[str] = set() shop_count = 6 if fixed_shop: shop_count = 0 - shop_scenes.add("Overworld Redux") else: # if fixed shop is off, remove this portal for portal in portal_map: @@ -169,13 +185,13 @@ def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]: # create separate lists for dead ends and non-dead ends for portal in portal_map: - dead_end_status = tunic_er_regions[portal.region].dead_end + dead_end_status = world.er_regions[portal.region].dead_end if dead_end_status == DeadEnd.free: two_plus.append(portal) elif dead_end_status == DeadEnd.all_cats: dead_ends.append(portal) elif dead_end_status == DeadEnd.restricted: - if logic_rules: + if ice_grappling: two_plus.append(portal) else: dead_ends.append(portal) @@ -196,7 +212,7 @@ def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]: # make better start region stuff when/if implementing random start start_region = "Overworld" connected_regions.add(start_region) - connected_regions = update_reachable_regions(connected_regions, traversal_reqs, has_laurels, logic_rules) + connected_regions = update_reachable_regions(connected_regions, traversal_reqs, has_laurels, logic_tricks) if world.options.entrance_rando.value in EntranceRando.options.values(): plando_connections = world.options.plando_connections.value @@ -225,12 +241,14 @@ def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]: plando_connections.append(PlandoConnection(portal_name1, portal_name2, "both")) non_dead_end_regions = set() - for region_name, region_info in tunic_er_regions.items(): + for region_name, region_info in world.er_regions.items(): if not region_info.dead_end: non_dead_end_regions.add(region_name) - elif region_info.dead_end == 2 and logic_rules: + # if ice grappling to places is in logic, both places stop being dead ends + elif region_info.dead_end == DeadEnd.restricted and ice_grappling: non_dead_end_regions.add(region_name) - elif region_info.dead_end == 3: + # secret gathering place and zig skip get weird, special handling + elif region_info.dead_end == DeadEnd.special: if (region_name == "Secret Gathering Place" and laurels_location == "10_fairies") \ or (region_name == "Zig Skip Exit" and fixed_shop): non_dead_end_regions.add(region_name) @@ -239,6 +257,9 @@ def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]: for connection in plando_connections: p_entrance = connection.entrance p_exit = connection.exit + # if you plando secret gathering place, need to know that during portal pairing + if "Secret Gathering Place Exit" in [p_entrance, p_exit]: + waterfall_plando = True portal1_dead_end = True portal2_dead_end = True @@ -285,16 +306,13 @@ def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]: break # if it's not a dead end, it might be a shop if p_exit == "Shop Portal": - portal2 = Portal(name="Shop Portal", region="Shop", + portal2 = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}", destination="Previous Region", tag="_") + create_shop_region(world, regions) shop_count -= 1 # need to maintain an even number of portals total if shop_count < 0: shop_count += 2 - for p in portal_mapping: - if p.name == p_entrance: - shop_scenes.add(p.scene()) - break # and if it's neither shop nor dead end, it just isn't correct else: if not portal2: @@ -327,11 +345,10 @@ def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]: else: raise Exception(f"{player_name} paired a dead end to a dead end in their " "plando connections.") - waterfall_plando = True portal_pairs[portal1] = portal2 # if we have plando connections, our connected regions may change somewhat - connected_regions = update_reachable_regions(connected_regions, traversal_reqs, has_laurels, logic_rules) + connected_regions = update_reachable_regions(connected_regions, traversal_reqs, has_laurels, logic_tricks) if fixed_shop and not hasattr(world.multiworld, "re_gen_passthrough"): portal1 = None @@ -343,7 +360,9 @@ def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]: raise Exception(f"Failed to do Fixed Shop option. " f"Did {player_name} plando connection the Windmill Shop entrance?") - portal2 = Portal(name="Shop Portal", region="Shop", destination="Previous Region", tag="_") + portal2 = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}", + destination="Previous Region", tag="_") + create_shop_region(world, regions) portal_pairs[portal1] = portal2 two_plus.remove(portal1) @@ -393,7 +412,7 @@ def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]: if waterfall_plando: cr = connected_regions.copy() cr.add(portal.region) - if "Secret Gathering Place" not in update_reachable_regions(cr, traversal_reqs, has_laurels, logic_rules): + if "Secret Gathering Place" not in update_reachable_regions(cr, traversal_reqs, has_laurels, logic_tricks): continue elif portal.region != "Secret Gathering Place": continue @@ -405,9 +424,9 @@ def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]: # once we have both portals, connect them and add the new region(s) to connected_regions if check_success == 2: - connected_regions = update_reachable_regions(connected_regions, traversal_reqs, has_laurels, logic_rules) if "Secret Gathering Place" in connected_regions: has_laurels = True + connected_regions = update_reachable_regions(connected_regions, traversal_reqs, has_laurels, logic_tricks) portal_pairs[portal1] = portal2 check_success = 0 random_object.shuffle(two_plus) @@ -418,16 +437,12 @@ def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]: shop_count = 0 for i in range(shop_count): - portal1 = None - for portal in two_plus: - if portal.scene() not in shop_scenes: - shop_scenes.add(portal.scene()) - portal1 = portal - two_plus.remove(portal) - break + portal1 = two_plus.pop() if portal1 is None: - raise Exception("Too many shops in the pool, or something else went wrong.") - portal2 = Portal(name="Shop Portal", region="Shop", destination="Previous Region", tag="_") + raise Exception("TUNIC: Too many shops in the pool, or something else went wrong.") + portal2 = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}", + destination="Previous Region", tag="_") + create_shop_region(world, regions) portal_pairs[portal1] = portal2 @@ -460,13 +475,12 @@ def create_randomized_entrances(portal_pairs: Dict[Portal, Portal], regions: Dic region1 = regions[portal1.region] region2 = regions[portal2.region] region1.connect(connecting_region=region2, name=portal1.name) - # prevent the logic from thinking you can get to any shop-connected region from the shop - if portal2.name not in {"Shop", "Shop Portal"}: - region2.connect(connecting_region=region1, name=portal2.name) + region2.connect(connecting_region=region1, name=portal2.name) def update_reachable_regions(connected_regions: Set[str], traversal_reqs: Dict[str, Dict[str, List[List[str]]]], - has_laurels: bool, logic: int) -> Set[str]: + has_laurels: bool, logic: Tuple[bool, int, int]) -> Set[str]: + zips, ice_grapples, ls = logic # starting count, so we can run it again if this changes region_count = len(connected_regions) for origin, destinations in traversal_reqs.items(): @@ -485,11 +499,15 @@ def update_reachable_regions(connected_regions: Set[str], traversal_reqs: Dict[s if req == "Hyperdash": if not has_laurels: break - elif req == "NMG": - if not logic: + elif req == "Zip": + if not zips: + break + # if req is higher than logic option, then it breaks since it's not a valid connection + elif req.startswith("IG"): + if int(req[-1]) > ice_grapples: break - elif req == "UR": - if logic < 2: + elif req.startswith("LS"): + if int(req[-1]) > ls: break elif req not in connected_regions: break diff --git a/worlds/tunic/items.py b/worlds/tunic/items.py index e0ee17831a0a..55aa3468fc6b 100644 --- a/worlds/tunic/items.py +++ b/worlds/tunic/items.py @@ -166,6 +166,7 @@ class TunicItemData(NamedTuple): "Ladders in Swamp": TunicItemData(ItemClassification.progression, 0, 150, "Ladders"), } +# items to be replaced by fool traps fool_tiers: List[List[str]] = [ [], ["Money x1", "Money x10", "Money x15", "Money x16"], @@ -173,6 +174,7 @@ class TunicItemData(NamedTuple): ["Money x1", "Money x10", "Money x15", "Money x16", "Money x20", "Money x25", "Money x30"], ] +# items we'll want the location of in slot data, for generating in-game hints slot_data_item_names = [ "Stick", "Sword", diff --git a/worlds/tunic/ladder_storage_data.py b/worlds/tunic/ladder_storage_data.py new file mode 100644 index 000000000000..a29d50b4f455 --- /dev/null +++ b/worlds/tunic/ladder_storage_data.py @@ -0,0 +1,186 @@ +from typing import Dict, List, Set, NamedTuple, Optional + + +# ladders in overworld, since it is the most complex area for ladder storage +class OWLadderInfo(NamedTuple): + ladders: Set[str] # ladders where the top or bottom is at the same elevation + portals: List[str] # portals at the same elevation, only those without doors + regions: List[str] # regions where a melee enemy can hit you out of ladder storage + + +# groups for ladders at the same elevation, for use in determing whether you can ls to entrances in diff rulesets +ow_ladder_groups: Dict[str, OWLadderInfo] = { + # lowest elevation + "LS Elev 0": OWLadderInfo({"Ladders in Overworld Town", "Ladder to Ruined Atoll", "Ladder to Swamp"}, + ["Swamp Redux 2_conduit", "Overworld Cave_", "Atoll Redux_lower", "Maze Room_", + "Town Basement_beach", "Archipelagos Redux_lower", "Archipelagos Redux_lowest"], + ["Overworld Beach"]), + # also the east filigree room + "LS Elev 1": OWLadderInfo({"Ladders near Weathervane", "Ladders in Overworld Town", "Ladder to Swamp"}, + ["Furnace_gyro_lower", "Swamp Redux 2_wall"], + ["Overworld Tunnel Turret"]), + # also the fountain filigree room and ruined passage door + "LS Elev 2": OWLadderInfo({"Ladders near Weathervane", "Ladders to West Bell"}, + ["Archipelagos Redux_upper", "Ruins Passage_east"], + ["After Ruined Passage"]), + # also old house door + "LS Elev 3": OWLadderInfo({"Ladders near Weathervane", "Ladder to Quarry", "Ladders to West Bell", + "Ladders in Overworld Town"}, + [], + ["Overworld after Envoy", "East Overworld"]), + # skip top of top ladder next to weathervane level, does not provide logical access to anything + "LS Elev 4": OWLadderInfo({"Ladders near Dark Tomb", "Ladder to Quarry", "Ladders to West Bell", "Ladders in Well", + "Ladders in Overworld Town"}, + ["Darkwoods Tunnel_"], + []), + "LS Elev 5": OWLadderInfo({"Ladders near Overworld Checkpoint", "Ladders near Patrol Cave"}, + ["PatrolCave_", "Forest Belltower_", "Fortress Courtyard_", "ShopSpecial_"], + ["East Overworld"]), + # skip top of belltower, middle of dark tomb ladders, and top of checkpoint, does not grant access to anything + "LS Elev 6": OWLadderInfo({"Ladders near Patrol Cave", "Ladder near Temple Rafters"}, + ["Temple_rafters"], + ["Overworld above Patrol Cave"]), + # in-line with the chest above dark tomb, gets you up the mountain stairs + "LS Elev 7": OWLadderInfo({"Ladders near Patrol Cave", "Ladder near Temple Rafters", "Ladders near Dark Tomb"}, + ["Mountain_"], + ["Upper Overworld"]), +} + + +# ladders accessible within different regions of overworld, only those that are relevant +# other scenes will just have them hardcoded since this type of structure is not necessary there +region_ladders: Dict[str, Set[str]] = { + "Overworld": {"Ladders near Weathervane", "Ladders near Overworld Checkpoint", "Ladders near Dark Tomb", + "Ladders in Overworld Town", "Ladder to Swamp", "Ladders in Well"}, + "Overworld Beach": {"Ladder to Ruined Atoll"}, + "Overworld at Patrol Cave": {"Ladders near Patrol Cave"}, + "Overworld Quarry Entry": {"Ladder to Quarry"}, + "Overworld Belltower": {"Ladders to West Bell"}, + "Overworld after Temple Rafters": {"Ladders near Temple Rafters"}, +} + + +class LadderInfo(NamedTuple): + origin: str # origin region + destination: str # destination portal + ladders_req: Optional[str] = None # ladders required to do this + dest_is_region: bool = False # whether it is a region that you are going to + + +easy_ls: List[LadderInfo] = [ + # In the furnace + # Furnace ladder to the fuse entrance + LadderInfo("Furnace Ladder Area", "Furnace, Overworld Redux_gyro_upper_north"), + # Furnace ladder to Dark Tomb + LadderInfo("Furnace Ladder Area", "Furnace, Crypt Redux_"), + # Furnace ladder to the West Garden connector + LadderInfo("Furnace Ladder Area", "Furnace, Overworld Redux_gyro_west"), + + # West Garden + # exit after Garden Knight + LadderInfo("West Garden", "Archipelagos Redux, Overworld Redux_upper"), + # West Garden laurels exit + LadderInfo("West Garden", "Archipelagos Redux, Overworld Redux_lowest"), + + # Atoll, use the little ladder you fix at the beginning + LadderInfo("Ruined Atoll", "Atoll Redux, Overworld Redux_lower"), + LadderInfo("Ruined Atoll", "Atoll Redux, Frog Stairs_mouth"), # special case + + # East Forest + # Entrance by the dancing fox holy cross spot + LadderInfo("East Forest", "East Forest Redux, East Forest Redux Laddercave_upper"), + + # From the west side of Guard House 1 to the east side + LadderInfo("Guard House 1 West", "East Forest Redux Laddercave, East Forest Redux_gate"), + LadderInfo("Guard House 1 West", "East Forest Redux Laddercave, Forest Boss Room_"), + + # Fortress Exterior + # shop, ls at the ladder by the telescope + LadderInfo("Fortress Exterior from Overworld", "Fortress Courtyard, Shop_"), + # Fortress main entry and grave path lower entry, ls at the ladder by the telescope + LadderInfo("Fortress Exterior from Overworld", "Fortress Courtyard, Fortress Main_Big Door"), + LadderInfo("Fortress Exterior from Overworld", "Fortress Courtyard, Fortress Reliquary_Lower"), + # Use the top of the ladder by the telescope + LadderInfo("Fortress Exterior from Overworld", "Fortress Courtyard, Fortress Reliquary_Upper"), + LadderInfo("Fortress Exterior from Overworld", "Fortress Courtyard, Fortress East_"), + + # same as above, except from the east side of the area + LadderInfo("Fortress Exterior from East Forest", "Fortress Courtyard, Overworld Redux_"), + LadderInfo("Fortress Exterior from East Forest", "Fortress Courtyard, Shop_"), + LadderInfo("Fortress Exterior from East Forest", "Fortress Courtyard, Fortress Main_Big Door"), + LadderInfo("Fortress Exterior from East Forest", "Fortress Courtyard, Fortress Reliquary_Lower"), + + # same as above, except from the Beneath the Vault entrance ladder + LadderInfo("Fortress Exterior near cave", "Fortress Courtyard, Overworld Redux_", "Ladder to Beneath the Vault"), + LadderInfo("Fortress Exterior near cave", "Fortress Courtyard, Fortress Main_Big Door", + "Ladder to Beneath the Vault"), + LadderInfo("Fortress Exterior near cave", "Fortress Courtyard, Fortress Reliquary_Lower", + "Ladder to Beneath the Vault"), + + # Swamp to Gauntlet + LadderInfo("Swamp Mid", "Swamp Redux 2, Cathedral Arena_", "Ladders in Swamp"), + + # Ladder by the hero grave + LadderInfo("Back of Swamp", "Swamp Redux 2, Overworld Redux_conduit"), + LadderInfo("Back of Swamp", "Swamp Redux 2, Shop_"), +] + +# if we can gain elevation or get knocked down, add the harder ones +medium_ls: List[LadderInfo] = [ + # region-destination versions of easy ls spots + LadderInfo("East Forest", "East Forest Dance Fox Spot", dest_is_region=True), + # fortress courtyard knockdowns are never logically relevant, the fuse requires upper + LadderInfo("Back of Swamp", "Swamp Mid", dest_is_region=True), + LadderInfo("Back of Swamp", "Swamp Front", dest_is_region=True), + + # gain height off the northeast fuse ramp + LadderInfo("Ruined Atoll", "Atoll Redux, Frog Stairs_eye"), + + # Upper exit from the Forest Grave Path, use LS at the ladder by the gate switch + LadderInfo("Forest Grave Path Main", "Sword Access, East Forest Redux_upper"), + + # Upper exits from the courtyard. Use the ramp in the courtyard, then the blocks north of the first fuse + LadderInfo("Fortress Exterior from Overworld", "Fortress Courtyard Upper", dest_is_region=True), + LadderInfo("Fortress Exterior from East Forest", "Fortress Courtyard, Fortress Reliquary_Upper"), + LadderInfo("Fortress Exterior from East Forest", "Fortress Courtyard, Fortress East_"), + LadderInfo("Fortress Exterior from East Forest", "Fortress Courtyard Upper", dest_is_region=True), + LadderInfo("Fortress Exterior near cave", "Fortress Courtyard, Fortress Reliquary_Upper", + "Ladder to Beneath the Vault"), + LadderInfo("Fortress Exterior near cave", "Fortress Courtyard, Fortress East_", "Ladder to Beneath the Vault"), + LadderInfo("Fortress Exterior near cave", "Fortress Courtyard Upper", "Ladder to Beneath the Vault", + dest_is_region=True), + + # need to gain height to get up the stairs + LadderInfo("Lower Mountain", "Mountain, Mountaintop_"), + + # Where the rope is behind Monastery + LadderInfo("Quarry Entry", "Quarry Redux, Monastery_back"), + LadderInfo("Quarry Monastery Entry", "Quarry Redux, Monastery_back"), + LadderInfo("Quarry Back", "Quarry Redux, Monastery_back"), + + LadderInfo("Rooted Ziggurat Lower Back", "ziggurat2020_3, ziggurat2020_2_"), + LadderInfo("Rooted Ziggurat Lower Back", "Rooted Ziggurat Lower Front", dest_is_region=True), + + # Swamp to Overworld upper + LadderInfo("Swamp Mid", "Swamp Redux 2, Overworld Redux_wall", "Ladders in Swamp"), + LadderInfo("Back of Swamp", "Swamp Redux 2, Overworld Redux_wall"), +] + +hard_ls: List[LadderInfo] = [ + # lower ladder, go into the waterfall then above the bonfire, up a ramp, then through the right wall + LadderInfo("Beneath the Well Front", "Sewer, Sewer_Boss_", "Ladders in Well"), + LadderInfo("Beneath the Well Front", "Sewer, Overworld Redux_west_aqueduct", "Ladders in Well"), + LadderInfo("Beneath the Well Front", "Beneath the Well Back", "Ladders in Well", dest_is_region=True), + # go through the hexagon engraving above the vault door + LadderInfo("Frog's Domain", "frog cave main, Frog Stairs_Exit", "Ladders to Frog's Domain"), + # the turret at the end here is not affected by enemy rando + LadderInfo("Frog's Domain", "Frog's Domain Back", "Ladders to Frog's Domain", dest_is_region=True), + # todo: see if we can use that new laurels strat here + # LadderInfo("Rooted Ziggurat Lower Back", "ziggurat2020_3, ziggurat2020_FTRoom_"), + # go behind the cathedral to reach the door, pretty easily doable + LadderInfo("Swamp Mid", "Swamp Redux 2, Cathedral Redux_main", "Ladders in Swamp"), + LadderInfo("Back of Swamp", "Swamp Redux 2, Cathedral Redux_main"), + # need to do hc midair, probably cannot get into this without hc + LadderInfo("Swamp Mid", "Swamp Redux 2, Cathedral Redux_secret", "Ladders in Swamp"), + LadderInfo("Back of Swamp", "Swamp Redux 2, Cathedral Redux_secret"), +] diff --git a/worlds/tunic/locations.py b/worlds/tunic/locations.py index 09916228163d..442e0c01446d 100644 --- a/worlds/tunic/locations.py +++ b/worlds/tunic/locations.py @@ -47,7 +47,7 @@ class TunicLocationData(NamedTuple): "Guardhouse 1 - Upper Floor": TunicLocationData("East Forest", "Guard House 1 East"), "East Forest - Dancing Fox Spirit Holy Cross": TunicLocationData("East Forest", "East Forest Dance Fox Spot", location_group="Holy Cross"), "East Forest - Golden Obelisk Holy Cross": TunicLocationData("East Forest", "Lower Forest", location_group="Holy Cross"), - "East Forest - Ice Rod Grapple Chest": TunicLocationData("East Forest", "East Forest"), + "East Forest - Ice Rod Grapple Chest": TunicLocationData("East Forest", "Lower Forest"), "East Forest - Above Save Point": TunicLocationData("East Forest", "East Forest"), "East Forest - Above Save Point Obscured": TunicLocationData("East Forest", "East Forest"), "East Forest - From Guardhouse 1 Chest": TunicLocationData("East Forest", "East Forest Dance Fox Spot"), @@ -205,7 +205,7 @@ class TunicLocationData(NamedTuple): "Fountain Cross Door - Page Pickup": TunicLocationData("Overworld Holy Cross", "Fountain Cross Room", location_group="Holy Cross"), "Secret Gathering Place - Holy Cross Chest": TunicLocationData("Overworld Holy Cross", "Secret Gathering Place", location_group="Holy Cross"), "Top of the Mountain - Page At The Peak": TunicLocationData("Overworld Holy Cross", "Top of the Mountain", location_group="Holy Cross"), - "Monastery - Monastery Chest": TunicLocationData("Quarry", "Monastery Back"), + "Monastery - Monastery Chest": TunicLocationData("Monastery", "Monastery Back"), "Quarry - [Back Entrance] Bushes Holy Cross": TunicLocationData("Quarry Back", "Quarry Back", location_group="Holy Cross"), "Quarry - [Back Entrance] Chest": TunicLocationData("Quarry Back", "Quarry Back"), "Quarry - [Central] Near Shortcut Ladder": TunicLocationData("Quarry Back", "Quarry Back"), @@ -224,7 +224,7 @@ class TunicLocationData(NamedTuple): "Quarry - [Central] Above Ladder Dash Chest": TunicLocationData("Quarry", "Quarry Monastery Entry"), "Quarry - [West] Upper Area Bombable Wall": TunicLocationData("Quarry Back", "Quarry Back"), "Quarry - [East] Bombable Wall": TunicLocationData("Quarry", "Quarry"), - "Hero's Grave - Ash Relic": TunicLocationData("Quarry", "Hero Relic - Quarry"), + "Hero's Grave - Ash Relic": TunicLocationData("Monastery", "Hero Relic - Quarry"), "Quarry - [West] Shooting Range Secret Path": TunicLocationData("Lower Quarry", "Lower Quarry"), "Quarry - [West] Near Shooting Range": TunicLocationData("Lower Quarry", "Lower Quarry"), "Quarry - [West] Below Shooting Range": TunicLocationData("Lower Quarry", "Lower Quarry"), diff --git a/worlds/tunic/options.py b/worlds/tunic/options.py index 92cbafba233f..1683b3ca5aee 100644 --- a/worlds/tunic/options.py +++ b/worlds/tunic/options.py @@ -1,7 +1,7 @@ from dataclasses import dataclass from typing import Dict, Any from Options import (DefaultOnToggle, Toggle, StartInventoryPool, Choice, Range, TextChoice, PlandoConnections, - PerGameCommonOptions, OptionGroup) + PerGameCommonOptions, OptionGroup, Visibility) from .er_data import portal_mapping @@ -39,27 +39,6 @@ class AbilityShuffling(Toggle): display_name = "Shuffle Abilities" -class LogicRules(Choice): - """ - Set which logic rules to use for your world. - Restricted: Standard logic, no glitches. - No Major Glitches: Sneaky Laurels zips, ice grapples through doors, shooting the west bell, and boss quick kills are included in logic. - * Ice grappling through the Ziggurat door is not in logic since you will get stuck in there without Prayer. - Unrestricted: Logic in No Major Glitches, as well as ladder storage to get to certain places early. - * Torch is given to the player at the start of the game due to the high softlock potential with various tricks. Using the torch is not required in logic. - * Using Ladder Storage to get to individual chests is not in logic to avoid tedium. - * Getting knocked out of the air by enemies during Ladder Storage to reach places is not in logic, except for in Rooted Ziggurat Lower. This is so you're not punished for playing with enemy rando on. - """ - internal_name = "logic_rules" - display_name = "Logic Rules" - option_restricted = 0 - option_no_major_glitches = 1 - alias_nmg = 1 - option_unrestricted = 2 - alias_ur = 2 - default = 0 - - class Lanternless(Toggle): """ Choose whether you require the Lantern for dark areas. @@ -173,8 +152,8 @@ class ShuffleLadders(Toggle): """ internal_name = "shuffle_ladders" display_name = "Shuffle Ladders" - - + + class TunicPlandoConnections(PlandoConnections): """ Generic connection plando. Format is: @@ -189,6 +168,82 @@ class TunicPlandoConnections(PlandoConnections): duplicate_exits = True +class LaurelsZips(Toggle): + """ + Choose whether to include using the Hero's Laurels to zip through gates, doors, and tricky spots. + Notable inclusions are the Monastery gate, Ruined Passage door, Old House gate, Forest Grave Path gate, and getting from the Back of Swamp to the Middle of Swamp. + """ + internal_name = "laurels_zips" + display_name = "Laurels Zips Logic" + + +class IceGrappling(Choice): + """ + Choose whether grappling frozen enemies is in logic. + Easy includes ice grappling enemies that are in range without luring them. May include clips through terrain. + Medium includes using ice grapples to push enemies through doors or off ledges without luring them. Also includes bringing an enemy over to the Temple Door to grapple through it. + Hard includes luring or grappling enemies to get to where you want to go. + The Medium and Hard options will give the player the Torch to return to the Overworld checkpoint to avoid softlocks. Using the Torch is considered in logic. + Note: You will still be expected to ice grapple to the slime in East Forest from below with this option off. + """ + internal_name = "ice_grappling" + display_name = "Ice Grapple Logic" + option_off = 0 + option_easy = 1 + option_medium = 2 + option_hard = 3 + default = 0 + + +class LadderStorage(Choice): + """ + Choose whether Ladder Storage is in logic. + Easy includes uses of Ladder Storage to get to open doors over a long distance without too much difficulty. May include convenient elevation changes (going up Mountain stairs, stairs in front of Special Shop, etc.). + Medium includes the above as well as changing your elevation using the environment and getting knocked down by melee enemies mid-LS. + Hard includes the above as well as going behind the map to enter closed doors from behind, shooting a fuse with the magic wand to knock yourself down at close range, and getting into the Cathedral Secret Legend room mid-LS. + Enabling any of these difficulty options will give the player the Torch item to return to the Overworld checkpoint to avoid softlocks. Using the Torch is considered in logic. + Opening individual chests while doing ladder storage is excluded due to tedium. + Knocking yourself out of LS with a bomb is excluded due to the problematic nature of consumables in logic. + """ + internal_name = "ladder_storage" + display_name = "Ladder Storage Logic" + option_off = 0 + option_easy = 1 + option_medium = 2 + option_hard = 3 + default = 0 + + +class LadderStorageWithoutItems(Toggle): + """ + If disabled, you logically require Stick, Sword, or Magic Orb to perform Ladder Storage. + If enabled, you will be expected to perform Ladder Storage without progression items. + This can be done with the plushie code, a Golden Coin, Prayer, and many other options. + + This option has no effect if you do not have Ladder Storage Logic enabled. + """ + internal_name = "ladder_storage_without_items" + display_name = "Ladder Storage without Items" + + +class LogicRules(Choice): + """ + This option has been superseded by the individual trick options. + If set to nmg, it will set Ice Grappling to medium and Laurels Zips on. + If set to ur, it will do nmg as well as set Ladder Storage to medium. + It is here to avoid breaking old yamls, and will be removed at a later date. + """ + visibility = Visibility.none + internal_name = "logic_rules" + display_name = "Logic Rules" + option_restricted = 0 + option_no_major_glitches = 1 + alias_nmg = 1 + option_unrestricted = 2 + alias_ur = 2 + default = 0 + + @dataclass class TunicOptions(PerGameCommonOptions): start_inventory_from_pool: StartInventoryPool @@ -199,22 +254,30 @@ class TunicOptions(PerGameCommonOptions): shuffle_ladders: ShuffleLadders entrance_rando: EntranceRando fixed_shop: FixedShop - logic_rules: LogicRules fool_traps: FoolTraps hexagon_quest: HexagonQuest hexagon_goal: HexagonGoal extra_hexagon_percentage: ExtraHexagonPercentage + laurels_location: LaurelsLocation lanternless: Lanternless maskless: Maskless - laurels_location: LaurelsLocation + laurels_zips: LaurelsZips + ice_grappling: IceGrappling + ladder_storage: LadderStorage + ladder_storage_without_items: LadderStorageWithoutItems plando_connections: TunicPlandoConnections + + logic_rules: LogicRules tunic_option_groups = [ OptionGroup("Logic Options", [ - LogicRules, Lanternless, Maskless, + LaurelsZips, + IceGrappling, + LadderStorage, + LadderStorageWithoutItems ]) ] @@ -231,9 +294,12 @@ class TunicOptions(PerGameCommonOptions): "Glace Mode": { "accessibility": "minimal", "ability_shuffling": True, - "entrance_rando": "yes", + "entrance_rando": True, "fool_traps": "onslaught", - "logic_rules": "unrestricted", + "laurels_zips": True, + "ice_grappling": "hard", + "ladder_storage": "hard", + "ladder_storage_without_items": True, "maskless": True, "lanternless": True, }, diff --git a/worlds/tunic/regions.py b/worlds/tunic/regions.py index c30a44bb8ff6..93ec5640e0c2 100644 --- a/worlds/tunic/regions.py +++ b/worlds/tunic/regions.py @@ -16,7 +16,8 @@ "Eastern Vault Fortress": {"Beneath the Vault"}, "Beneath the Vault": {"Eastern Vault Fortress"}, "Quarry Back": {"Quarry"}, - "Quarry": {"Lower Quarry"}, + "Quarry": {"Monastery", "Lower Quarry"}, + "Monastery": set(), "Lower Quarry": {"Rooted Ziggurat"}, "Rooted Ziggurat": set(), "Swamp": {"Cathedral"}, diff --git a/worlds/tunic/rules.py b/worlds/tunic/rules.py index 68756869038d..942bbc773aa5 100644 --- a/worlds/tunic/rules.py +++ b/worlds/tunic/rules.py @@ -3,7 +3,7 @@ from worlds.generic.Rules import set_rule, forbid_item, add_rule from BaseClasses import CollectionState -from .options import TunicOptions +from .options import TunicOptions, LadderStorage, IceGrappling if TYPE_CHECKING: from . import TunicWorld @@ -27,10 +27,10 @@ blue_hexagon = "Blue Questagon" gold_hexagon = "Gold Questagon" +# "Quarry - [East] Bombable Wall" is excluded from this list since it has slightly different rules bomb_walls = ["East Forest - Bombable Wall", "Eastern Vault Fortress - [East Wing] Bombable Wall", "Overworld - [Central] Bombable Wall", "Overworld - [Southwest] Bombable Wall Near Fountain", - "Quarry - [West] Upper Area Bombable Wall", "Quarry - [East] Bombable Wall", - "Ruined Atoll - [Northwest] Bombable Wall"] + "Quarry - [West] Upper Area Bombable Wall", "Ruined Atoll - [Northwest] Bombable Wall"] def randomize_ability_unlocks(random: Random, options: TunicOptions) -> Dict[str, int]: @@ -64,32 +64,33 @@ def has_sword(state: CollectionState, player: int) -> bool: return state.has("Sword", player) or state.has("Sword Upgrade", player, 2) -def has_ice_grapple_logic(long_range: bool, state: CollectionState, world: "TunicWorld") -> bool: - player = world.player - if not world.options.logic_rules: +def laurels_zip(state: CollectionState, world: "TunicWorld") -> bool: + return world.options.laurels_zips and state.has(laurels, world.player) + + +def has_ice_grapple_logic(long_range: bool, difficulty: IceGrappling, state: CollectionState, world: "TunicWorld") -> bool: + if world.options.ice_grappling < difficulty: return False if not long_range: - return state.has_all({ice_dagger, grapple}, player) + return state.has_all({ice_dagger, grapple}, world.player) else: - return state.has_all({ice_dagger, fire_wand, grapple}, player) and has_ability(icebolt, state, world) + return state.has_all({ice_dagger, fire_wand, grapple}, world.player) and has_ability(icebolt, state, world) def can_ladder_storage(state: CollectionState, world: "TunicWorld") -> bool: - return world.options.logic_rules == "unrestricted" and has_stick(state, world.player) + if not world.options.ladder_storage: + return False + if world.options.ladder_storage_without_items: + return True + return has_stick(state, world.player) or state.has(grapple, world.player) def has_mask(state: CollectionState, world: "TunicWorld") -> bool: - if world.options.maskless: - return True - else: - return state.has(mask, world.player) + return world.options.maskless or state.has(mask, world.player) def has_lantern(state: CollectionState, world: "TunicWorld") -> bool: - if world.options.lanternless: - return True - else: - return state.has(lantern, world.player) + return world.options.lanternless or state.has(lantern, world.player) def set_region_rules(world: "TunicWorld") -> None: @@ -102,12 +103,14 @@ def set_region_rules(world: "TunicWorld") -> None: lambda state: has_stick(state, player) or state.has(fire_wand, player) world.get_entrance("Overworld -> Dark Tomb").access_rule = \ lambda state: has_lantern(state, world) + # laurels in, ladder storage in through the furnace, or ice grapple down the belltower world.get_entrance("Overworld -> West Garden").access_rule = \ - lambda state: state.has(laurels, player) \ - or can_ladder_storage(state, world) + lambda state: (state.has(laurels, player) + or can_ladder_storage(state, world) + or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world)) world.get_entrance("Overworld -> Eastern Vault Fortress").access_rule = \ lambda state: state.has(laurels, player) \ - or has_ice_grapple_logic(True, state, world) \ + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world) \ or can_ladder_storage(state, world) # using laurels or ls to get in is covered by the -> Eastern Vault Fortress rules world.get_entrance("Overworld -> Beneath the Vault").access_rule = \ @@ -124,8 +127,8 @@ def set_region_rules(world: "TunicWorld") -> None: world.get_entrance("Lower Quarry -> Rooted Ziggurat").access_rule = \ lambda state: state.has(grapple, player) and has_ability(prayer, state, world) world.get_entrance("Swamp -> Cathedral").access_rule = \ - lambda state: state.has(laurels, player) and has_ability(prayer, state, world) \ - or has_ice_grapple_logic(False, state, world) + lambda state: (state.has(laurels, player) and has_ability(prayer, state, world)) \ + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world) world.get_entrance("Overworld -> Spirit Arena").access_rule = \ lambda state: ((state.has(gold_hexagon, player, options.hexagon_goal.value) if options.hexagon_quest.value else state.has_all({red_hexagon, green_hexagon, blue_hexagon}, player) @@ -133,10 +136,18 @@ def set_region_rules(world: "TunicWorld") -> None: and has_ability(prayer, state, world) and has_sword(state, player) and state.has_any({lantern, laurels}, player)) + world.get_region("Quarry").connect(world.get_region("Rooted Ziggurat"), + rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_hard, state, world) + and has_ability(prayer, state, world)) + + if options.ladder_storage >= LadderStorage.option_medium: + # ls at any ladder in a safe spot in quarry to get to the monastery rope entrance + world.get_region("Quarry Back").connect(world.get_region("Monastery"), + rule=lambda state: can_ladder_storage(state, world)) + def set_location_rules(world: "TunicWorld") -> None: player = world.player - options = world.options forbid_item(world.get_location("Secret Gathering Place - 20 Fairy Reward"), fairies, player) @@ -147,11 +158,13 @@ def set_location_rules(world: "TunicWorld") -> None: lambda state: has_ability(prayer, state, world) or state.has(laurels, player) or can_ladder_storage(state, world) - or (has_ice_grapple_logic(True, state, world) and has_lantern(state, world))) + or (has_ice_grapple_logic(True, IceGrappling.option_easy, state, world) + and has_lantern(state, world))) set_rule(world.get_location("Fortress Courtyard - Page Near Cave"), lambda state: has_ability(prayer, state, world) or state.has(laurels, player) or can_ladder_storage(state, world) - or (has_ice_grapple_logic(True, state, world) and has_lantern(state, world))) + or (has_ice_grapple_logic(True, IceGrappling.option_easy, state, world) + and has_lantern(state, world))) set_rule(world.get_location("East Forest - Dancing Fox Spirit Holy Cross"), lambda state: has_ability(holy_cross, state, world)) set_rule(world.get_location("Forest Grave Path - Holy Cross Code by Grave"), @@ -186,17 +199,17 @@ def set_location_rules(world: "TunicWorld") -> None: lambda state: state.has(laurels, player)) set_rule(world.get_location("Old House - Normal Chest"), lambda state: state.has(house_key, player) - or has_ice_grapple_logic(False, state, world) - or (state.has(laurels, player) and options.logic_rules)) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world) + or laurels_zip(state, world)) set_rule(world.get_location("Old House - Holy Cross Chest"), lambda state: has_ability(holy_cross, state, world) and ( state.has(house_key, player) - or has_ice_grapple_logic(False, state, world) - or (state.has(laurels, player) and options.logic_rules))) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world) + or laurels_zip(state, world))) set_rule(world.get_location("Old House - Shield Pickup"), lambda state: state.has(house_key, player) - or has_ice_grapple_logic(False, state, world) - or (state.has(laurels, player) and options.logic_rules)) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world) + or laurels_zip(state, world)) set_rule(world.get_location("Overworld - [Northwest] Page on Pillar by Dark Tomb"), lambda state: state.has(laurels, player)) set_rule(world.get_location("Overworld - [Southwest] From West Garden"), @@ -206,7 +219,7 @@ def set_location_rules(world: "TunicWorld") -> None: or (has_lantern(state, world) and has_sword(state, player)) or can_ladder_storage(state, world)) set_rule(world.get_location("Overworld - [Northwest] Chest Beneath Quarry Gate"), - lambda state: state.has_any({grapple, laurels}, player) or options.logic_rules) + lambda state: state.has_any({grapple, laurels}, player)) set_rule(world.get_location("Overworld - [East] Grapple Chest"), lambda state: state.has(grapple, player)) set_rule(world.get_location("Special Shop - Secret Page Pickup"), @@ -215,11 +228,11 @@ def set_location_rules(world: "TunicWorld") -> None: lambda state: has_ability(holy_cross, state, world) and (state.has(laurels, player) or (has_lantern(state, world) and (has_sword(state, player) or state.has(fire_wand, player))) - or has_ice_grapple_logic(False, state, world))) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world))) set_rule(world.get_location("Sealed Temple - Page Pickup"), lambda state: state.has(laurels, player) or (has_lantern(state, world) and (has_sword(state, player) or state.has(fire_wand, player))) - or has_ice_grapple_logic(False, state, world)) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) set_rule(world.get_location("West Furnace - Lantern Pickup"), lambda state: has_stick(state, player) or state.has_any({fire_wand, laurels}, player)) @@ -254,7 +267,7 @@ def set_location_rules(world: "TunicWorld") -> None: lambda state: state.has(laurels, player) and has_ability(holy_cross, state, world)) set_rule(world.get_location("West Garden - [East Lowlands] Page Behind Ice Dagger House"), lambda state: (state.has(laurels, player) and has_ability(prayer, state, world)) - or has_ice_grapple_logic(True, state, world)) + or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)) set_rule(world.get_location("West Garden - [Central Lowlands] Below Left Walkway"), lambda state: state.has(laurels, player)) set_rule(world.get_location("West Garden - [Central Highlands] After Garden Knight"), @@ -265,12 +278,15 @@ def set_location_rules(world: "TunicWorld") -> None: # Ruined Atoll set_rule(world.get_location("Ruined Atoll - [West] Near Kevin Block"), lambda state: state.has(laurels, player)) + # ice grapple push a crab through the door set_rule(world.get_location("Ruined Atoll - [East] Locked Room Lower Chest"), - lambda state: state.has(laurels, player) or state.has(key, player, 2)) + lambda state: state.has(laurels, player) or state.has(key, player, 2) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) set_rule(world.get_location("Ruined Atoll - [East] Locked Room Upper Chest"), - lambda state: state.has(laurels, player) or state.has(key, player, 2)) + lambda state: state.has(laurels, player) or state.has(key, player, 2) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)) set_rule(world.get_location("Librarian - Hexagon Green"), - lambda state: has_sword(state, player) or options.logic_rules) + lambda state: has_sword(state, player)) # Frog's Domain set_rule(world.get_location("Frog's Domain - Side Room Grapple Secret"), @@ -285,10 +301,12 @@ def set_location_rules(world: "TunicWorld") -> None: lambda state: state.has(laurels, player)) set_rule(world.get_location("Fortress Arena - Siege Engine/Vault Key Pickup"), lambda state: has_sword(state, player) - and (has_ability(prayer, state, world) or has_ice_grapple_logic(False, state, world))) + and (has_ability(prayer, state, world) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world))) set_rule(world.get_location("Fortress Arena - Hexagon Red"), lambda state: state.has(vault_key, player) - and (has_ability(prayer, state, world) or has_ice_grapple_logic(False, state, world))) + and (has_ability(prayer, state, world) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world))) # Beneath the Vault set_rule(world.get_location("Beneath the Fortress - Bridge"), @@ -301,14 +319,14 @@ def set_location_rules(world: "TunicWorld") -> None: lambda state: state.has(laurels, player)) set_rule(world.get_location("Rooted Ziggurat Upper - Near Bridge Switch"), lambda state: has_sword(state, player) or state.has_all({fire_wand, laurels}, player)) - # nmg - kill boss scav with orb + firecracker, or similar set_rule(world.get_location("Rooted Ziggurat Lower - Hexagon Blue"), - lambda state: has_sword(state, player) or (state.has(grapple, player) and options.logic_rules)) + lambda state: has_sword(state, player)) # Swamp set_rule(world.get_location("Cathedral Gauntlet - Gauntlet Reward"), lambda state: (state.has(fire_wand, player) and has_sword(state, player)) - and (state.has(laurels, player) or has_ice_grapple_logic(False, state, world))) + and (state.has(laurels, player) + or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world))) set_rule(world.get_location("Swamp - [Entrance] Above Entryway"), lambda state: state.has(laurels, player)) set_rule(world.get_location("Swamp - [South Graveyard] Upper Walkway Dash Chest"), @@ -335,8 +353,16 @@ def set_location_rules(world: "TunicWorld") -> None: # Bombable Walls for location_name in bomb_walls: # has_sword is there because you can buy bombs in the shop - set_rule(world.get_location(location_name), lambda state: state.has(gun, player) or has_sword(state, player)) + set_rule(world.get_location(location_name), + lambda state: state.has(gun, player) + or has_sword(state, player) + or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world)) add_rule(world.get_location("Cube Cave - Holy Cross Chest"), + lambda state: state.has(gun, player) + or has_sword(state, player) + or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world)) + # can't ice grapple to this one, not enough space + set_rule(world.get_location("Quarry - [East] Bombable Wall"), lambda state: state.has(gun, player) or has_sword(state, player)) # Shop diff --git a/worlds/tunic/test/test_access.py b/worlds/tunic/test/test_access.py index 72d4a498d1ee..bbceb7468ff3 100644 --- a/worlds/tunic/test/test_access.py +++ b/worlds/tunic/test/test_access.py @@ -68,3 +68,57 @@ def test_overworld_hc_chest(self) -> None: self.assertFalse(self.can_reach_location("Overworld - [Southwest] Flowers Holy Cross")) self.collect_by_name(["Pages 42-43 (Holy Cross)"]) self.assertTrue(self.can_reach_location("Overworld - [Southwest] Flowers Holy Cross")) + + +class TestERSpecial(TunicTestBase): + options = {options.EntranceRando.internal_name: options.EntranceRando.option_yes, + options.AbilityShuffling.internal_name: options.AbilityShuffling.option_true, + options.HexagonQuest.internal_name: options.HexagonQuest.option_false, + options.FixedShop.internal_name: options.FixedShop.option_false, + options.IceGrappling.internal_name: options.IceGrappling.option_easy, + "plando_connections": [ + { + "entrance": "Stick House Entrance", + "exit": "Ziggurat Portal Room Entrance" + }, + { + "entrance": "Ziggurat Lower to Ziggurat Tower", + "exit": "Secret Gathering Place Exit" + } + ]} + # with these plando connections, you need to ice grapple from the back of lower zig to the front to get laurels + + +# ensure that ladder storage connections connect to the outlet region, not the portal's region +class TestLadderStorage(TunicTestBase): + options = {options.EntranceRando.internal_name: options.EntranceRando.option_yes, + options.AbilityShuffling.internal_name: options.AbilityShuffling.option_true, + options.HexagonQuest.internal_name: options.HexagonQuest.option_false, + options.FixedShop.internal_name: options.FixedShop.option_false, + options.LadderStorage.internal_name: options.LadderStorage.option_hard, + options.LadderStorageWithoutItems.internal_name: options.LadderStorageWithoutItems.option_false, + "plando_connections": [ + { + "entrance": "Fortress Courtyard Shop", + # "exit": "Ziggurat Portal Room Exit" + "exit": "Spawn to Far Shore" + }, + { + "entrance": "Fortress Courtyard to Beneath the Vault", + "exit": "Stick House Exit" + }, + { + "entrance": "Stick House Entrance", + "exit": "Fortress Courtyard to Overworld" + }, + { + "entrance": "Old House Waterfall Entrance", + "exit": "Ziggurat Portal Room Entrance" + }, + ]} + + def test_ls_to_shop_entrance(self) -> None: + self.collect_by_name(["Magic Orb"]) + self.assertFalse(self.can_reach_location("Fortress Courtyard - Page Near Cave")) + self.collect_by_name(["Pages 24-25 (Prayer)"]) + self.assertTrue(self.can_reach_location("Fortress Courtyard - Page Near Cave"))