Add directions to shop portals

This commit is contained in:
Scipio Wright
2024-07-31 11:17:06 -04:00
committed by GitHub
parent 4395ce31bb
commit 34080476ef

View File

@@ -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