From 4ae885f392261b939e6f21b47d545f609c6e1965 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 27 Aug 2025 17:14:57 -0400 Subject: Set apworld victory condition --- apworld/regions.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'apworld/regions.py') diff --git a/apworld/regions.py b/apworld/regions.py index 1c8e672..fe2c99b 100644 --- a/apworld/regions.py +++ b/apworld/regions.py @@ -1,6 +1,7 @@ from typing import TYPE_CHECKING -from BaseClasses import Region +from BaseClasses import Region, ItemClassification, Entrance +from .items import Lingo2Item from .locations import Lingo2Location from .player_logic import AccessRequirements from .rules import make_location_lambda @@ -18,6 +19,12 @@ def create_region(room, world: "Lingo2World") -> Region: new_location.access_rule = make_location_lambda(location.reqs, world) new_region.locations.append(new_location) + for event_name, item_name in world.player_logic.event_loc_item_by_room.get(room.id, {}).items(): + new_location = Lingo2Location(world.player, event_name, None, new_region) + event_item = Lingo2Item(item_name, ItemClassification.progression, None, world.player) + new_location.place_locked_item(event_item) + new_region.locations.append(new_location) + return new_region @@ -73,6 +80,13 @@ def create_regions(world: "Lingo2World"): connection_name = f"{connection_name} (via panel {panel.name})" if from_region in regions and to_region in regions: - regions[from_region].connect(regions[to_region], connection_name, make_location_lambda(reqs, world)) + connection = Entrance(world.player, connection_name, regions[from_region]) + connection.access_rule = make_location_lambda(reqs, world) + + regions[from_region].exits.append(connection) + connection.connect(regions[to_region]) + + for region in reqs.rooms: + world.multiworld.register_indirect_condition(regions[region], connection) world.multiworld.regions += regions.values() -- cgit 1.4.1