| 
									
										
										
										
											2022-02-09 20:57:38 +01:00
										 |  |  | import typing | 
					
						
							| 
									
										
										
										
											2022-02-15 19:56:10 +01:00
										 |  |  | from .Items import item_table, cannon_item_table, SM64Item | 
					
						
							| 
									
										
										
										
											2022-01-23 21:34:30 +01:00
										 |  |  | from .Locations import location_table, SM64Location | 
					
						
							|  |  |  | from .Options import sm64_options | 
					
						
							|  |  |  | from .Rules import set_rules | 
					
						
							|  |  |  | from .Regions import create_regions | 
					
						
							|  |  |  | from BaseClasses import Region, RegionType, Entrance, Item, MultiWorld | 
					
						
							|  |  |  | from ..AutoWorld import World | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | client_version = 1 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class SM64World(World): | 
					
						
							|  |  |  |     """ 
 | 
					
						
							| 
									
										
										
										
											2022-01-23 21:45:43 +01:00
										 |  |  |     The first Super Mario game to feature 3D gameplay, it features freedom of movement within a large open world based on polygons, | 
					
						
							|  |  |  |     combined with traditional Mario gameplay, visual style, and characters. | 
					
						
							| 
									
										
										
										
											2022-01-23 21:34:30 +01:00
										 |  |  |     """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     game: str = "Super Mario 64" | 
					
						
							|  |  |  |     topology_present = False | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     item_name_to_id = item_table | 
					
						
							|  |  |  |     location_name_to_id = location_table | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-15 19:56:10 +01:00
										 |  |  |     data_version = 6 | 
					
						
							| 
									
										
										
										
											2022-01-23 21:34:30 +01:00
										 |  |  |     forced_auto_forfeit = False | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-09 20:57:38 +01:00
										 |  |  |     area_connections: typing.Dict[int, int] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-23 21:34:30 +01:00
										 |  |  |     options = sm64_options | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-09 20:57:38 +01:00
										 |  |  |     def generate_early(self): | 
					
						
							|  |  |  |         self.topology_present = self.world.AreaRandomizer[self.player].value | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-23 21:34:30 +01:00
										 |  |  |     def create_regions(self): | 
					
						
							|  |  |  |         create_regions(self.world,self.player) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def set_rules(self): | 
					
						
							| 
									
										
										
										
											2022-02-09 20:57:38 +01:00
										 |  |  |         self.area_connections = {} | 
					
						
							|  |  |  |         set_rules(self.world, self.player, self.area_connections) | 
					
						
							| 
									
										
										
										
											2022-01-23 21:34:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def create_item(self, name: str) -> Item: | 
					
						
							|  |  |  |         item_id = item_table[name] | 
					
						
							| 
									
										
										
										
											2022-01-30 19:12:52 +01:00
										 |  |  |         item = SM64Item(name, name != "1Up Mushroom", item_id, self.player) | 
					
						
							| 
									
										
										
										
											2022-01-23 21:34:30 +01:00
										 |  |  |         return item | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def generate_basic(self): | 
					
						
							| 
									
										
										
										
											2022-01-27 11:14:17 +01:00
										 |  |  |         staritem = self.create_item("Power Star") | 
					
						
							| 
									
										
										
										
											2022-02-09 20:57:38 +01:00
										 |  |  |         starcount = min(self.world.StarsToFinish[self.player].value + self.world.ExtraStars[self.player].value,120) | 
					
						
							|  |  |  |         if (not self.world.EnableCoinStars[self.player].value): | 
					
						
							|  |  |  |             starcount = max(starcount - 15,self.world.StarsToFinish[self.player].value) | 
					
						
							| 
									
										
										
										
											2022-01-30 19:12:52 +01:00
										 |  |  |         self.world.itempool += [staritem for i in range(0,starcount)] | 
					
						
							|  |  |  |         mushroomitem = self.create_item("1Up Mushroom")  | 
					
						
							| 
									
										
										
										
											2022-02-09 20:57:38 +01:00
										 |  |  |         self.world.itempool += [mushroomitem for i in range(starcount,120 - (15 if not self.world.EnableCoinStars[self.player].value else 0))] | 
					
						
							| 
									
										
										
										
											2022-01-23 21:34:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-09 20:57:38 +01:00
										 |  |  |         if (not self.world.ProgressiveKeys[self.player].value): | 
					
						
							|  |  |  |             key1 = self.create_item("Basement Key") | 
					
						
							|  |  |  |             key2 = self.create_item("Second Floor Key") | 
					
						
							|  |  |  |             self.world.itempool += [key1,key2] | 
					
						
							|  |  |  |         else: | 
					
						
							|  |  |  |             key = self.create_item("Progressive Key") | 
					
						
							|  |  |  |             self.world.itempool += [key,key] | 
					
						
							| 
									
										
										
										
											2022-01-23 21:34:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         wingcap = self.create_item("Wing Cap") | 
					
						
							|  |  |  |         metalcap = self.create_item("Metal Cap") | 
					
						
							|  |  |  |         vanishcap = self.create_item("Vanish Cap") | 
					
						
							|  |  |  |         self.world.itempool += [wingcap,metalcap,vanishcap] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-15 19:56:10 +01:00
										 |  |  |         if (self.world.BuddyChecks[self.player].value): | 
					
						
							|  |  |  |             self.world.itempool += [self.create_item(name) for name, id in cannon_item_table.items()] | 
					
						
							|  |  |  |         else: | 
					
						
							|  |  |  |             self.world.get_location("BoB: Bob-omb Buddy", self.player).place_locked_item(self.create_item("Cannon Unlock BoB")) | 
					
						
							|  |  |  |             self.world.get_location("WF: Bob-omb Buddy", self.player).place_locked_item(self.create_item("Cannon Unlock WF")) | 
					
						
							|  |  |  |             self.world.get_location("JRB: Bob-omb Buddy", self.player).place_locked_item(self.create_item("Cannon Unlock JRB")) | 
					
						
							|  |  |  |             self.world.get_location("CCM: Bob-omb Buddy", self.player).place_locked_item(self.create_item("Cannon Unlock CCM")) | 
					
						
							|  |  |  |             self.world.get_location("SSL: Bob-omb Buddy", self.player).place_locked_item(self.create_item("Cannon Unlock SSL")) | 
					
						
							|  |  |  |             self.world.get_location("SL: Bob-omb Buddy", self.player).place_locked_item(self.create_item("Cannon Unlock SL")) | 
					
						
							|  |  |  |             self.world.get_location("WDW: Bob-omb Buddy", self.player).place_locked_item(self.create_item("Cannon Unlock WDW")) | 
					
						
							|  |  |  |             self.world.get_location("TTM: Bob-omb Buddy", self.player).place_locked_item(self.create_item("Cannon Unlock TTM")) | 
					
						
							|  |  |  |             self.world.get_location("THI: Bob-omb Buddy", self.player).place_locked_item(self.create_item("Cannon Unlock THI")) | 
					
						
							|  |  |  |             self.world.get_location("RR: Bob-omb Buddy", self.player).place_locked_item(self.create_item("Cannon Unlock RR")) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-23 21:34:30 +01:00
										 |  |  |     def fill_slot_data(self): | 
					
						
							|  |  |  |         return { | 
					
						
							| 
									
										
										
										
											2022-02-09 20:57:38 +01:00
										 |  |  |             "AreaRando": self.area_connections, | 
					
						
							| 
									
										
										
										
											2022-02-14 16:19:25 +01:00
										 |  |  |             "StarsToFinish": self.world.StarsToFinish[self.player].value, | 
					
						
							|  |  |  |             "DeathLink": self.world.DeathLink[self.player].value, | 
					
						
							| 
									
										
										
										
											2022-01-23 21:34:30 +01:00
										 |  |  |         } |