diff --git a/worlds/zork_grand_inquisitor/test/test_locations.py b/worlds/zork_grand_inquisitor/test/test_locations.py index e6aa2c0d9dc9..fa576dd510dc 100644 --- a/worlds/zork_grand_inquisitor/test/test_locations.py +++ b/worlds/zork_grand_inquisitor/test/test_locations.py @@ -16,6 +16,9 @@ def test_correct_locations_exist(self) -> None: ZorkGrandInquisitorTags.CORE ) + self._assert_expected_locations_exist(expected_locations) + + def _assert_expected_locations_exist(self, expected_locations: Set[ZorkGrandInquisitorLocations]) -> None: location_name_to_location: Dict[str, ZorkGrandInquisitorLocations] = location_names_to_location() for location_object in self.multiworld.get_locations(1): @@ -33,7 +36,7 @@ def test_correct_locations_exist(self) -> None: self.assertEqual(0, len(expected_locations)) -class LocationsTestDeathsanity(ZorkGrandInquisitorTestBase): +class LocationsTestDeathsanity(LocationsTestNoDeathsanity): options = { "deathsanity": "true", } @@ -43,16 +46,4 @@ def test_correct_locations_exist(self) -> None: locations_with_tag(ZorkGrandInquisitorTags.CORE) | locations_with_tag(ZorkGrandInquisitorTags.DEATHSANITY) ) - location_name_to_location: Dict[str, ZorkGrandInquisitorLocations] = location_names_to_location() - - for location_object in self.multiworld.get_locations(1): - location: ZorkGrandInquisitorLocations = location_name_to_location.get(location_object.name) - - if location is None: - continue - - self.assertIn(location, expected_locations) - - expected_locations.remove(location) - - self.assertEqual(0, len(expected_locations)) + self._assert_expected_locations_exist(expected_locations) diff --git a/worlds/zork_grand_inquisitor/world.py b/worlds/zork_grand_inquisitor/world.py index eabd3920d13e..a72961744c67 100644 --- a/worlds/zork_grand_inquisitor/world.py +++ b/worlds/zork_grand_inquisitor/world.py @@ -83,6 +83,8 @@ class ZorkGrandInquisitorWorld(World): item_name_to_item: Dict[str, ZorkGrandInquisitorItems] = item_names_to_item() def create_regions(self) -> None: + deathsanity: bool = self.options.deathsanity.value == 1 + region_mapping: Dict[ZorkGrandInquisitorRegions, Region] = dict() region_enum_item: ZorkGrandInquisitorRegions @@ -90,7 +92,7 @@ def create_regions(self) -> None: region_mapping[region_enum_item] = Region(region_enum_item.value, self.player, self.multiworld) region_locations_mapping: Dict[ZorkGrandInquisitorRegions, Set[ZorkGrandInquisitorLocations]] - region_locations_mapping = locations_by_region(include_deathsanity=self.options.deathsanity.value == 1) + region_locations_mapping = locations_by_region(include_deathsanity=deathsanity) region_enum_item: ZorkGrandInquisitorRegions region: Region @@ -141,6 +143,9 @@ def create_regions(self) -> None: self.multiworld.regions.append(region) def create_items(self) -> None: + quick_port_foozle: bool = self.options.quick_port_foozle.value == 1 + start_with_hotspot_items: bool = self.options.start_with_hotspot_items.value == 1 + item_pool: List[ZorkGrandInquisitorItem] = list() item: ZorkGrandInquisitorItems @@ -150,7 +155,7 @@ def create_items(self) -> None: if ZorkGrandInquisitorTags.FILLER in tags: continue - elif ZorkGrandInquisitorTags.HOTSPOT in tags and self.options.start_with_hotspot_items.value == 1: + elif ZorkGrandInquisitorTags.HOTSPOT in tags and start_with_hotspot_items: continue item_pool.append(self.create_item(item.value)) @@ -162,11 +167,11 @@ def create_items(self) -> None: self.multiworld.itempool += item_pool - if self.options.quick_port_foozle.value == 1: + if quick_port_foozle: self.multiworld.early_items[self.player][ZorkGrandInquisitorItems.ROPE.value] = 1 self.multiworld.early_items[self.player][ZorkGrandInquisitorItems.LANTERN.value] = 1 - if self.options.start_with_hotspot_items.value == 0: + if start_with_hotspot_items is False: self.multiworld.early_items[self.player][ZorkGrandInquisitorItems.HOTSPOT_WELL.value] = 1 self.multiworld.early_items[self.player][ZorkGrandInquisitorItems.HOTSPOT_JACKS_DOOR.value] = 1 @@ -174,7 +179,7 @@ def create_items(self) -> None: ZorkGrandInquisitorItems.HOTSPOT_GRAND_INQUISITOR_DOLL.value ] = 1 - if self.options.start_with_hotspot_items.value == 1: + if start_with_hotspot_items: item: ZorkGrandInquisitorItems for item in items_with_tag(ZorkGrandInquisitorTags.HOTSPOT): self.multiworld.push_precollected(self.create_item(item.value))