| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  | from typing import Union | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-10 17:12:55 -04:00
										 |  |  | from BaseClasses import Tutorial, CollectionState, ItemClassification | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  | from worlds.AutoWorld import WebWorld, World | 
					
						
							| 
									
										
										
										
											2023-04-19 17:14:46 -04:00
										 |  |  | from . import Options | 
					
						
							| 
									
										
										
										
											2023-11-06 00:01:49 -05:00
										 |  |  | from .Items import DLCQuestItem, ItemData, create_items, item_table, items_by_group, Group | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  | from .Locations import DLCQuestLocation, location_table | 
					
						
							|  |  |  | from .Options import DLCQuestOptions | 
					
						
							|  |  |  | from .Regions import create_regions | 
					
						
							|  |  |  | from .Rules import set_rules | 
					
						
							| 
									
										
										
										
											2023-04-09 15:06:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | client_version = 0 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DLCqwebworld(WebWorld): | 
					
						
							| 
									
										
										
										
											2024-01-12 20:26:50 +01:00
										 |  |  |     setup_en = Tutorial( | 
					
						
							| 
									
										
										
										
											2024-02-20 11:22:32 -05:00
										 |  |  |         "Multiworld Setup Guide", | 
					
						
							| 
									
										
										
										
											2023-04-09 15:06:59 -04:00
										 |  |  |         "A guide to setting up the Archipelago DLCQuest game on your computer.", | 
					
						
							|  |  |  |         "English", | 
					
						
							|  |  |  |         "setup_en.md", | 
					
						
							|  |  |  |         "setup/en", | 
					
						
							|  |  |  |         ["axe_y"] | 
					
						
							| 
									
										
										
										
											2024-01-12 20:26:50 +01:00
										 |  |  |     ) | 
					
						
							|  |  |  |     setup_fr = Tutorial( | 
					
						
							|  |  |  |         "Guide de configuration MultiWorld", | 
					
						
							|  |  |  |         "Un guide pour configurer DLCQuest sur votre PC.", | 
					
						
							|  |  |  |         "Français", | 
					
						
							|  |  |  |         "setup_fr.md", | 
					
						
							|  |  |  |         "setup/fr", | 
					
						
							|  |  |  |         ["Deoxis"] | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |     tutorials = [setup_en, setup_fr] | 
					
						
							| 
									
										
										
										
											2023-04-09 15:06:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DLCqworld(World): | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  |     DLCQuest is a metroid ish game where everything is an in-game dlc. | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  |     game = "DLCQuest" | 
					
						
							|  |  |  |     topology_present = False | 
					
						
							|  |  |  |     web = DLCqwebworld() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     item_name_to_id = {name: data.code for name, data in item_table.items()} | 
					
						
							|  |  |  |     location_name_to_id = location_table | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-11 08:47:19 +02:00
										 |  |  |     data_version = 1 | 
					
						
							| 
									
										
										
										
											2023-04-09 15:06:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |     options_dataclass = DLCQuestOptions | 
					
						
							|  |  |  |     options: DLCQuestOptions | 
					
						
							| 
									
										
										
										
											2023-04-09 15:06:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def create_regions(self): | 
					
						
							|  |  |  |         create_regions(self.multiworld, self.player, self.options) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def set_rules(self): | 
					
						
							|  |  |  |         set_rules(self.multiworld, self.player, self.options) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def create_event(self, event: str): | 
					
						
							|  |  |  |         return DLCQuestItem(event, True, None, self.player) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def create_items(self): | 
					
						
							| 
									
										
										
										
											2023-04-19 17:14:46 -04:00
										 |  |  |         self.precollect_coinsanity() | 
					
						
							| 
									
										
										
										
											2023-04-09 15:06:59 -04:00
										 |  |  |         locations_count = len([location | 
					
						
							|  |  |  |                                for location in self.multiworld.get_locations(self.player) | 
					
						
							|  |  |  |                                if not location.event]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         items_to_exclude = [excluded_items | 
					
						
							|  |  |  |                             for excluded_items in self.multiworld.precollected_items[self.player]] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         created_items = create_items(self, self.options, locations_count + len(items_to_exclude), self.multiworld.random) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.itempool += created_items | 
					
						
							| 
									
										
										
										
											2023-11-06 00:01:49 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if self.options.campaign == Options.Campaign.option_basic or self.options.campaign == Options.Campaign.option_both: | 
					
						
							|  |  |  |             self.multiworld.early_items[self.player]["Movement Pack"] = 1 | 
					
						
							| 
									
										
										
										
											2023-04-09 15:06:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         for item in items_to_exclude: | 
					
						
							|  |  |  |             if item in self.multiworld.itempool: | 
					
						
							|  |  |  |                 self.multiworld.itempool.remove(item) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-19 17:14:46 -04:00
										 |  |  |     def precollect_coinsanity(self): | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |         if self.options.campaign == Options.Campaign.option_basic: | 
					
						
							|  |  |  |             if self.options.coinsanity == Options.CoinSanity.option_coin and self.options.coinbundlequantity >= 5: | 
					
						
							| 
									
										
										
										
											2023-04-19 17:14:46 -04:00
										 |  |  |                 self.multiworld.push_precollected(self.create_item("Movement Pack")) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-10 17:12:55 -04:00
										 |  |  |     def create_item(self, item: Union[str, ItemData], classification: ItemClassification = None) -> DLCQuestItem: | 
					
						
							| 
									
										
										
										
											2023-04-09 15:06:59 -04:00
										 |  |  |         if isinstance(item, str): | 
					
						
							|  |  |  |             item = item_table[item] | 
					
						
							| 
									
										
										
										
											2024-03-10 17:12:55 -04:00
										 |  |  |         if classification is None: | 
					
						
							|  |  |  |             classification = item.classification | 
					
						
							| 
									
										
										
										
											2023-04-09 15:06:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-10 17:12:55 -04:00
										 |  |  |         return DLCQuestItem(item.name, classification, item.code, self.player) | 
					
						
							| 
									
										
										
										
											2023-04-09 15:06:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-06 00:01:49 -05:00
										 |  |  |     def get_filler_item_name(self) -> str: | 
					
						
							|  |  |  |         trap = self.multiworld.random.choice(items_by_group[Group.Trap]) | 
					
						
							|  |  |  |         return trap.name | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-09 15:06:59 -04:00
										 |  |  |     def fill_slot_data(self): | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |         options_dict = self.options.as_dict( | 
					
						
							| 
									
										
										
										
											2024-03-10 17:12:55 -04:00
										 |  |  |             "death_link", "ending_choice", "campaign", "coinsanity", "item_shuffle", "permanent_coins" | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |         ) | 
					
						
							|  |  |  |         options_dict.update({ | 
					
						
							|  |  |  |             "coinbundlerange": self.options.coinbundlequantity.value, | 
					
						
							|  |  |  |             "seed": self.random.randrange(99999999) | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |         return options_dict | 
					
						
							| 
									
										
										
										
											2023-10-26 00:51:32 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def collect(self, state: CollectionState, item: DLCQuestItem) -> bool: | 
					
						
							|  |  |  |         change = super().collect(state, item) | 
					
						
							|  |  |  |         if change: | 
					
						
							|  |  |  |             suffix = item.coin_suffix | 
					
						
							|  |  |  |             if suffix: | 
					
						
							| 
									
										
										
										
											2023-11-02 00:41:20 -05:00
										 |  |  |                 state.prog_items[self.player][suffix] += item.coins | 
					
						
							| 
									
										
										
										
											2023-10-26 00:51:32 +02:00
										 |  |  |         return change | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def remove(self, state: CollectionState, item: DLCQuestItem) -> bool: | 
					
						
							|  |  |  |         change = super().remove(state, item) | 
					
						
							|  |  |  |         if change: | 
					
						
							|  |  |  |             suffix = item.coin_suffix | 
					
						
							|  |  |  |             if suffix: | 
					
						
							| 
									
										
										
										
											2023-11-02 00:41:20 -05:00
										 |  |  |                 state.prog_items[self.player][suffix] -= item.coins | 
					
						
							| 
									
										
										
										
											2023-10-26 00:51:32 +02:00
										 |  |  |         return change |