TUNIC: Sort entrances in the spoiler log (#3733)

* Sort entrances in spoiler log

* Rearrange portal list to closer match the vanilla game order, for better spoiler and because I already did this mod-side

* Add break (thanks vi)
This commit is contained in:
Scipio Wright 2024-08-07 12:18:50 -04:00 committed by GitHub
parent 6297a4efa5
commit cf6661439e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 144 additions and 118 deletions

View File

@ -169,7 +169,61 @@ portal_mapping: List[Portal] = [
destination="Overworld Redux", tag="_rafters"),
Portal(name="Temple Door Exit", region="Sealed Temple",
destination="Overworld Redux", tag="_main"),
Portal(name="Forest Belltower to Fortress", region="Forest Belltower Main",
destination="Fortress Courtyard", tag="_"),
Portal(name="Forest Belltower to Forest", region="Forest Belltower Lower",
destination="East Forest Redux", tag="_"),
Portal(name="Forest Belltower to Overworld", region="Forest Belltower Main",
destination="Overworld Redux", tag="_"),
Portal(name="Forest Belltower to Guard Captain Room", region="Forest Belltower Upper",
destination="Forest Boss Room", tag="_"),
Portal(name="Forest to Belltower", region="East Forest",
destination="Forest Belltower", tag="_"),
Portal(name="Forest Guard House 1 Lower Entrance", region="East Forest",
destination="East Forest Redux Laddercave", tag="_lower"),
Portal(name="Forest Guard House 1 Gate Entrance", region="East Forest",
destination="East Forest Redux Laddercave", tag="_gate"),
Portal(name="Forest Dance Fox Outside Doorway", region="East Forest Dance Fox Spot",
destination="East Forest Redux Laddercave", tag="_upper"),
Portal(name="Forest to Far Shore", region="East Forest Portal",
destination="Transit", tag="_teleporter_forest teleporter"),
Portal(name="Forest Guard House 2 Lower Entrance", region="Lower Forest",
destination="East Forest Redux Interior", tag="_lower"),
Portal(name="Forest Guard House 2 Upper Entrance", region="East Forest",
destination="East Forest Redux Interior", tag="_upper"),
Portal(name="Forest Grave Path Lower Entrance", region="East Forest",
destination="Sword Access", tag="_lower"),
Portal(name="Forest Grave Path Upper Entrance", region="East Forest",
destination="Sword Access", tag="_upper"),
Portal(name="Forest Grave Path Upper Exit", region="Forest Grave Path Upper",
destination="East Forest Redux", tag="_upper"),
Portal(name="Forest Grave Path Lower Exit", region="Forest Grave Path Main",
destination="East Forest Redux", tag="_lower"),
Portal(name="East Forest Hero's Grave", region="Forest Hero's Grave",
destination="RelicVoid", tag="_teleporter_relic plinth"),
Portal(name="Guard House 1 Dance Fox Exit", region="Guard House 1 West",
destination="East Forest Redux", tag="_upper"),
Portal(name="Guard House 1 Lower Exit", region="Guard House 1 West",
destination="East Forest Redux", tag="_lower"),
Portal(name="Guard House 1 Upper Forest Exit", region="Guard House 1 East",
destination="East Forest Redux", tag="_gate"),
Portal(name="Guard House 1 to Guard Captain Room", region="Guard House 1 East",
destination="Forest Boss Room", tag="_"),
Portal(name="Guard House 2 Lower Exit", region="Guard House 2 Lower",
destination="East Forest Redux", tag="_lower"),
Portal(name="Guard House 2 Upper Exit", region="Guard House 2 Upper",
destination="East Forest Redux", tag="_upper"),
Portal(name="Guard Captain Room Non-Gate Exit", region="Forest Boss Room",
destination="East Forest Redux Laddercave", tag="_"),
Portal(name="Guard Captain Room Gate Exit", region="Forest Boss Room",
destination="Forest Belltower", tag="_"),
Portal(name="Well Ladder Exit", region="Beneath the Well Ladder Exit",
destination="Overworld Redux", tag="_entrance"),
Portal(name="Well to Well Boss", region="Beneath the Well Back",
@ -206,7 +260,66 @@ portal_mapping: List[Portal] = [
Portal(name="Magic Dagger House Exit", region="Magic Dagger House",
destination="Archipelagos Redux", tag="_"),
Portal(name="Fortress Courtyard to Fortress Grave Path Lower", region="Fortress Courtyard",
destination="Fortress Reliquary", tag="_Lower"),
Portal(name="Fortress Courtyard to Fortress Grave Path Upper", region="Fortress Courtyard Upper",
destination="Fortress Reliquary", tag="_Upper"),
Portal(name="Fortress Courtyard to Fortress Interior", region="Fortress Courtyard",
destination="Fortress Main", tag="_Big Door"),
Portal(name="Fortress Courtyard to East Fortress", region="Fortress Courtyard Upper",
destination="Fortress East", tag="_"),
Portal(name="Fortress Courtyard to Beneath the Vault", region="Beneath the Vault Entry",
destination="Fortress Basement", tag="_"),
Portal(name="Fortress Courtyard to Forest Belltower", region="Fortress Exterior from East Forest",
destination="Forest Belltower", tag="_"),
Portal(name="Fortress Courtyard to Overworld", region="Fortress Exterior from Overworld",
destination="Overworld Redux", tag="_"),
Portal(name="Fortress Courtyard Shop", region="Fortress Exterior near cave",
destination="Shop", tag="_"),
Portal(name="Beneath the Vault to Fortress Interior", region="Beneath the Vault Back",
destination="Fortress Main", tag="_"),
Portal(name="Beneath the Vault to Fortress Courtyard", region="Beneath the Vault Ladder Exit",
destination="Fortress Courtyard", tag="_"),
Portal(name="Fortress Interior Main Exit", region="Eastern Vault Fortress",
destination="Fortress Courtyard", tag="_Big Door"),
Portal(name="Fortress Interior to Beneath the Earth", region="Eastern Vault Fortress",
destination="Fortress Basement", tag="_"),
Portal(name="Fortress Interior to Siege Engine Arena", region="Eastern Vault Fortress Gold Door",
destination="Fortress Arena", tag="_"),
Portal(name="Fortress Interior Shop", region="Eastern Vault Fortress",
destination="Shop", tag="_"),
Portal(name="Fortress Interior to East Fortress Upper", region="Eastern Vault Fortress",
destination="Fortress East", tag="_upper"),
Portal(name="Fortress Interior to East Fortress Lower", region="Eastern Vault Fortress",
destination="Fortress East", tag="_lower"),
Portal(name="East Fortress to Interior Lower", region="Fortress East Shortcut Lower",
destination="Fortress Main", tag="_lower"),
Portal(name="East Fortress to Courtyard", region="Fortress East Shortcut Upper",
destination="Fortress Courtyard", tag="_"),
Portal(name="East Fortress to Interior Upper", region="Fortress East Shortcut Upper",
destination="Fortress Main", tag="_upper"),
Portal(name="Fortress Grave Path Lower Exit", region="Fortress Grave Path",
destination="Fortress Courtyard", tag="_Lower"),
Portal(name="Fortress Hero's Grave", region="Fortress Hero's Grave Region",
destination="RelicVoid", tag="_teleporter_relic plinth"),
Portal(name="Fortress Grave Path Upper Exit", region="Fortress Grave Path Upper",
destination="Fortress Courtyard", tag="_Upper"),
Portal(name="Fortress Grave Path Dusty Entrance", region="Fortress Grave Path Dusty Entrance Region",
destination="Dusty", tag="_"),
Portal(name="Dusty Exit", region="Fortress Leaf Piles",
destination="Fortress Reliquary", tag="_"),
Portal(name="Siege Engine Arena to Fortress", region="Fortress Arena",
destination="Fortress Main", tag="_"),
Portal(name="Fortress to Far Shore", region="Fortress Arena Portal",
destination="Transit", tag="_teleporter_spidertank"),
Portal(name="Atoll Upper Exit", region="Ruined Atoll",
destination="Overworld Redux", tag="_upper"),
Portal(name="Atoll Lower Exit", region="Ruined Atoll Lower Entry Area",
@ -263,119 +376,6 @@ portal_mapping: List[Portal] = [
Portal(name="Librarian Arena Exit", region="Library Arena",
destination="Library Lab", tag="_"),
Portal(name="Forest to Belltower", region="East Forest",
destination="Forest Belltower", tag="_"),
Portal(name="Forest Guard House 1 Lower Entrance", region="East Forest",
destination="East Forest Redux Laddercave", tag="_lower"),
Portal(name="Forest Guard House 1 Gate Entrance", region="East Forest",
destination="East Forest Redux Laddercave", tag="_gate"),
Portal(name="Forest Dance Fox Outside Doorway", region="East Forest Dance Fox Spot",
destination="East Forest Redux Laddercave", tag="_upper"),
Portal(name="Forest to Far Shore", region="East Forest Portal",
destination="Transit", tag="_teleporter_forest teleporter"),
Portal(name="Forest Guard House 2 Lower Entrance", region="Lower Forest",
destination="East Forest Redux Interior", tag="_lower"),
Portal(name="Forest Guard House 2 Upper Entrance", region="East Forest",
destination="East Forest Redux Interior", tag="_upper"),
Portal(name="Forest Grave Path Lower Entrance", region="East Forest",
destination="Sword Access", tag="_lower"),
Portal(name="Forest Grave Path Upper Entrance", region="East Forest",
destination="Sword Access", tag="_upper"),
Portal(name="Guard House 1 Dance Fox Exit", region="Guard House 1 West",
destination="East Forest Redux", tag="_upper"),
Portal(name="Guard House 1 Lower Exit", region="Guard House 1 West",
destination="East Forest Redux", tag="_lower"),
Portal(name="Guard House 1 Upper Forest Exit", region="Guard House 1 East",
destination="East Forest Redux", tag="_gate"),
Portal(name="Guard House 1 to Guard Captain Room", region="Guard House 1 East",
destination="Forest Boss Room", tag="_"),
Portal(name="Forest Grave Path Upper Exit", region="Forest Grave Path Upper",
destination="East Forest Redux", tag="_upper"),
Portal(name="Forest Grave Path Lower Exit", region="Forest Grave Path Main",
destination="East Forest Redux", tag="_lower"),
Portal(name="East Forest Hero's Grave", region="Forest Hero's Grave",
destination="RelicVoid", tag="_teleporter_relic plinth"),
Portal(name="Guard House 2 Lower Exit", region="Guard House 2 Lower",
destination="East Forest Redux", tag="_lower"),
Portal(name="Guard House 2 Upper Exit", region="Guard House 2 Upper",
destination="East Forest Redux", tag="_upper"),
Portal(name="Guard Captain Room Non-Gate Exit", region="Forest Boss Room",
destination="East Forest Redux Laddercave", tag="_"),
Portal(name="Guard Captain Room Gate Exit", region="Forest Boss Room",
destination="Forest Belltower", tag="_"),
Portal(name="Forest Belltower to Fortress", region="Forest Belltower Main",
destination="Fortress Courtyard", tag="_"),
Portal(name="Forest Belltower to Forest", region="Forest Belltower Lower",
destination="East Forest Redux", tag="_"),
Portal(name="Forest Belltower to Overworld", region="Forest Belltower Main",
destination="Overworld Redux", tag="_"),
Portal(name="Forest Belltower to Guard Captain Room", region="Forest Belltower Upper",
destination="Forest Boss Room", tag="_"),
Portal(name="Fortress Courtyard to Fortress Grave Path Lower", region="Fortress Courtyard",
destination="Fortress Reliquary", tag="_Lower"),
Portal(name="Fortress Courtyard to Fortress Grave Path Upper", region="Fortress Courtyard Upper",
destination="Fortress Reliquary", tag="_Upper"),
Portal(name="Fortress Courtyard to Fortress Interior", region="Fortress Courtyard",
destination="Fortress Main", tag="_Big Door"),
Portal(name="Fortress Courtyard to East Fortress", region="Fortress Courtyard Upper",
destination="Fortress East", tag="_"),
Portal(name="Fortress Courtyard to Beneath the Vault", region="Beneath the Vault Entry",
destination="Fortress Basement", tag="_"),
Portal(name="Fortress Courtyard to Forest Belltower", region="Fortress Exterior from East Forest",
destination="Forest Belltower", tag="_"),
Portal(name="Fortress Courtyard to Overworld", region="Fortress Exterior from Overworld",
destination="Overworld Redux", tag="_"),
Portal(name="Fortress Courtyard Shop", region="Fortress Exterior near cave",
destination="Shop", tag="_"),
Portal(name="Beneath the Vault to Fortress Interior", region="Beneath the Vault Back",
destination="Fortress Main", tag="_"),
Portal(name="Beneath the Vault to Fortress Courtyard", region="Beneath the Vault Ladder Exit",
destination="Fortress Courtyard", tag="_"),
Portal(name="Fortress Interior Main Exit", region="Eastern Vault Fortress",
destination="Fortress Courtyard", tag="_Big Door"),
Portal(name="Fortress Interior to Beneath the Earth", region="Eastern Vault Fortress",
destination="Fortress Basement", tag="_"),
Portal(name="Fortress Interior to Siege Engine Arena", region="Eastern Vault Fortress Gold Door",
destination="Fortress Arena", tag="_"),
Portal(name="Fortress Interior Shop", region="Eastern Vault Fortress",
destination="Shop", tag="_"),
Portal(name="Fortress Interior to East Fortress Upper", region="Eastern Vault Fortress",
destination="Fortress East", tag="_upper"),
Portal(name="Fortress Interior to East Fortress Lower", region="Eastern Vault Fortress",
destination="Fortress East", tag="_lower"),
Portal(name="East Fortress to Interior Lower", region="Fortress East Shortcut Lower",
destination="Fortress Main", tag="_lower"),
Portal(name="East Fortress to Courtyard", region="Fortress East Shortcut Upper",
destination="Fortress Courtyard", tag="_"),
Portal(name="East Fortress to Interior Upper", region="Fortress East Shortcut Upper",
destination="Fortress Main", tag="_upper"),
Portal(name="Fortress Grave Path Lower Exit", region="Fortress Grave Path",
destination="Fortress Courtyard", tag="_Lower"),
Portal(name="Fortress Hero's Grave", region="Fortress Hero's Grave Region",
destination="RelicVoid", tag="_teleporter_relic plinth"),
Portal(name="Fortress Grave Path Upper Exit", region="Fortress Grave Path Upper",
destination="Fortress Courtyard", tag="_Upper"),
Portal(name="Fortress Grave Path Dusty Entrance", region="Fortress Grave Path Dusty Entrance Region",
destination="Dusty", tag="_"),
Portal(name="Dusty Exit", region="Fortress Leaf Piles",
destination="Fortress Reliquary", tag="_"),
Portal(name="Siege Engine Arena to Fortress", region="Fortress Arena",
destination="Fortress Main", tag="_"),
Portal(name="Fortress to Far Shore", region="Fortress Arena Portal",
destination="Transit", tag="_teleporter_spidertank"),
Portal(name="Stairs to Top of the Mountain", region="Lower Mountain Stairs",
destination="Mountaintop", tag="_"),
Portal(name="Mountain to Quarry", region="Lower Mountain",

View File

@ -24,10 +24,10 @@ def create_er_regions(world: "TunicWorld") -> Dict[Portal, Portal]:
regions: Dict[str, Region] = {}
if world.options.entrance_rando:
portal_pairs = pair_portals(world)
# output the entrances to the spoiler log here for convenience
for portal1, portal2 in portal_pairs.items():
world.multiworld.spoiler.set_entrance(portal1.name, portal2.name, "both", world.player)
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()
@ -504,3 +504,29 @@ def update_reachable_regions(connected_regions: Set[str], traversal_reqs: Dict[s
connected_regions = update_reachable_regions(connected_regions, traversal_reqs, has_laurels, logic)
return connected_regions
# sort the portal dict by the name of the first portal, referring to the portal order in the master portal list
def sort_portals(portal_pairs: Dict[Portal, Portal]) -> Dict[str, str]:
sorted_pairs: Dict[str, str] = {}
reference_list: List[str] = [portal.name for portal in portal_mapping]
reference_list.append("Shop Portal")
# note: this is not necessary yet since the shop portals aren't numbered yet -- they will be when decoupled happens
# due to plando, there can be a variable number of shops
# I could either do it like this, or just go up to like 200, this seemed better
# shop_count = 0
# for portal1, portal2 in portal_pairs.items():
# if portal1.name.startswith("Shop"):
# shop_count += 1
# if portal2.name.startswith("Shop"):
# shop_count += 1
# reference_list.extend([f"Shop Portal {i + 1}" for i in range(shop_count)])
for name in reference_list:
for portal1, portal2 in portal_pairs.items():
if name == portal1.name:
sorted_pairs[portal1.name] = portal2.name
break
return sorted_pairs