mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
The Messenger: Transition Shuffle (#4402)
* The Messenger: transition rando * remove unused import * always link both directions for plando when using coupled transitions * er_type was renamed to randomization_type * use frozenset for things that shouldn't change * review suggestions * do portal and transition shuffle in `connect_entrances` * remove some unnecessary connections that were causing entrance caching collisions * add test for strictest possible ER settings * use unittest.skip on the skipped test, so we don't waste time doing setUp and tearDown * use the world helpers * make the plando connection description more verbose * always add searing crags portal if portal shuffle is disabled * guarantee an arbitrary number of locations with first connection * make the constraints more lenient for a bit more variety
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from functools import cached_property
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from BaseClasses import CollectionState, Entrance, Item, ItemClassification, Location, Region
|
||||
from BaseClasses import CollectionState, Entrance, EntranceType, Item, ItemClassification, Location, Region
|
||||
from entrance_rando import ERPlacementState
|
||||
from .regions import LOCATIONS, MEGA_SHARDS
|
||||
from .shop import FIGURINES, SHOP_ITEMS
|
||||
|
||||
@@ -12,9 +13,21 @@ if TYPE_CHECKING:
|
||||
class MessengerEntrance(Entrance):
|
||||
world: "MessengerWorld | None" = None
|
||||
|
||||
def can_connect_to(self, other: Entrance, dead_end: bool, state: "ERPlacementState") -> bool:
|
||||
can_connect = super().can_connect_to(other, dead_end, state)
|
||||
world: MessengerWorld = getattr(self, "world", None)
|
||||
if not world or world.reachable_locs or not can_connect:
|
||||
return can_connect
|
||||
empty_state = CollectionState(world.multiworld, True)
|
||||
self.connected_region = other.connected_region
|
||||
empty_state.update_reachable_regions(world.player)
|
||||
world.reachable_locs = any(loc.can_reach(empty_state) and not loc.is_event for loc in world.get_locations())
|
||||
self.connected_region = None
|
||||
return world.reachable_locs and (not state.coupled or self.name != other.name)
|
||||
|
||||
|
||||
class MessengerRegion(Region):
|
||||
parent: str
|
||||
parent: str | None
|
||||
entrance_type = MessengerEntrance
|
||||
|
||||
def __init__(self, name: str, world: "MessengerWorld", parent: str | None = None) -> None:
|
||||
@@ -32,8 +45,9 @@ class MessengerRegion(Region):
|
||||
for shop_loc in SHOP_ITEMS}
|
||||
self.add_locations(shop_locations, MessengerShopLocation)
|
||||
elif name == "The Craftsman's Corner":
|
||||
self.add_locations({figurine: world.location_name_to_id[figurine] for figurine in FIGURINES},
|
||||
MessengerLocation)
|
||||
self.add_locations(
|
||||
{figurine: world.location_name_to_id[figurine] for figurine in FIGURINES},
|
||||
MessengerLocation)
|
||||
elif name == "Tower HQ":
|
||||
locations.append("Money Wrench")
|
||||
|
||||
@@ -57,6 +71,7 @@ class MessengerLocation(Location):
|
||||
|
||||
|
||||
class MessengerShopLocation(MessengerLocation):
|
||||
|
||||
@cached_property
|
||||
def cost(self) -> int:
|
||||
name = self.name.removeprefix("The Shop - ")
|
||||
|
Reference in New Issue
Block a user