| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  | import string | 
					
						
							| 
									
										
										
										
											2023-01-02 19:26:34 -06:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  | from .items import RiskOfRainItem, item_table, item_pool_weights, offset, filler_table, environment_offset | 
					
						
							|  |  |  |  | from .locations import RiskOfRainLocation, item_pickups, get_locations | 
					
						
							|  |  |  |  | from .rules import set_rules | 
					
						
							|  |  |  |  | from .ror2environments import environment_vanilla_table, environment_vanilla_orderedstages_table, \ | 
					
						
							|  |  |  |  |     environment_sotv_orderedstages_table, environment_sotv_table, collapse_dict_list_vertical, shift_by_offset | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | from BaseClasses import Item, ItemClassification, Tutorial | 
					
						
							|  |  |  |  | from .options import ItemWeights, ROR2Options | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  | from worlds.AutoWorld import World, WebWorld | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  | from .regions import create_explore_regions, create_classic_regions | 
					
						
							|  |  |  |  | from typing import List, Dict, Any | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-11 13:05:53 -05:00
										 |  |  |  | class RiskOfWeb(WebWorld): | 
					
						
							|  |  |  |  |     tutorials = [Tutorial( | 
					
						
							|  |  |  |  |         "Multiworld Setup Guide", | 
					
						
							|  |  |  |  |         "A guide to setting up the Risk of Rain 2 integration for Archipelago multiworld games.", | 
					
						
							|  |  |  |  |         "English", | 
					
						
							|  |  |  |  |         "setup_en.md", | 
					
						
							|  |  |  |  |         "setup/en", | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |         ["Ijwu", "Kindasneaki"] | 
					
						
							| 
									
										
										
										
											2022-05-11 13:05:53 -05:00
										 |  |  |  |     )] | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  | class RiskOfRainWorld(World): | 
					
						
							| 
									
										
										
										
											2021-08-31 20:45:09 -04:00
										 |  |  |  |     """
 | 
					
						
							|  |  |  |  |      Escape a chaotic alien planet by fighting through hordes of frenzied monsters – with your friends, or on your own. | 
					
						
							|  |  |  |  |      Combine loot in surprising ways and master each character until you become the havoc you feared upon your | 
					
						
							|  |  |  |  |      first crash landing. | 
					
						
							|  |  |  |  |     """
 | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |     game = "Risk of Rain 2" | 
					
						
							|  |  |  |  |     options_dataclass = ROR2Options | 
					
						
							|  |  |  |  |     options: ROR2Options | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  |     topology_present = False | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |     item_name_to_id = {name: data.code for name, data in item_table.items()} | 
					
						
							|  |  |  |  |     item_name_groups = { | 
					
						
							|  |  |  |  |         "Stages": {name for name, data in item_table.items() if data.category == "Stage"}, | 
					
						
							|  |  |  |  |         "Environments": {name for name, data in item_table.items() if data.category == "Environment"}, | 
					
						
							|  |  |  |  |         "Upgrades": {name for name, data in item_table.items() if data.category == "Upgrade"}, | 
					
						
							|  |  |  |  |         "Fillers": {name for name, data in item_table.items() if data.category == "Filler"}, | 
					
						
							|  |  |  |  |         "Traps": {name for name, data in item_table.items() if data.category == "Trap"}, | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-08-20 18:09:35 -05:00
										 |  |  |  |     location_name_to_id = item_pickups | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |     data_version = 8 | 
					
						
							|  |  |  |  |     required_client_version = (0, 4, 4) | 
					
						
							| 
									
										
										
										
											2022-05-11 13:05:53 -05:00
										 |  |  |  |     web = RiskOfWeb() | 
					
						
							| 
									
										
										
										
											2022-08-20 18:09:35 -05:00
										 |  |  |  |     total_revivals: int | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-20 18:09:35 -05:00
										 |  |  |  |     def generate_early(self) -> None: | 
					
						
							|  |  |  |  |         # figure out how many revivals should exist in the pool | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |         if self.options.goal == "classic": | 
					
						
							|  |  |  |  |             total_locations = self.options.total_locations.value | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |         else: | 
					
						
							|  |  |  |  |             total_locations = len( | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |                 get_locations( | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |                     chests=self.options.chests_per_stage.value, | 
					
						
							|  |  |  |  |                     shrines=self.options.shrines_per_stage.value, | 
					
						
							|  |  |  |  |                     scavengers=self.options.scavengers_per_stage.value, | 
					
						
							|  |  |  |  |                     scanners=self.options.scanner_per_stage.value, | 
					
						
							|  |  |  |  |                     altars=self.options.altars_per_stage.value, | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |                     dlc_sotv=bool(self.options.dlc_sotv.value) | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |                 ) | 
					
						
							|  |  |  |  |             ) | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |         self.total_revivals = int(self.options.total_revivals.value / 100 * | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |                                   total_locations) | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |         if self.options.start_with_revive: | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |             self.total_revivals -= 1 | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |         if self.options.victory == "voidling" and not self.options.dlc_sotv: | 
					
						
							|  |  |  |  |             self.options.victory.value = self.options.victory.option_any | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     def create_regions(self) -> None: | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         if self.options.goal == "classic": | 
					
						
							|  |  |  |  |             # classic mode | 
					
						
							|  |  |  |  |             create_classic_regions(self) | 
					
						
							|  |  |  |  |         else: | 
					
						
							|  |  |  |  |             # explore mode | 
					
						
							|  |  |  |  |             create_explore_regions(self) | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         self.create_events() | 
					
						
							| 
									
										
										
										
											2022-08-20 18:09:35 -05:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |     def create_items(self) -> None: | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  |         # shortcut for starting_inventory... The start_with_revive option lets you start with a Dio's Best Friend | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |         if self.options.start_with_revive: | 
					
						
							| 
									
										
										
										
											2022-10-31 21:41:21 -05:00
										 |  |  |  |             self.multiworld.push_precollected(self.multiworld.create_item("Dio's Best Friend", self.player)) | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |         environments_pool = {} | 
					
						
							|  |  |  |  |         # only mess with the environments if they are set as items | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |         if self.options.goal == "explore": | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |             # figure out all available ordered stages for each tier | 
					
						
							|  |  |  |  |             environment_available_orderedstages_table = environment_vanilla_orderedstages_table | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |             if self.options.dlc_sotv: | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |                 environment_available_orderedstages_table = \ | 
					
						
							|  |  |  |  |                     collapse_dict_list_vertical(environment_available_orderedstages_table, | 
					
						
							|  |  |  |  |                                                 environment_sotv_orderedstages_table) | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |             environments_pool = shift_by_offset(environment_vanilla_table, environment_offset) | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |             if self.options.dlc_sotv: | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |                 environment_offset_table = shift_by_offset(environment_sotv_table, environment_offset) | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |                 environments_pool = {**environments_pool, **environment_offset_table} | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |             environments_to_precollect = 5 if self.options.begin_with_loop else 1 | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |             # percollect environments for each stage (or just stage 1) | 
					
						
							|  |  |  |  |             for i in range(environments_to_precollect): | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |                 unlock = self.random.choices(list(environment_available_orderedstages_table[i].keys()), k=1) | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |                 self.multiworld.push_precollected(self.create_item(unlock[0])) | 
					
						
							|  |  |  |  |                 environments_pool.pop(unlock[0]) | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  |         # Generate item pool | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |         itempool: List[str] = ["Beads of Fealty", "Radar Scanner"] | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  |         # Add revive items for the player | 
					
						
							| 
									
										
										
										
											2022-08-20 18:09:35 -05:00
										 |  |  |  |         itempool += ["Dio's Best Friend"] * self.total_revivals | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |         for env_name, _ in environments_pool.items(): | 
					
						
							|  |  |  |  |             itempool += [env_name] | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |         if self.options.goal == "classic": | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |             # classic mode | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |             total_locations = self.options.total_locations.value | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |         else: | 
					
						
							|  |  |  |  |             # explore mode | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |             # Add Stage items for logic gates | 
					
						
							|  |  |  |  |             itempool += ["Stage 1", "Stage 2", "Stage 3", "Stage 4"] | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |             total_locations = len( | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |                 get_locations( | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |                     chests=self.options.chests_per_stage.value, | 
					
						
							|  |  |  |  |                     shrines=self.options.shrines_per_stage.value, | 
					
						
							|  |  |  |  |                     scavengers=self.options.scavengers_per_stage.value, | 
					
						
							|  |  |  |  |                     scanners=self.options.scanner_per_stage.value, | 
					
						
							|  |  |  |  |                     altars=self.options.altars_per_stage.value, | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |                     dlc_sotv=bool(self.options.dlc_sotv.value) | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |                 ) | 
					
						
							|  |  |  |  |             ) | 
					
						
							| 
									
										
										
										
											2023-08-16 08:21:07 -06:00
										 |  |  |  |         # Create junk items | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |         junk_pool = self.create_junk_pool() | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  |         # Fill remaining items with randomly generated junk | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |         filler = self.random.choices(*zip(*junk_pool.items()), k=total_locations - len(itempool)) | 
					
						
							|  |  |  |  |         itempool.extend(filler) | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         # Convert itempool into real items | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |         self.multiworld.itempool += map(self.create_item, itempool) | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |     def create_junk_pool(self) -> Dict[str, int]: | 
					
						
							| 
									
										
										
										
											2023-08-16 08:21:07 -06:00
										 |  |  |  |         # if presets are enabled generate junk_pool from the selected preset | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |         pool_option = self.options.item_weights.value | 
					
						
							| 
									
										
										
										
											2023-08-16 08:21:07 -06:00
										 |  |  |  |         junk_pool: Dict[str, int] = {} | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |         if self.options.item_pool_presets: | 
					
						
							| 
									
										
										
										
											2023-08-16 08:21:07 -06:00
										 |  |  |  |             # generate chaos weights if the preset is chosen | 
					
						
							|  |  |  |  |             if pool_option == ItemWeights.option_chaos: | 
					
						
							|  |  |  |  |                 for name, max_value in item_pool_weights[pool_option].items(): | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |                     junk_pool[name] = self.random.randint(0, max_value) | 
					
						
							| 
									
										
										
										
											2023-08-16 08:21:07 -06:00
										 |  |  |  |             else: | 
					
						
							|  |  |  |  |                 junk_pool = item_pool_weights[pool_option].copy() | 
					
						
							|  |  |  |  |         else:  # generate junk pool from user created presets | 
					
						
							|  |  |  |  |             junk_pool = { | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |                 "Item Scrap, Green": self.options.green_scrap.value, | 
					
						
							|  |  |  |  |                 "Item Scrap, Red": self.options.red_scrap.value, | 
					
						
							|  |  |  |  |                 "Item Scrap, Yellow": self.options.yellow_scrap.value, | 
					
						
							|  |  |  |  |                 "Item Scrap, White": self.options.white_scrap.value, | 
					
						
							|  |  |  |  |                 "Common Item": self.options.common_item.value, | 
					
						
							|  |  |  |  |                 "Uncommon Item": self.options.uncommon_item.value, | 
					
						
							|  |  |  |  |                 "Legendary Item": self.options.legendary_item.value, | 
					
						
							|  |  |  |  |                 "Boss Item": self.options.boss_item.value, | 
					
						
							|  |  |  |  |                 "Lunar Item": self.options.lunar_item.value, | 
					
						
							|  |  |  |  |                 "Void Item": self.options.void_item.value, | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |                 "Equipment": self.options.equipment.value, | 
					
						
							|  |  |  |  |                 "Money": self.options.money.value, | 
					
						
							|  |  |  |  |                 "Lunar Coin": self.options.lunar_coin.value, | 
					
						
							|  |  |  |  |                 "1000 Exp": self.options.experience.value, | 
					
						
							|  |  |  |  |                 "Mountain Trap": self.options.mountain_trap.value, | 
					
						
							|  |  |  |  |                 "Time Warp Trap": self.options.time_warp_trap.value, | 
					
						
							|  |  |  |  |                 "Combat Trap": self.options.combat_trap.value, | 
					
						
							|  |  |  |  |                 "Teleport Trap": self.options.teleport_trap.value, | 
					
						
							| 
									
										
										
										
											2023-08-16 08:21:07 -06:00
										 |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |         # remove trap items from the pool (excluding lunar items) | 
					
						
							|  |  |  |  |         if not self.options.enable_trap: | 
					
						
							|  |  |  |  |             junk_pool.pop("Mountain Trap") | 
					
						
							|  |  |  |  |             junk_pool.pop("Time Warp Trap") | 
					
						
							|  |  |  |  |             junk_pool.pop("Combat Trap") | 
					
						
							|  |  |  |  |             junk_pool.pop("Teleport Trap") | 
					
						
							|  |  |  |  |         # remove lunar items from the pool | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |         if not (self.options.enable_lunar or pool_option == ItemWeights.option_lunartic): | 
					
						
							| 
									
										
										
										
											2023-08-16 08:21:07 -06:00
										 |  |  |  |             junk_pool.pop("Lunar Item") | 
					
						
							|  |  |  |  |         # remove void items from the pool | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |         if not (self.options.dlc_sotv or pool_option == ItemWeights.option_void): | 
					
						
							| 
									
										
										
										
											2023-08-16 08:21:07 -06:00
										 |  |  |  |             junk_pool.pop("Void Item") | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         return junk_pool | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |     def create_item(self, name: str) -> Item: | 
					
						
							|  |  |  |  |         data = item_table[name] | 
					
						
							|  |  |  |  |         return RiskOfRainItem(name, data.item_type, data.code, self.player) | 
					
						
							| 
									
										
										
										
											2022-08-20 18:09:35 -05:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |     def set_rules(self) -> None: | 
					
						
							|  |  |  |  |         set_rules(self) | 
					
						
							| 
									
										
										
										
											2022-08-20 18:09:35 -05:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |     def get_filler_item_name(self) -> str: | 
					
						
							|  |  |  |  |         weights = [data.weight for data in filler_table.values()] | 
					
						
							|  |  |  |  |         filler = self.multiworld.random.choices([filler for filler in filler_table.keys()], weights, | 
					
						
							|  |  |  |  |                                                 k=1)[0] | 
					
						
							|  |  |  |  |         return filler | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |     def fill_slot_data(self) -> Dict[str, Any]: | 
					
						
							|  |  |  |  |         options_dict = self.options.as_dict("item_pickup_step", "shrine_use_step", "goal", "victory", "total_locations", | 
					
						
							|  |  |  |  |                                             "chests_per_stage", "shrines_per_stage", "scavengers_per_stage", | 
					
						
							|  |  |  |  |                                             "scanner_per_stage", "altars_per_stage", "total_revivals", | 
					
						
							|  |  |  |  |                                             "start_with_revive", "final_stage_death", "death_link", | 
					
						
							|  |  |  |  |                                             casing="camel") | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  |         return { | 
					
						
							| 
									
										
										
										
											2023-10-10 15:30:20 -05:00
										 |  |  |  |             **options_dict, | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |             "seed": "".join(self.random.choice(string.digits) for _ in range(16)), | 
					
						
							|  |  |  |  |             "offset": offset | 
					
						
							| 
									
										
										
										
											2021-08-29 14:02:02 -04:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |     def create_events(self) -> None: | 
					
						
							|  |  |  |  |         total_locations = self.options.total_locations.value | 
					
						
							|  |  |  |  |         num_of_events = total_locations // 25 | 
					
						
							|  |  |  |  |         if total_locations / 25 == num_of_events: | 
					
						
							|  |  |  |  |             num_of_events -= 1 | 
					
						
							|  |  |  |  |         world_region = self.multiworld.get_region("Petrichor V", self.player) | 
					
						
							|  |  |  |  |         if self.options.goal == "classic": | 
					
						
							|  |  |  |  |             # classic mode | 
					
						
							|  |  |  |  |             # only setup Pickups when using classic_mode | 
					
						
							|  |  |  |  |             for i in range(num_of_events): | 
					
						
							|  |  |  |  |                 event_loc = RiskOfRainLocation(self.player, f"Pickup{(i + 1) * 25}", None, world_region) | 
					
						
							|  |  |  |  |                 event_loc.place_locked_item( | 
					
						
							|  |  |  |  |                     RiskOfRainItem(f"Pickup{(i + 1) * 25}", ItemClassification.progression, None, | 
					
						
							|  |  |  |  |                                    self.player)) | 
					
						
							|  |  |  |  |                 event_loc.access_rule = \ | 
					
						
							|  |  |  |  |                     lambda state, i=i: state.can_reach(f"ItemPickup{((i + 1) * 25) - 1}", "Location", self.player) | 
					
						
							|  |  |  |  |                 world_region.locations.append(event_loc) | 
					
						
							|  |  |  |  |         else: | 
					
						
							|  |  |  |  |             # explore mode | 
					
						
							|  |  |  |  |             event_region = self.multiworld.get_region("OrderedStage_5", self.player) | 
					
						
							|  |  |  |  |             event_loc = RiskOfRainLocation(self.player, "Stage 5", None, event_region) | 
					
						
							|  |  |  |  |             event_loc.place_locked_item(RiskOfRainItem("Stage 5", ItemClassification.progression, None, self.player)) | 
					
						
							| 
									
										
										
										
											2023-02-05 13:51:03 -07:00
										 |  |  |  |             event_loc.show_in_spoiler = False | 
					
						
							|  |  |  |  |             event_region.locations.append(event_loc) | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |             event_loc.access_rule = lambda state: state.has("Sky Meadow", self.player) | 
					
						
							| 
									
										
										
										
											2022-03-23 16:22:31 -05:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-22 08:20:32 -07:00
										 |  |  |  |         victory_region = self.multiworld.get_region("Victory", self.player) | 
					
						
							|  |  |  |  |         victory_event = RiskOfRainLocation(self.player, "Victory", None, victory_region) | 
					
						
							|  |  |  |  |         victory_event.place_locked_item(RiskOfRainItem("Victory", ItemClassification.progression, None, self.player)) | 
					
						
							|  |  |  |  |         victory_region.locations.append(victory_event) |