From 34080476efa40def24f2f72b50ca13908e18db5f Mon Sep 17 00:00:00 2001 From: Scipio Wright Date: Wed, 31 Jul 2024 11:17:06 -0400 Subject: [PATCH] Add directions to shop portals --- worlds/tunic/er_scripts.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/worlds/tunic/er_scripts.py b/worlds/tunic/er_scripts.py index a8bb4a767a..57fc238a3a 100644 --- a/worlds/tunic/er_scripts.py +++ b/worlds/tunic/er_scripts.py @@ -1,7 +1,7 @@ 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, tunic_er_regions, portal_mapping, traversal_requirements, DeadEnd, Direction from .er_rules import set_er_region_rules from Options import PlandoConnection from .options import EntranceRando, EntranceLayout @@ -322,8 +322,12 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal break # if it's not a dead end, it might be a shop if p_exit == "Shop Portal": + # 6 of the shops have south exits, 2 of them have west exits + dir = Direction.south + if world.shop_num > 6: + dir = Direction.west portal2 = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}", - destination="Previous Region", tag="_") + destination="Previous Region", tag="_", direction=dir) create_shop_region(world, regions) shop_count -= 1 # need to maintain an even number of portals total @@ -457,7 +461,7 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal if "TUNIC" in world.multiworld.re_gen_passthrough: shop_count = 0 - for i in range(shop_count): + for _ in range(shop_count): portal1 = None for portal in two_plus: if portal.scene() not in shop_scenes: @@ -467,8 +471,12 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal break if portal1 is None: raise Exception("Too many shops in the pool, or something else went wrong.") + # 6 of the shops have south exits, 2 of them have west exits + dir = Direction.south + if world.shop_num > 6: + dir = Direction.west portal2 = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}", - destination="Previous Region", tag="_") + destination="Previous Region", tag="_", direction=dir) create_shop_region(world, regions) portal_pairs[portal1] = portal2