From d0c9868f911b47c39e7a36a7703f5c5fbcfb3e64 Mon Sep 17 00:00:00 2001 From: Scipio Wright Date: Wed, 7 Aug 2024 20:21:11 -0400 Subject: [PATCH] Fix a few minor bugs --- worlds/tunic/__init__.py | 10 ---------- worlds/tunic/er_data.py | 11 ++++++----- worlds/tunic/er_scripts.py | 13 +++++++++---- worlds/tunic/options.py | 6 +++--- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/worlds/tunic/__init__.py b/worlds/tunic/__init__.py index a53dde4552..89ac97d5b3 100644 --- a/worlds/tunic/__init__.py +++ b/worlds/tunic/__init__.py @@ -88,16 +88,6 @@ class TunicWorld(World): def generate_early(self) -> None: if self.options.plando_connections: for index, cxn in enumerate(self.options.plando_connections): - # making shops second to simplify other things later - if cxn.entrance.startswith("Shop"): - replacement = PlandoConnection(cxn.exit, "Shop Portal", "both") - self.options.plando_connections.value.remove(cxn) - self.options.plando_connections.value.insert(index, replacement) - elif cxn.exit.startswith("Shop"): - replacement = PlandoConnection(cxn.entrance, "Shop Portal", "both") - self.options.plando_connections.value.remove(cxn) - self.options.plando_connections.value.insert(index, replacement) - if (self.options.entrance_layout == EntranceLayout.option_direction_pairs and not verify_plando_directions(cxn)): raise OptionError(f"TUNIC: Player {self.player_name} has invalid plando connections. " diff --git a/worlds/tunic/er_data.py b/worlds/tunic/er_data.py index 72345c935e..5d5a84d033 100644 --- a/worlds/tunic/er_data.py +++ b/worlds/tunic/er_data.py @@ -533,6 +533,7 @@ 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 class DeadEnd(IntEnum): @@ -545,9 +546,9 @@ class DeadEnd(IntEnum): # key is the AP region name. "Fake" in region info just means the mod won't receive that info at all tunic_er_regions: Dict[str, RegionInfo] = { - "Menu": RegionInfo("Fake", dead_end=DeadEnd.all_cats), + "Menu": RegionInfo("Fake", dead_end=DeadEnd.all_cats, is_fake_region=True), "Overworld": RegionInfo("Overworld Redux"), # main overworld, the central area - "Overworld Holy Cross": RegionInfo("Fake", dead_end=DeadEnd.all_cats), # main overworld holy cross checks + "Overworld Holy Cross": RegionInfo("Fake", dead_end=DeadEnd.all_cats, is_fake_region=True), # main overworld holy cross checks "Overworld Belltower": RegionInfo("Overworld Redux"), # the area with the belltower and chest "Overworld Belltower at Bell": RegionInfo("Overworld Redux"), # being able to ring the belltower, basically "Overworld Swamp Upper Entry": RegionInfo("Overworld Redux"), # upper swamp entry spot @@ -640,7 +641,7 @@ tunic_er_regions: Dict[str, RegionInfo] = { "West Garden Laurels Exit Region": RegionInfo("Archipelagos Redux"), "West Garden before Boss": RegionInfo("Archipelagos Redux"), # main west garden "West Garden after Boss": RegionInfo("Archipelagos Redux"), - "West Garden Hero's Grave Region": RegionInfo("Archipelagos Redux", outlet_region="West Garden"), + "West Garden Hero's Grave Region": RegionInfo("Archipelagos Redux", outlet_region="West Garden before Terry"), "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 @@ -721,7 +722,7 @@ tunic_er_regions: Dict[str, RegionInfo] = { "Rooted Ziggurat Lower Front": RegionInfo("ziggurat2020_3"), # the front for combat logic "Rooted Ziggurat Lower Mid Checkpoint": RegionInfo("ziggurat2020_3"), # the mid-checkpoint before double admin "Rooted Ziggurat Lower Back": RegionInfo("ziggurat2020_3"), # the boss side - "Zig Skip Exit": RegionInfo("ziggurat2020_3", dead_end=DeadEnd.special, outlet_region="Rooted Ziggurat Lower Front"), # for use with fixed shop on + "Zig Skip Exit": RegionInfo("ziggurat2020_3", dead_end=DeadEnd.special, outlet_region="Rooted Ziggurat Lower Entry", is_fake_region=True), # 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", outlet_region="Rooted Ziggurat Portal Room"), "Rooted Ziggurat Portal Room": RegionInfo("ziggurat2020_FTRoom"), @@ -757,7 +758,7 @@ tunic_er_regions: Dict[str, RegionInfo] = { "Purgatory": RegionInfo("Purgatory"), "Shop": RegionInfo("Shop", dead_end=DeadEnd.all_cats), "Spirit Arena": RegionInfo("Spirit Arena", dead_end=DeadEnd.all_cats), - "Spirit Arena Victory": RegionInfo("Spirit Arena", dead_end=DeadEnd.all_cats) + "Spirit Arena Victory": RegionInfo("Spirit Arena", dead_end=DeadEnd.all_cats, is_fake_region=True), } diff --git a/worlds/tunic/er_scripts.py b/worlds/tunic/er_scripts.py index 9fd9f5d460..b6190d0165 100644 --- a/worlds/tunic/er_scripts.py +++ b/worlds/tunic/er_scripts.py @@ -137,7 +137,7 @@ def vanilla_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Por if portal2_sdt.startswith("Shop,"): portal2 = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}", - destination="Previous Region", tag="_", direction=Direction.none) + destination=str(world.shop_num), tag="_", direction=Direction.none) create_shop_region(world, regions) for portal in portal_map: @@ -266,7 +266,7 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal if world.shop_num > 6: shop_dir = Direction.west shop_portal = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}", - destination="Previous Region", tag="_", direction=shop_dir) + destination=str(world.shop_num), tag="_", direction=shop_dir) create_shop_region(world, regions) dead_ends.append(shop_portal) @@ -382,7 +382,7 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal shop_dir = Direction.west portal2 = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}", - destination="Previous Region", tag="_", direction=shop_dir) + destination=str(world.shop_num), tag="_", direction=shop_dir) create_shop_region(world, regions) shop_count -= 1 # need to maintain an even number of portals total @@ -446,7 +446,7 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal f"Did {player_name} plando the Windmill Shop entrance?") portal2 = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}", - destination="Previous Region", tag="_", direction=Direction.south) + destination=str(world.shop_num), tag="_", direction=Direction.south) create_shop_region(world, regions) portal_pairs[portal1] = portal2 @@ -582,6 +582,11 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal if two_plus != two_plus2: random_object.shuffle(two_plus2) + print(len(connected_regions)) + print(len(non_dead_end_regions)) + print(non_dead_end_regions - connected_regions) + print(connected_regions - non_dead_end_regions) + # connect dead ends to random non-dead ends # there are no dead ends in decoupled floor_count = 0 diff --git a/worlds/tunic/options.py b/worlds/tunic/options.py index ec0dc06933..0d65f9ba36 100644 --- a/worlds/tunic/options.py +++ b/worlds/tunic/options.py @@ -193,9 +193,9 @@ class TunicPlandoConnections(PlandoConnections): Note that you will wrong warp if you have multiple shops in the same scene. If the Entrance Layout option is set to Direction Pairs, your plando connections must be facing opposite directions. """ - entrances = {*(portal.name for portal in portal_mapping), "Shop", "Shop Portal"} - exits = {*(portal.name for portal in portal_mapping), "Shop", "Shop Portal"} - + entrances = {*(portal.name for portal in portal_mapping), "Shop Portal"} + exits = {*(portal.name for portal in portal_mapping), "Shop Portal"} + # todo: find a way to allow arbitrary numbering duplicate_exits = True