Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrochu committed Mar 6, 2024
1 parent a0b28a3 commit 3aa9f8f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
19 changes: 5 additions & 14 deletions worlds/zork_grand_inquisitor/test/test_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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",
}
Expand All @@ -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)
15 changes: 10 additions & 5 deletions worlds/zork_grand_inquisitor/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@ 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
for region_enum_item in region_data.keys():
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
Expand Down Expand Up @@ -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
Expand All @@ -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))
Expand All @@ -162,19 +167,19 @@ 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

self.multiworld.early_items[self.player][
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))
Expand Down

0 comments on commit 3aa9f8f

Please sign in to comment.