예제 #1
0
    def create_regions(self):
        world = self.world
        menu = self.create_region("Menu")
        world.regions.append(menu)
        start = Entrance(self.player, "Start Game", menu)
        menu.exits.append(start)

        # workaround for now, remove duplicate locations
        already_placed_locations = set()

        for region_name, locations in locations_by_region.items():
            locations -= already_placed_locations
            already_placed_locations |= locations
            region = self.create_region(region_name)
            if region_name == "SunkenGladesRunaway":  # starting point
                start.connect(region)
            region.locations = {Location(self.player, location, lookup_name_to_id[location], region)
                                for location in locations}
            world.regions.append(region)

        for region_name, exits in connectors.items():
            parent = world.get_region(region_name, self.player)
            for exit in exits:
                connection = Entrance(self.player, exit, parent)
                connection.connect(world.get_region(exit, self.player))
                parent.exits.append(connection)
예제 #2
0
def create_no_logic_connections(player, world, connections):
    for entrance, parent_region, target_region, *rule_override in connections:
        parent = world.get_region(parent_region, player)
        target = world.get_region(target_region, player)
        connection = Entrance(player, entrance, parent)
        parent.exits.append(connection)
        connection.connect(target)
예제 #3
0
    def create_regions(self):
        player = self.player
        menu = Region("Menu", RegionType.Generic, "Menu", player, self.world)
        crash = Entrance(player, "Crash Land", menu)
        menu.exits.append(crash)
        nauvis = Region("Nauvis", RegionType.Generic, "Nauvis", player,
                        self.world)

        skip_silo = self.world.silo[self.player].value == Silo.option_spawn
        for tech_name, tech_id in base_tech_table.items():
            if skip_silo and tech_name == "rocket-silo":
                continue
            tech = Location(player, tech_name, tech_id, nauvis)
            nauvis.locations.append(tech)
            tech.game = "Factorio"
        location = Location(player, "Rocket Launch", None, nauvis)
        nauvis.locations.append(location)
        location.game = "Factorio"
        event = FactorioItem("Victory", ItemClassification.progression, None,
                             player)
        event.game = "Factorio"
        self.world.push_item(location, event, False)
        location.event = location.locked = True
        for ingredient in self.world.max_science_pack[
                self.player].get_allowed_packs():
            location = Location(player, f"Automate {ingredient}", None, nauvis)
            location.game = "Factorio"
            nauvis.locations.append(location)
            event = FactorioItem(f"Automated {ingredient}",
                                 ItemClassification.progression, None, player)
            self.world.push_item(location, event, False)
            location.event = location.locked = True
        crash.connect(nauvis)
        self.world.regions += [menu, nauvis]
예제 #4
0
def create_owg_connections(player, world, connections, default_rule):
    for entrance, parent_region, target_region, *rule_override in connections:
        parent = world.get_region(parent_region, player)
        target = world.get_region(target_region, player)
        connection = Entrance(player, entrance, parent)
        parent.exits.append(connection)
        connection.connect(target)
        rule = rule_override[0] if len(rule_override) > 0 else default_rule
        connection.access_rule = rule
예제 #5
0
def connect_regions(world: MultiWorld, player: int, source: str, target: str, rule):
    sourceRegion = world.get_region(source, player)
    targetRegion = world.get_region(target, player)

    connection = Entrance(player,'', sourceRegion)
    connection.access_rule = rule

    sourceRegion.exits.append(connection)
    connection.connect(targetRegion)
예제 #6
0
def factorio_create_regions(world: MultiWorld, player: int):
    menu = Region("Menu", None, "Menu", player)
    crash = Entrance(player, "Crash Land", menu)
    menu.exits.append(crash)
    nauvis = Region("Nauvis", None, "Nauvis", player)
    nauvis.world = menu.world = world
    for tech_name, tech_id in tech_table.items():
        tech = Location(player, tech_name, tech_id, nauvis)
        nauvis.locations.append(tech)
        tech.game = "Factorio"
    crash.connect(nauvis)
    world.regions += [menu, nauvis]
예제 #7
0
    def create_regions(self):
        self.create_locations(self.player)
        startRegion = self.create_region(self.world, self.player, 'Menu')
        self.world.regions.append(startRegion)

        for region in self.smz3World.Regions:
            currentRegion = self.create_region(self.world, self.player, region.Name, region.locationLookup.keys(), [region.Name + "->" + 'Menu'])
            self.world.regions.append(currentRegion)
            entrance = self.world.get_entrance(region.Name + "->" + 'Menu', self.player)
            entrance.connect(startRegion)
            exit = Entrance(self.player, 'Menu' + "->" + region.Name, startRegion)
            startRegion.exits.append(exit)
            exit.connect(currentRegion)
