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

@ -170,6 +170,60 @@ portal_mapping: List[Portal] = [
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",
@ -207,116 +261,6 @@ portal_mapping: List[Portal] = [
Portal(name="Magic Dagger House Exit", region="Magic Dagger House",
destination="Archipelagos Redux", tag="_"),
Portal(name="Atoll Upper Exit", region="Ruined Atoll",
destination="Overworld Redux", tag="_upper"),
Portal(name="Atoll Lower Exit", region="Ruined Atoll Lower Entry Area",
destination="Overworld Redux", tag="_lower"),
Portal(name="Atoll Shop", region="Ruined Atoll",
destination="Shop", tag="_"),
Portal(name="Atoll to Far Shore", region="Ruined Atoll Portal",
destination="Transit", tag="_teleporter_atoll"),
Portal(name="Atoll Statue Teleporter", region="Ruined Atoll Statue",
destination="Library Exterior", tag="_"),
Portal(name="Frog Stairs Eye Entrance", region="Ruined Atoll Frog Eye",
destination="Frog Stairs", tag="_eye"),
Portal(name="Frog Stairs Mouth Entrance", region="Ruined Atoll Frog Mouth",
destination="Frog Stairs", tag="_mouth"),
Portal(name="Frog Stairs Eye Exit", region="Frog Stairs Eye Exit",
destination="Atoll Redux", tag="_eye"),
Portal(name="Frog Stairs Mouth Exit", region="Frog Stairs Upper",
destination="Atoll Redux", tag="_mouth"),
Portal(name="Frog Stairs to Frog's Domain's Entrance", region="Frog Stairs to Frog's Domain",
destination="frog cave main", tag="_Entrance"),
Portal(name="Frog Stairs to Frog's Domain's Exit", region="Frog Stairs Lower",
destination="frog cave main", tag="_Exit"),
Portal(name="Frog's Domain Ladder Exit", region="Frog's Domain Entry",
destination="Frog Stairs", tag="_Entrance"),
Portal(name="Frog's Domain Orb Exit", region="Frog's Domain Back",
destination="Frog Stairs", tag="_Exit"),
Portal(name="Library Exterior Tree", region="Library Exterior Tree Region",
destination="Atoll Redux", tag="_"),
Portal(name="Library Exterior Ladder", region="Library Exterior Ladder Region",
destination="Library Hall", tag="_"),
Portal(name="Library Hall Bookshelf Exit", region="Library Hall Bookshelf",
destination="Library Exterior", tag="_"),
Portal(name="Library Hero's Grave", region="Library Hero's Grave Region",
destination="RelicVoid", tag="_teleporter_relic plinth"),
Portal(name="Library Hall to Rotunda", region="Library Hall to Rotunda",
destination="Library Rotunda", tag="_"),
Portal(name="Library Rotunda Lower Exit", region="Library Rotunda to Hall",
destination="Library Hall", tag="_"),
Portal(name="Library Rotunda Upper Exit", region="Library Rotunda to Lab",
destination="Library Lab", tag="_"),
Portal(name="Library Lab to Rotunda", region="Library Lab Lower",
destination="Library Rotunda", tag="_"),
Portal(name="Library to Far Shore", region="Library Portal",
destination="Transit", tag="_teleporter_library teleporter"),
Portal(name="Library Lab to Librarian Arena", region="Library Lab to Librarian",
destination="Library Arena", tag="_"),
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",
@ -376,6 +320,62 @@ portal_mapping: List[Portal] = [
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",
destination="Overworld Redux", tag="_lower"),
Portal(name="Atoll Shop", region="Ruined Atoll",
destination="Shop", tag="_"),
Portal(name="Atoll to Far Shore", region="Ruined Atoll Portal",
destination="Transit", tag="_teleporter_atoll"),
Portal(name="Atoll Statue Teleporter", region="Ruined Atoll Statue",
destination="Library Exterior", tag="_"),
Portal(name="Frog Stairs Eye Entrance", region="Ruined Atoll Frog Eye",
destination="Frog Stairs", tag="_eye"),
Portal(name="Frog Stairs Mouth Entrance", region="Ruined Atoll Frog Mouth",
destination="Frog Stairs", tag="_mouth"),
Portal(name="Frog Stairs Eye Exit", region="Frog Stairs Eye Exit",
destination="Atoll Redux", tag="_eye"),
Portal(name="Frog Stairs Mouth Exit", region="Frog Stairs Upper",
destination="Atoll Redux", tag="_mouth"),
Portal(name="Frog Stairs to Frog's Domain's Entrance", region="Frog Stairs to Frog's Domain",
destination="frog cave main", tag="_Entrance"),
Portal(name="Frog Stairs to Frog's Domain's Exit", region="Frog Stairs Lower",
destination="frog cave main", tag="_Exit"),
Portal(name="Frog's Domain Ladder Exit", region="Frog's Domain Entry",
destination="Frog Stairs", tag="_Entrance"),
Portal(name="Frog's Domain Orb Exit", region="Frog's Domain Back",
destination="Frog Stairs", tag="_Exit"),
Portal(name="Library Exterior Tree", region="Library Exterior Tree Region",
destination="Atoll Redux", tag="_"),
Portal(name="Library Exterior Ladder", region="Library Exterior Ladder Region",
destination="Library Hall", tag="_"),
Portal(name="Library Hall Bookshelf Exit", region="Library Hall Bookshelf",
destination="Library Exterior", tag="_"),
Portal(name="Library Hero's Grave", region="Library Hero's Grave Region",
destination="RelicVoid", tag="_teleporter_relic plinth"),
Portal(name="Library Hall to Rotunda", region="Library Hall to Rotunda",
destination="Library Rotunda", tag="_"),
Portal(name="Library Rotunda Lower Exit", region="Library Rotunda to Hall",
destination="Library Hall", tag="_"),
Portal(name="Library Rotunda Upper Exit", region="Library Rotunda to Lab",
destination="Library Lab", tag="_"),
Portal(name="Library Lab to Rotunda", region="Library Lab Lower",
destination="Library Rotunda", tag="_"),
Portal(name="Library to Far Shore", region="Library Portal",
destination="Transit", tag="_teleporter_library teleporter"),
Portal(name="Library Lab to Librarian Arena", region="Library Lab to Librarian",
destination="Library Arena", tag="_"),
Portal(name="Librarian Arena Exit", region="Library Arena",
destination="Library Lab", tag="_"),
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