| 
									
										
										
										
											2024-08-11 08:47:17 -04:00
										 |  |  | from typing import List, Dict, Any | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | from BaseClasses import Region, Tutorial | 
					
						
							| 
									
										
										
										
											2023-03-21 15:23:45 -05:00
										 |  |  | from worlds.AutoWorld import WebWorld, World | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  | from .Items import CliqueItem, item_data_table, item_table | 
					
						
							|  |  |  | from .Locations import CliqueLocation, location_data_table, location_table, locked_locations | 
					
						
							| 
									
										
										
										
											2024-08-11 08:47:17 -04:00
										 |  |  | from .Options import CliqueOptions | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  | from .Regions import region_data_table | 
					
						
							|  |  |  | from .Rules import get_button_rule | 
					
						
							| 
									
										
										
										
											2023-03-21 15:23:45 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class CliqueWebWorld(WebWorld): | 
					
						
							|  |  |  |     theme = "partyTime" | 
					
						
							| 
									
										
										
										
											2024-01-16 06:54:48 +01:00
										 |  |  |      | 
					
						
							|  |  |  |     setup_en = Tutorial( | 
					
						
							|  |  |  |         tutorial_name="Start Guide", | 
					
						
							|  |  |  |         description="A guide to playing Clique.", | 
					
						
							|  |  |  |         language="English", | 
					
						
							|  |  |  |         file_name="guide_en.md", | 
					
						
							|  |  |  |         link="guide/en", | 
					
						
							|  |  |  |         authors=["Phar"] | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     setup_de = Tutorial( | 
					
						
							|  |  |  |         tutorial_name="Anleitung zum Anfangen", | 
					
						
							|  |  |  |         description="Eine Anleitung um Clique zu spielen.", | 
					
						
							|  |  |  |         language="Deutsch", | 
					
						
							|  |  |  |         file_name="guide_de.md", | 
					
						
							|  |  |  |         link="guide/de", | 
					
						
							|  |  |  |         authors=["Held_der_Zeit"] | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     tutorials = [setup_en, setup_de] | 
					
						
							| 
									
										
										
										
											2023-03-21 15:23:45 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class CliqueWorld(World): | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  |     """The greatest game of all time.""" | 
					
						
							| 
									
										
										
										
											2023-03-21 15:23:45 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     game = "Clique" | 
					
						
							|  |  |  |     web = CliqueWebWorld() | 
					
						
							| 
									
										
										
										
											2024-08-11 08:47:17 -04:00
										 |  |  |     options: CliqueOptions | 
					
						
							|  |  |  |     options_dataclass = CliqueOptions | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  |     location_name_to_id = location_table | 
					
						
							|  |  |  |     item_name_to_id = item_table | 
					
						
							| 
									
										
										
										
											2023-03-21 15:23:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-07 19:05:16 -05:00
										 |  |  |     def create_item(self, name: str) -> CliqueItem: | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  |         return CliqueItem(name, item_data_table[name].type, item_data_table[name].code, self.player) | 
					
						
							| 
									
										
										
										
											2023-03-21 15:23:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-07 19:05:16 -05:00
										 |  |  |     def create_items(self) -> None: | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  |         item_pool: List[CliqueItem] = [] | 
					
						
							|  |  |  |         for name, item in item_data_table.items(): | 
					
						
							| 
									
										
										
										
											2024-08-11 08:47:17 -04:00
										 |  |  |             if item.code and item.can_create(self): | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  |                 item_pool.append(self.create_item(name)) | 
					
						
							| 
									
										
										
										
											2023-03-21 15:23:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  |         self.multiworld.itempool += item_pool | 
					
						
							| 
									
										
										
										
											2023-03-21 15:23:45 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def create_regions(self) -> None: | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05: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(): | 
					
						
							| 
									
										
										
										
											2024-08-11 08:47:17 -04:00
										 |  |  |             region = self.get_region(region_name) | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  |             region.add_locations({ | 
					
						
							|  |  |  |                 location_name: location_data.address for location_name, location_data in location_data_table.items() | 
					
						
							| 
									
										
										
										
											2024-08-11 08:47:17 -04:00
										 |  |  |                 if location_data.region == region_name and location_data.can_create(self) | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  |             }, 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. | 
					
						
							| 
									
										
										
										
											2024-08-11 08:47:17 -04:00
										 |  |  |             if not location_data.can_create(self): | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  |                 continue | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             locked_item = self.create_item(location_data_table[location_name].locked_item) | 
					
						
							| 
									
										
										
										
											2024-08-11 08:47:17 -04:00
										 |  |  |             self.get_location(location_name).place_locked_item(locked_item) | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |         # Set priority location for the Big Red Button! | 
					
						
							| 
									
										
										
										
											2024-08-11 08:47:17 -04:00
										 |  |  |         self.options.priority_locations.value.add("The Big Red Button") | 
					
						
							| 
									
										
										
										
											2023-03-21 15:23:45 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def get_filler_item_name(self) -> str: | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  |         return "A Cool Filler Item (No Satisfaction Guaranteed)" | 
					
						
							| 
									
										
										
										
											2023-03-21 15:23:45 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def set_rules(self) -> None: | 
					
						
							| 
									
										
										
										
											2024-08-11 08:47:17 -04:00
										 |  |  |         button_rule = get_button_rule(self) | 
					
						
							|  |  |  |         self.get_location("The Big Red Button").access_rule = button_rule | 
					
						
							|  |  |  |         self.get_location("In the Player's Mind").access_rule = button_rule | 
					
						
							| 
									
										
										
										
											2023-03-21 15:23:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  |         # Do not allow button activations on buttons. | 
					
						
							| 
									
										
										
										
											2024-08-11 08:47:17 -04:00
										 |  |  |         self.get_location("The Big Red Button").item_rule = lambda item: item.name != "Button Activation" | 
					
						
							| 
									
										
										
										
											2023-03-21 15:23:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  |         # Completion condition. | 
					
						
							|  |  |  |         self.multiworld.completion_condition[self.player] = lambda state: state.has("The Urge to Push", self.player) | 
					
						
							| 
									
										
										
										
											2023-03-21 15:23:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-11 08:47:17 -04:00
										 |  |  |     def fill_slot_data(self) -> Dict[str, Any]: | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  |         return { | 
					
						
							| 
									
										
										
										
											2024-08-11 08:47:17 -04:00
										 |  |  |             "color": self.options.color.current_key | 
					
						
							| 
									
										
										
										
											2023-07-19 17:16:03 -05:00
										 |  |  |         } |