2021-07-16 10:41:37 +00:00
|
|
|
from typing import Set
|
|
|
|
|
2023-06-25 22:56:16 +00:00
|
|
|
from worlds.AutoWorld import World
|
2021-07-16 10:41:37 +00:00
|
|
|
from .Items import item_table, default_pool
|
|
|
|
from .Locations import lookup_name_to_id
|
|
|
|
from .Rules import set_rules, location_rules
|
|
|
|
from .Regions import locations_by_region, connectors
|
|
|
|
from .Options import options
|
2023-02-14 00:06:43 +00:00
|
|
|
from BaseClasses import Region, Item, Location, Entrance, ItemClassification
|
2021-07-16 10:41:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class OriBlindForest(World):
|
|
|
|
game: str = "Ori and the Blind Forest"
|
|
|
|
|
|
|
|
topology_present = True
|
2023-03-20 16:01:08 +00:00
|
|
|
data_version = 1
|
2021-07-16 10:41:37 +00:00
|
|
|
|
|
|
|
item_name_to_id = item_table
|
|
|
|
location_name_to_id = lookup_name_to_id
|
|
|
|
|
2022-08-15 21:46:59 +00:00
|
|
|
option_definitions = options
|
2021-07-16 10:41:37 +00:00
|
|
|
|
2021-08-27 12:52:33 +00:00
|
|
|
hidden = True
|
|
|
|
|
2021-07-16 10:41:37 +00:00
|
|
|
def generate_early(self):
|
|
|
|
logic_sets = {"casual-core"}
|
|
|
|
for logic_set in location_rules:
|
2022-11-01 02:41:21 +00:00
|
|
|
if logic_set != "casual-core" and getattr(self.multiworld, logic_set.replace("-", "_")):
|
2021-07-16 10:41:37 +00:00
|
|
|
logic_sets.add(logic_set)
|
|
|
|
self.logic_sets = logic_sets
|
|
|
|
|
|
|
|
set_rules = set_rules
|
|
|
|
|
|
|
|
def create_region(self, name: str):
|
2023-02-14 00:06:43 +00:00
|
|
|
return Region(name, self.player, self.multiworld)
|
2021-07-16 10:41:37 +00:00
|
|
|
|
|
|
|
def create_regions(self):
|
2022-11-01 02:41:21 +00:00
|
|
|
world = self.multiworld
|
2021-07-16 10:41:37 +00:00
|
|
|
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)
|
|
|
|
|
|
|
|
def generate_basic(self):
|
|
|
|
for item_name, count in default_pool.items():
|
2022-11-01 02:41:21 +00:00
|
|
|
self.multiworld.itempool.extend([self.create_item(item_name) for _ in range(count)])
|
2021-07-16 10:41:37 +00:00
|
|
|
|
|
|
|
def create_item(self, name: str) -> Item:
|
2022-06-17 01:23:27 +00:00
|
|
|
return Item(name,
|
|
|
|
ItemClassification.progression if not name.startswith("EX") else ItemClassification.filler,
|
|
|
|
item_table[name], self.player)
|