コード例 #1
0
def create_region(world: MultiWorld,
                  player: int,
                  name: str,
                  locat: WitnessPlayerLocations,
                  region_locations=None,
                  exits=None):
    """
    Create an Archipelago Region for The Witness
    """

    ret = Region(name, RegionType.Generic, name, player)
    ret.world = world
    if region_locations:
        for location in region_locations:
            loc_id = locat.CHECK_LOCATION_TABLE[location]

            check_hex = -1
            if location in StaticWitnessLogic.CHECKS_BY_NAME:
                check_hex = int(
                    StaticWitnessLogic.CHECKS_BY_NAME[location]["checkHex"], 0)
            location = WitnessLocation(player, location, loc_id, ret,
                                       check_hex)

            ret.locations.append(location)
    if exits:
        for single_exit in exits:
            ret.exits.append(Entrance(player, single_exit, ret))

    return ret
コード例 #2
0
def copy_dynamic_regions_and_locations(world, ret):
    for region in world.dynamic_regions:
        new_reg = Region(region.name, region.type, region.hint_text,
                         region.player)
        new_reg.world = ret
        ret.regions.append(new_reg)
        ret.dynamic_regions.append(new_reg)

        # Note: ideally exits should be copied here, but the current use case (Take anys) do not require this

        if region.shop:
            new_reg.shop = Shop(new_reg, region.shop.room_id, region.shop.type,
                                region.shop.shopkeeper_config,
                                region.shop.replaceable)
            ret.shops.append(new_reg.shop)

    for location in world.dynamic_locations:
        new_reg = ret.get_region(location.parent_region.name,
                                 location.parent_region.player)
        new_loc = Location(location.player, location.name, location.address,
                           location.crystal, location.hint_text, new_reg)
        # todo: this is potentially dangerous. later refactor so we
        # can apply dynamic region rules on top of copied world like other rules
        new_loc.access_rule = location.access_rule
        new_loc.always_allow = location.always_allow
        new_loc.item_rule = location.item_rule
        new_reg.locations.append(new_loc)

        ret.clear_location_cache()
コード例 #3
0
ファイル: __init__.py プロジェクト: KonoTyran/Archipelago
def create_region(world: MultiWorld, player: int, name: str, location_names=None, exits=None) -> Region:
    ret = Region(name, RegionType.Generic, name, player)
    ret.world = world
    if location_names:
        for location in location_names:
            loc_id = HKWorld.location_name_to_id.get(location, None)
            location = HKLocation(player, location, loc_id, ret)
            ret.locations.append(location)
    if exits:
        for exit in exits:
            ret.exits.append(Entrance(player, exit, ret))
    return ret
コード例 #4
0
ファイル: __init__.py プロジェクト: KonoTyran/Archipelago
 def create_region(self, world: MultiWorld, player: int, name: str, locations=None, exits=None):
     ret = Region(name, RegionType.LightWorld, name, player)
     ret.world = world
     if locations:
         for loc in locations:
             location = self.locations[loc]
             location.parent_region = ret
             ret.locations.append(location)
     if exits:
         for exit in exits:
             ret.exits.append(Entrance(player, exit, ret))
     return ret
コード例 #5
0
def create_region(world: MultiWorld, player: int,
                  locations_per_region: Dict[str, List[LocationData]],
                  location_cache: List[Location], name: str) -> Region:
    region = Region(name, RegionType.Generic, name, player)
    region.world = world

    if name in locations_per_region:
        for location_data in locations_per_region[name]:
            location = create_location(player, location_data, region,
                                       location_cache)
            region.locations.append(location)

    return region
コード例 #6
0
def create_region(world: MultiWorld, player: int, name: str, locations=None, exits=None):
    ret = Region(name, None, name, player)
    ret.world = world
    if locations:
        for location in locations:
            loc_id = lookup_name_to_id.get(location, 0)
            location = HKLocation(player, location, loc_id, ret)
            ret.locations.append(location)
    if exits:
        for exit in exits:
            ret.exits.append(Entrance(player, exit, ret))

    return ret
コード例 #7
0
def create_region(world: MultiWorld,
                  player: int,
                  name: str,
                  locations=None,
                  exits=None):
    ret = Region(name, RegionType.Generic, name, player)
    ret.world = world
    if locations:
        for location in locations:
            loc_id = location_table.get(location, 0)
            location = SpireLocation(player, location, loc_id, ret)
            ret.locations.append(location)
    if exits:
        for exit in exits:
            ret.exits.append(Entrance(player, exit, ret))

    return ret
コード例 #8
0
ファイル: Regions.py プロジェクト: KonoTyran/Archipelago
def create_region(world: MultiWorld,
                  player: int,
                  name: str,
                  locations=None,
                  exits=None):
    # Shamelessly stolen from the ROR2 definition, lol
    ret = Region(name, RegionType.Generic, name, player)
    ret.world = world
    if locations:
        for location in locations:
            loc_id = location_table.get(location, 0)
            location = LegacyLocation(player, location, loc_id, ret)
            ret.locations.append(location)
    if exits:
        for exit in exits:
            ret.exits.append(Entrance(player, exit, ret))

    return ret
コード例 #9
0
ファイル: __init__.py プロジェクト: KonoTyran/Archipelago
def create_region(world: MultiWorld,
                  player: int,
                  name: str,
                  locations=None,
                  exits=None):
    region = Region(name, RegionType.Generic, name, player)
    region.world = world
    if locations:
        for location_name in locations.keys():
            location = ArchipIDLELocation(player, location_name,
                                          locations[location_name], region)
            region.locations.append(location)

    if exits:
        for _exit in exits:
            region.exits.append(Entrance(player, _exit, region))

    return region
コード例 #10
0
ファイル: __init__.py プロジェクト: KonoTyran/Archipelago
def create_region(world: MultiWorld,
                  player: int,
                  name: str,
                  locations=None,
                  exits=None):
    ret = Region(name, RegionType.Generic, name, player)
    ret.world = world
    if locations:
        for location in locations:
            loc_id = locations_lookup_name_to_id.get(location, 0)
            locationObj = RaftLocation(player, location, loc_id, ret)
            ret.locations.append(locationObj)
    if exits:
        for exit in exits:
            ret.exits.append(
                Entrance(player, getConnectionName(name, exit), ret))

    return ret
コード例 #11
0
def create_region(world: MultiWorld,
                  player: int,
                  active_locations,
                  name: str,
                  locations=None,
                  exits=None):
    # Shamelessly stolen from the ROR2 definition
    ret = Region(name, None, name, player)
    ret.world = world
    if locations:
        for location in locations:
            loc_id = active_locations.get(location, 0)
            if loc_id:
                location = SA2BLocation(player, location, loc_id, ret)
                ret.locations.append(location)
    if exits:
        for exit in exits:
            ret.exits.append(Entrance(player, exit, ret))

    return ret