2023-07-19 22:16:03 +00:00
|
|
|
from typing import List
|
|
|
|
|
|
|
|
from BaseClasses import Region, Tutorial
|
2023-03-21 20:23:45 +00:00
|
|
|
from worlds.AutoWorld import WebWorld, World
|
2023-07-19 22:16:03 +00:00
|
|
|
from .Items import CliqueItem, item_data_table, item_table
|
|
|
|
from .Locations import CliqueLocation, location_data_table, location_table, locked_locations
|
2023-03-21 20:23:45 +00:00
|
|
|
from .Options import clique_options
|
2023-07-19 22:16:03 +00:00
|
|
|
from .Regions import region_data_table
|
|
|
|
from .Rules import get_button_rule
|
2023-03-21 20:23:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
class CliqueWebWorld(WebWorld):
|
|
|
|
theme = "partyTime"
|
|
|
|
tutorials = [
|
|
|
|
Tutorial(
|
|
|
|
tutorial_name="Start Guide",
|
|
|
|
description="A guide to playing Clique.",
|
|
|
|
language="English",
|
|
|
|
file_name="guide_en.md",
|
|
|
|
link="guide/en",
|
|
|
|
authors=["Phar"]
|
|
|
|
)
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
class CliqueWorld(World):
|
2023-07-19 22:16:03 +00:00
|
|
|
"""The greatest game of all time."""
|
2023-03-21 20:23:45 +00:00
|
|
|
|
|
|
|
game = "Clique"
|
2023-07-19 22:16:03 +00:00
|
|
|
data_version = 3
|
2023-03-21 20:23:45 +00:00
|
|
|
web = CliqueWebWorld()
|
|
|
|
option_definitions = clique_options
|
2023-07-19 22:16:03 +00:00
|
|
|
location_name_to_id = location_table
|
|
|
|
item_name_to_id = item_table
|
2023-03-21 20:23:45 +00:00
|
|
|
|
2023-04-08 00:05:16 +00:00
|
|
|
def create_item(self, name: str) -> CliqueItem:
|
2023-07-19 22:16:03 +00:00
|
|
|
return CliqueItem(name, item_data_table[name].type, item_data_table[name].code, self.player)
|
2023-03-21 20:23:45 +00:00
|
|
|
|
2023-04-08 00:05:16 +00:00
|
|
|
def create_items(self) -> None:
|
2023-07-19 22:16:03 +00:00
|
|
|
item_pool: List[CliqueItem] = []
|
|
|
|
for name, item in item_data_table.items():
|
|
|
|
if item.code and item.can_create(self.multiworld, self.player):
|
|
|
|
item_pool.append(self.create_item(name))
|
2023-03-21 20:23:45 +00:00
|
|
|
|
2023-07-19 22:16:03 +00:00
|
|
|
self.multiworld.itempool += item_pool
|
2023-03-21 20:23:45 +00:00
|
|
|
|
|
|
|
def create_regions(self) -> None:
|
2023-07-19 22:16:03 +00:00
|
|
|
# Create regions.
|
|
|
|
for region_name in region_data_table.keys():
|
|
|
|
region = Region(region_name, self.player, self.multiworld)
|
|
|
|
self.multiworld.regions.append(region)
|
|
|
|
|
|
|
|
# Create locations.
|
|
|
|
for region_name, region_data in region_data_table.items():
|
|
|
|
region = self.multiworld.get_region(region_name, self.player)
|
|
|
|
region.add_locations({
|
|
|
|
location_name: location_data.address for location_name, location_data in location_data_table.items()
|
|
|
|
if location_data.region == region_name and location_data.can_create(self.multiworld, self.player)
|
|
|
|
}, CliqueLocation)
|
|
|
|
region.add_exits(region_data_table[region_name].connecting_regions)
|
|
|
|
|
|
|
|
# Place locked locations.
|
|
|
|
for location_name, location_data in locked_locations.items():
|
|
|
|
# Ignore locations we never created.
|
|
|
|
if not location_data.can_create(self.multiworld, self.player):
|
|
|
|
continue
|
|
|
|
|
|
|
|
locked_item = self.create_item(location_data_table[location_name].locked_item)
|
|
|
|
self.multiworld.get_location(location_name, self.player).place_locked_item(locked_item)
|
|
|
|
|
|
|
|
# Set priority location for the Big Red Button!
|
|
|
|
self.multiworld.priority_locations[self.player].value.add("The Big Red Button")
|
2023-03-21 20:23:45 +00:00
|
|
|
|
|
|
|
def get_filler_item_name(self) -> str:
|
2023-07-19 22:16:03 +00:00
|
|
|
return "A Cool Filler Item (No Satisfaction Guaranteed)"
|
2023-03-21 20:23:45 +00:00
|
|
|
|
|
|
|
def set_rules(self) -> None:
|
2023-07-19 22:16:03 +00:00
|
|
|
button_rule = get_button_rule(self.multiworld, self.player)
|
|
|
|
self.multiworld.get_location("The Big Red Button", self.player).access_rule = button_rule
|
|
|
|
self.multiworld.get_location("In the Player's Mind", self.player).access_rule = button_rule
|
2023-03-21 20:23:45 +00:00
|
|
|
|
2023-07-19 22:16:03 +00:00
|
|
|
# Do not allow button activations on buttons.
|
|
|
|
self.multiworld.get_location("The Big Red Button", self.player).item_rule =\
|
|
|
|
lambda item: item.name != "Button Activation"
|
2023-03-21 20:23:45 +00:00
|
|
|
|
2023-07-19 22:16:03 +00:00
|
|
|
# Completion condition.
|
|
|
|
self.multiworld.completion_condition[self.player] = lambda state: state.has("The Urge to Push", self.player)
|
2023-03-21 20:23:45 +00:00
|
|
|
|
2023-07-19 22:16:03 +00:00
|
|
|
def fill_slot_data(self):
|
|
|
|
return {
|
|
|
|
"color": getattr(self.multiworld, "color")[self.player].current_key
|
|
|
|
}
|