mirror of
				https://github.com/MarioSpore/Grinch-AP.git
				synced 2025-10-21 20:21:32 -06:00 
			
		
		
		
	Core: rename world to multiworld (#931)
				
					
				
			* rename references to `Multiworld` in core to `multiworld` instead of `world` * fix smz3 * fix oot * fix low hanging fruit * revert mysteriously broken spacing in world api.md * fix more randomly broken spacing * hate * that better be all of it * begrudgingly move over smw * ._. * missed some worlds * this is getting tedious now * Missed some self.world definitions Co-authored-by: espeon65536 <espeon65536@gmail.com> Co-authored-by: Zach Parks <zach@alliware.com>
This commit is contained in:
		| @@ -79,7 +79,7 @@ class DarkSouls3World(World): | ||||
|  | ||||
|     def create_regions(self): | ||||
|         menu_region = Region("Menu", RegionType.Generic, "Menu", self.player) | ||||
|         self.world.regions.append(menu_region) | ||||
|         self.multiworld.regions.append(menu_region) | ||||
|  | ||||
|         # Create all Vanilla regions of Dark Souls III | ||||
|         firelink_shrine_region = self.create_region("Firelink Shrine", fire_link_shrine_table) | ||||
| @@ -106,71 +106,71 @@ class DarkSouls3World(World): | ||||
|  | ||||
|         # Create the entrance to connect those regions | ||||
|         menu_region.exits.append(Entrance(self.player, "New Game", menu_region)) | ||||
|         self.world.get_entrance("New Game", self.player).connect(firelink_shrine_region) | ||||
|         self.multiworld.get_entrance("New Game", self.player).connect(firelink_shrine_region) | ||||
|         firelink_shrine_region.exits.append(Entrance(self.player, "Goto High Wall of Lothric", | ||||
|                                                      firelink_shrine_region)) | ||||
|         firelink_shrine_region.exits.append(Entrance(self.player, "Goto Kiln Of The First Flame", | ||||
|                                                      firelink_shrine_region)) | ||||
|         firelink_shrine_region.exits.append(Entrance(self.player, "Goto Bell Tower", | ||||
|                                                      firelink_shrine_region)) | ||||
|         self.world.get_entrance("Goto High Wall of Lothric", self.player).connect(high_wall_of_lothric_region) | ||||
|         self.world.get_entrance("Goto Kiln Of The First Flame", self.player).connect(kiln_of_the_first_flame_region) | ||||
|         self.world.get_entrance("Goto Bell Tower", self.player).connect(firelink_shrine_bell_tower_region) | ||||
|         self.multiworld.get_entrance("Goto High Wall of Lothric", self.player).connect(high_wall_of_lothric_region) | ||||
|         self.multiworld.get_entrance("Goto Kiln Of The First Flame", self.player).connect(kiln_of_the_first_flame_region) | ||||
|         self.multiworld.get_entrance("Goto Bell Tower", self.player).connect(firelink_shrine_bell_tower_region) | ||||
|         high_wall_of_lothric_region.exits.append(Entrance(self.player, "Goto Undead Settlement", | ||||
|                                                           high_wall_of_lothric_region)) | ||||
|         high_wall_of_lothric_region.exits.append(Entrance(self.player, "Goto Lothric Castle", | ||||
|                                                           high_wall_of_lothric_region)) | ||||
|         self.world.get_entrance("Goto Undead Settlement", self.player).connect(undead_settlement_region) | ||||
|         self.world.get_entrance("Goto Lothric Castle", self.player).connect(lothric_castle_region) | ||||
|         self.multiworld.get_entrance("Goto Undead Settlement", self.player).connect(undead_settlement_region) | ||||
|         self.multiworld.get_entrance("Goto Lothric Castle", self.player).connect(lothric_castle_region) | ||||
|         undead_settlement_region.exits.append(Entrance(self.player, "Goto Road Of Sacrifices", | ||||
|                                                        undead_settlement_region)) | ||||
|         self.world.get_entrance("Goto Road Of Sacrifices", self.player).connect(road_of_sacrifices_region) | ||||
|         self.multiworld.get_entrance("Goto Road Of Sacrifices", self.player).connect(road_of_sacrifices_region) | ||||
|         road_of_sacrifices_region.exits.append(Entrance(self.player, "Goto Cathedral", road_of_sacrifices_region)) | ||||
|         road_of_sacrifices_region.exits.append(Entrance(self.player, "Goto Farron keep", road_of_sacrifices_region)) | ||||
|         self.world.get_entrance("Goto Cathedral", self.player).connect(cathedral_of_the_deep_region) | ||||
|         self.world.get_entrance("Goto Farron keep", self.player).connect(farron_keep_region) | ||||
|         self.multiworld.get_entrance("Goto Cathedral", self.player).connect(cathedral_of_the_deep_region) | ||||
|         self.multiworld.get_entrance("Goto Farron keep", self.player).connect(farron_keep_region) | ||||
|         farron_keep_region.exits.append(Entrance(self.player, "Goto Carthus catacombs", farron_keep_region)) | ||||
|         self.world.get_entrance("Goto Carthus catacombs", self.player).connect(catacombs_of_carthus_region) | ||||
|         self.multiworld.get_entrance("Goto Carthus catacombs", self.player).connect(catacombs_of_carthus_region) | ||||
|         catacombs_of_carthus_region.exits.append(Entrance(self.player, "Goto Irithyll of the boreal", | ||||
|                                                           catacombs_of_carthus_region)) | ||||
|         catacombs_of_carthus_region.exits.append(Entrance(self.player, "Goto Smouldering Lake", | ||||
|                                                           catacombs_of_carthus_region)) | ||||
|         self.world.get_entrance("Goto Irithyll of the boreal", self.player).\ | ||||
|         self.multiworld.get_entrance("Goto Irithyll of the boreal", self.player).\ | ||||
|             connect(irithyll_of_the_boreal_valley_region) | ||||
|         self.world.get_entrance("Goto Smouldering Lake", self.player).connect(smouldering_lake_region) | ||||
|         self.multiworld.get_entrance("Goto Smouldering Lake", self.player).connect(smouldering_lake_region) | ||||
|         irithyll_of_the_boreal_valley_region.exits.append(Entrance(self.player, "Goto Irithyll dungeon", | ||||
|                                                                    irithyll_of_the_boreal_valley_region)) | ||||
|         irithyll_of_the_boreal_valley_region.exits.append(Entrance(self.player, "Goto Anor Londo", | ||||
|                                                                    irithyll_of_the_boreal_valley_region)) | ||||
|         self.world.get_entrance("Goto Irithyll dungeon", self.player).connect(irithyll_dungeon_region) | ||||
|         self.world.get_entrance("Goto Anor Londo", self.player).connect(anor_londo_region) | ||||
|         self.multiworld.get_entrance("Goto Irithyll dungeon", self.player).connect(irithyll_dungeon_region) | ||||
|         self.multiworld.get_entrance("Goto Anor Londo", self.player).connect(anor_londo_region) | ||||
|         irithyll_dungeon_region.exits.append(Entrance(self.player, "Goto Archdragon peak", irithyll_dungeon_region)) | ||||
|         irithyll_dungeon_region.exits.append(Entrance(self.player, "Goto Profaned capital", irithyll_dungeon_region)) | ||||
|         self.world.get_entrance("Goto Archdragon peak", self.player).connect(archdragon_peak_region) | ||||
|         self.world.get_entrance("Goto Profaned capital", self.player).connect(profaned_capital_region) | ||||
|         self.multiworld.get_entrance("Goto Archdragon peak", self.player).connect(archdragon_peak_region) | ||||
|         self.multiworld.get_entrance("Goto Profaned capital", self.player).connect(profaned_capital_region) | ||||
|         lothric_castle_region.exits.append(Entrance(self.player, "Goto Consumed King Garden", lothric_castle_region)) | ||||
|         lothric_castle_region.exits.append(Entrance(self.player, "Goto Grand Archives", lothric_castle_region)) | ||||
|         self.world.get_entrance("Goto Consumed King Garden", self.player).connect(consumed_king_garden_region) | ||||
|         self.world.get_entrance("Goto Grand Archives", self.player).connect(grand_archives_region) | ||||
|         self.multiworld.get_entrance("Goto Consumed King Garden", self.player).connect(consumed_king_garden_region) | ||||
|         self.multiworld.get_entrance("Goto Grand Archives", self.player).connect(grand_archives_region) | ||||
|         consumed_king_garden_region.exits.append(Entrance(self.player, "Goto Untended Graves", | ||||
|                                                           consumed_king_garden_region)) | ||||
|         self.world.get_entrance("Goto Untended Graves", self.player).connect(untended_graves_region) | ||||
|         self.multiworld.get_entrance("Goto Untended Graves", self.player).connect(untended_graves_region) | ||||
|  | ||||
|     # For each region, add the associated locations retrieved from the corresponding location_table | ||||
|     def create_region(self, region_name, location_table) -> Region: | ||||
|         new_region = Region(region_name, RegionType.Generic, region_name, self.player, self.world) | ||||
|         new_region = Region(region_name, RegionType.Generic, region_name, self.player, self.multiworld) | ||||
|         if location_table: | ||||
|             for name, address in location_table.items(): | ||||
|                 location = DarkSouls3Location(self.player, name, self.location_name_to_id[name], new_region) | ||||
|                 new_region.locations.append(location) | ||||
|         self.world.regions.append(new_region) | ||||
|         self.multiworld.regions.append(new_region) | ||||
|         return new_region | ||||
|  | ||||
|     def create_items(self): | ||||
|         for name, address in self.item_name_to_id.items(): | ||||
|             # Specific items will be included in the item pool under certain conditions. See generate_basic | ||||
|             if name != "Basin of Vows": | ||||
|                 self.world.itempool += [self.create_item(name)] | ||||
|                 self.multiworld.itempool += [self.create_item(name)] | ||||
|  | ||||
|     def generate_early(self): | ||||
|         pass | ||||
| @@ -178,46 +178,46 @@ class DarkSouls3World(World): | ||||
|     def set_rules(self) -> None: | ||||
|  | ||||
|         # Define the access rules to the entrances | ||||
|         set_rule(self.world.get_entrance("Goto Bell Tower", self.player), | ||||
|         set_rule(self.multiworld.get_entrance("Goto Bell Tower", self.player), | ||||
|                  lambda state: state.has("Tower Key", self.player)) | ||||
|         set_rule(self.world.get_entrance("Goto Undead Settlement", self.player), | ||||
|         set_rule(self.multiworld.get_entrance("Goto Undead Settlement", self.player), | ||||
|                  lambda state: state.has("Small Lothric Banner", self.player)) | ||||
|         set_rule(self.world.get_entrance("Goto Lothric Castle", self.player), | ||||
|         set_rule(self.multiworld.get_entrance("Goto Lothric Castle", self.player), | ||||
|                  lambda state: state.has("Basin of Vows", self.player)) | ||||
|         set_rule(self.world.get_entrance("Goto Irithyll of the boreal", self.player), | ||||
|         set_rule(self.multiworld.get_entrance("Goto Irithyll of the boreal", self.player), | ||||
|                  lambda state: state.has("Small Doll", self.player)) | ||||
|         set_rule(self.world.get_entrance("Goto Archdragon peak", self.player), | ||||
|         set_rule(self.multiworld.get_entrance("Goto Archdragon peak", self.player), | ||||
|                  lambda state: state.can_reach("CKG: Soul of Consumed Oceiros", "Location", self.player)) | ||||
|         set_rule(self.world.get_entrance("Goto Profaned capital", self.player), | ||||
|         set_rule(self.multiworld.get_entrance("Goto Profaned capital", self.player), | ||||
|                  lambda state: state.has("Storm Ruler", self.player)) | ||||
|         set_rule(self.world.get_entrance("Goto Grand Archives", self.player), | ||||
|         set_rule(self.multiworld.get_entrance("Goto Grand Archives", self.player), | ||||
|                  lambda state: state.has("Grand Archives Key", self.player)) | ||||
|         set_rule(self.world.get_entrance("Goto Kiln Of The First Flame", self.player), | ||||
|         set_rule(self.multiworld.get_entrance("Goto Kiln Of The First Flame", self.player), | ||||
|                  lambda state: state.has("Cinders of a Lord - Abyss Watcher", self.player) and | ||||
|                  state.has("Cinders of a Lord - Yhorm the Giant", self.player) and | ||||
|                  state.has("Cinders of a Lord - Aldrich", self.player) and | ||||
|                  state.has("Cinders of a Lord - Lothric Prince", self.player)) | ||||
|  | ||||
|         # Define the access rules to some specific locations | ||||
|         set_rule(self.world.get_location("HWL: Soul of the Dancer", self.player), | ||||
|         set_rule(self.multiworld.get_location("HWL: Soul of the Dancer", self.player), | ||||
|                  lambda state: state.has("Basin of Vows", self.player)) | ||||
|         set_rule(self.world.get_location("HWL: Greirat's Ashes", self.player), | ||||
|         set_rule(self.multiworld.get_location("HWL: Greirat's Ashes", self.player), | ||||
|                  lambda state: state.has("Cell Key", self.player)) | ||||
|         set_rule(self.world.get_location("ID: Bellowing Dragoncrest Ring", self.player), | ||||
|         set_rule(self.multiworld.get_location("ID: Bellowing Dragoncrest Ring", self.player), | ||||
|                  lambda state: state.has("Jailbreaker's Key", self.player)) | ||||
|         set_rule(self.world.get_location("ID: Prisoner Chief's Ashes", self.player), | ||||
|         set_rule(self.multiworld.get_location("ID: Prisoner Chief's Ashes", self.player), | ||||
|                  lambda state: state.has("Jailer's Key Ring", self.player)) | ||||
|         set_rule(self.world.get_location("ID: Covetous Gold Serpent Ring", self.player), | ||||
|         set_rule(self.multiworld.get_location("ID: Covetous Gold Serpent Ring", self.player), | ||||
|                  lambda state: state.has("Old Cell Key", self.player)) | ||||
|         set_rule(self.world.get_location("ID: Karla's Ashes", self.player), | ||||
|         set_rule(self.multiworld.get_location("ID: Karla's Ashes", self.player), | ||||
|                  lambda state: state.has("Jailer's Key Ring", self.player)) | ||||
|         black_hand_gotthard_corpse_rule = lambda state: \ | ||||
|             (state.can_reach("AL: Cinders of a Lord - Aldrich", "Location", self.player) and | ||||
|              state.can_reach("PC: Cinders of a Lord - Yhorm the Giant", "Location", self.player)) | ||||
|         set_rule(self.world.get_location("LC: Grand Archives Key", self.player), black_hand_gotthard_corpse_rule) | ||||
|         set_rule(self.world.get_location("LC: Gotthard Twinswords", self.player), black_hand_gotthard_corpse_rule) | ||||
|         set_rule(self.multiworld.get_location("LC: Grand Archives Key", self.player), black_hand_gotthard_corpse_rule) | ||||
|         set_rule(self.multiworld.get_location("LC: Gotthard Twinswords", self.player), black_hand_gotthard_corpse_rule) | ||||
|  | ||||
|         self.world.completion_condition[self.player] = lambda state: \ | ||||
|         self.multiworld.completion_condition[self.player] = lambda state: \ | ||||
|             state.has("Cinders of a Lord - Abyss Watcher", self.player) and \ | ||||
|             state.has("Cinders of a Lord - Yhorm the Giant", self.player) and \ | ||||
|             state.has("Cinders of a Lord - Aldrich", self.player) and \ | ||||
| @@ -226,30 +226,30 @@ class DarkSouls3World(World): | ||||
|     def generate_basic(self): | ||||
|         # Depending on the specified option, add the Basin of Vows to a specific location or to the item pool | ||||
|         item = self.create_item("Basin of Vows") | ||||
|         if self.world.late_basin_of_vows[self.player]: | ||||
|             self.world.get_location("IBV: Soul of Pontiff Sulyvahn", self.player).place_locked_item(item) | ||||
|         if self.multiworld.late_basin_of_vows[self.player]: | ||||
|             self.multiworld.get_location("IBV: Soul of Pontiff Sulyvahn", self.player).place_locked_item(item) | ||||
|         else: | ||||
|             self.world.itempool += [item] | ||||
|             self.multiworld.itempool += [item] | ||||
|  | ||||
|         # Fill item pool with additional items | ||||
|         item_pool_len = self.item_name_to_id.__len__() | ||||
|         total_required_locations = self.location_name_to_id.__len__() | ||||
|         for i in range(item_pool_len, total_required_locations): | ||||
|             self.world.itempool += [self.create_item("Soul of an Intrepid Hero")] | ||||
|             self.multiworld.itempool += [self.create_item("Soul of an Intrepid Hero")] | ||||
|  | ||||
|     def generate_output(self, output_directory: str): | ||||
|         # Depending on the specified option, modify items hexadecimal value to add an upgrade level | ||||
|         item_dictionary_copy = item_dictionary.copy() | ||||
|         if self.world.randomize_weapons_level[self.player]: | ||||
|         if self.multiworld.randomize_weapons_level[self.player]: | ||||
|             # Randomize some weapons upgrades | ||||
|             for name in weapons_upgrade_5_table.keys(): | ||||
|                 if self.world.random.randint(0, 100) < 33: | ||||
|                     value = self.world.random.randint(1, 5) | ||||
|                 if self.multiworld.random.randint(0, 100) < 33: | ||||
|                     value = self.multiworld.random.randint(1, 5) | ||||
|                     item_dictionary_copy[name] += value | ||||
|  | ||||
|             for name in weapons_upgrade_10_table.keys(): | ||||
|                 if self.world.random.randint(0, 100) < 33: | ||||
|                     value = self.world.random.randint(1, 10) | ||||
|                 if self.multiworld.random.randint(0, 100) < 33: | ||||
|                     value = self.multiworld.random.randint(1, 10) | ||||
|                     item_dictionary_copy[name] += value | ||||
|  | ||||
|         # Create the mandatory lists to generate the player's output file | ||||
| @@ -258,7 +258,7 @@ class DarkSouls3World(World): | ||||
|         locations_id = [] | ||||
|         locations_address = [] | ||||
|         locations_target = [] | ||||
|         for location in self.world.get_filled_locations(): | ||||
|         for location in self.multiworld.get_filled_locations(): | ||||
|             if location.item.player == self.player: | ||||
|                 items_id.append(location.item.code) | ||||
|                 items_address.append(item_dictionary[location.item.name]) | ||||
| @@ -273,12 +273,12 @@ class DarkSouls3World(World): | ||||
|  | ||||
|         data = { | ||||
|             "options": { | ||||
|                 "auto_equip": self.world.auto_equip[self.player].value, | ||||
|                 "lock_equip": self.world.lock_equip[self.player].value, | ||||
|                 "no_weapon_requirements": self.world.no_weapon_requirements[self.player].value, | ||||
|                 "auto_equip": self.multiworld.auto_equip[self.player].value, | ||||
|                 "lock_equip": self.multiworld.lock_equip[self.player].value, | ||||
|                 "no_weapon_requirements": self.multiworld.no_weapon_requirements[self.player].value, | ||||
|             }, | ||||
|             "seed": self.world.seed_name,  # to verify the server's multiworld | ||||
|             "slot": self.world.player_name[self.player],  # to connect to server | ||||
|             "seed": self.multiworld.seed_name,  # to verify the server's multiworld | ||||
|             "slot": self.multiworld.player_name[self.player],  # to connect to server | ||||
|             "base_id": self.base_id,  # to merge location and items lists | ||||
|             "locationsId": locations_id, | ||||
|             "locationsAddress": locations_address, | ||||
| @@ -288,6 +288,6 @@ class DarkSouls3World(World): | ||||
|         } | ||||
|  | ||||
|         # generate the file | ||||
|         filename = f"AP-{self.world.seed_name}-P{self.player}-{self.world.player_name[self.player]}.json" | ||||
|         filename = f"AP-{self.multiworld.seed_name}-P{self.player}-{self.multiworld.player_name[self.player]}.json" | ||||
|         with open(os.path.join(output_directory, filename), 'w') as outfile: | ||||
|             json.dump(data, outfile) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 alwaysintreble
					alwaysintreble