예제 #8
0
    def connect(self, world: MultiWorld, player: int, source: str, target: str, player_logic: WitnessPlayerLogic,
                panel_hex_to_solve_set=None):
        """
        connect two regions and set the corresponding requirement
        """
        source_region = world.get_region(source, player)
        target_region = world.get_region(target, player)

        connection = Entrance(
            player,
            source + " to " + target + " via " + str(panel_hex_to_solve_set),
            source_region
        )

        connection.access_rule = self.make_lambda(panel_hex_to_solve_set, world, player, player_logic)

        source_region.exits.append(connection)
        connection.connect(target_region)
예제 #9
0
    def generate_region(
            self,
            parent: Region,
            size: int,
            access_rule: CollectionRule = lambda state: True) -> Region:
        region_tag = "_region" + str(len(self.regions))
        region_name = "player" + str(self.id) + region_tag
        region = Region("player" + str(self.id) + region_tag,
                        RegionType.Generic, "Region Hint", self.id, self.world)
        self.locations += generate_locations(size, self.id, None, region,
                                             region_tag)

        entrance = Entrance(self.id, region_name + "_entrance", parent)
        parent.exits.append(entrance)
        entrance.connect(region)
        entrance.access_rule = access_rule

        self.regions.append(region)
        self.world.regions.append(region)

        return region
예제 #10
0
def connect(world: MultiWorld,
            player: int,
            used_names: Dict[str, int],
            source: str,
            target: str,
            rule: Optional[Callable] = None):
    sourceRegion = world.get_region(source, player)
    targetRegion = world.get_region(target, player)

    if target not in used_names:
        used_names[target] = 1
        name = target
    else:
        used_names[target] += 1
        name = target + (' ' * used_names[target])

    connection = Entrance(player, name, sourceRegion)

    if rule:
        connection.access_rule = rule

    sourceRegion.exits.append(connection)
    connection.connect(targetRegion)
예제 #11
0
def connectStartingRegion(world: MultiWorld, player: int):
    menu = world.get_region('Menu', player)
    tutorial = world.get_region('Tutorial', player)
    space_time_continuum = world.get_region('Space time continuum', player)

    if is_option_enabled(world, player, "Inverted"):
        starting_region = world.get_region('Refugee Camp', player)
    else:
        starting_region = world.get_region('Lake desolation', player)

    menu_to_tutorial = Entrance(player, 'Tutorial', menu)
    menu_to_tutorial.connect(tutorial)
    menu.exits.append(menu_to_tutorial)

    tutorial_to_start = Entrance(player, 'Start Game', tutorial)
    tutorial_to_start.connect(starting_region)
    tutorial.exits.append(tutorial_to_start)

    teleport_back_to_start = Entrance(player, 'Teleport back to start',
                                      space_time_continuum)
    teleport_back_to_start.connect(starting_region)
    space_time_continuum.exits.append(teleport_back_to_start)
예제 #12
0
def underworld_glitch_connections(world, player):
    specrock = world.get_region('Spectacle Rock Cave (Bottom)', player)
    mire = world.get_region('Misery Mire (West)', player)

    kikiskip = Entrance(player, 'Kiki Skip', specrock)
    mire_to_hera = Entrance(player, 'Mire to Hera Clip', mire)
    mire_to_swamp = Entrance(player, 'Hera to Swamp Clip', mire)
    specrock.exits.append(kikiskip)
    mire.exits.extend([mire_to_hera, mire_to_swamp])

    if world.fix_fake_world[player]:
        kikiskip.connect(
            world.get_entrance('Palace of Darkness Exit',
                               player).connected_region)
        mire_to_hera.connect(
            world.get_entrance('Tower of Hera Exit', player).connected_region)
        mire_to_swamp.connect(
            world.get_entrance('Swamp Palace Exit', player).connected_region)
    else:
        kikiskip.connect(
            world.get_region('Palace of Darkness (Entrance)', player))
        mire_to_hera.connect(world.get_region('Tower of Hera (Bottom)',
                                              player))
        mire_to_swamp.connect(
            world.get_region('Swamp Palace (Entrance)', player))