Skip to content

Commit

Permalink
bump required client version; fix unit tests by defining create_item
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrochu committed Nov 28, 2023
1 parent e54394c commit 9c1f79a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
4 changes: 4 additions & 0 deletions worlds/zork_grand_inquisitor/data_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def item_names_to_id():
return {item.value: data.archipelago_id for item, data in item_data.items()}


def item_names_to_item():
return {item.value: item for item, _ in item_data.items()}


def location_names_to_id():
return {
location.value: data.archipelago_id
Expand Down
35 changes: 16 additions & 19 deletions worlds/zork_grand_inquisitor/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from .data_funcs import (
item_names_to_id,
item_names_to_item,
location_names_to_id,
item_groups,
location_groups,
Expand Down Expand Up @@ -58,10 +59,12 @@ class ZorkGrandInquisitorWorld(World):
item_name_groups = item_groups()
location_name_groups = location_groups()

required_client_version = (0, 4, 3) # Technically 0.4.4 but server still reports 0.4.3
required_client_version = (0, 4, 4)

web = ZorkGrandInquisitorWebWorld()

item_name_to_item = item_names_to_item()

def create_regions(self):
region_mapping = dict()

Expand Down Expand Up @@ -118,35 +121,29 @@ def create_items(self):
if ZorkGrandInquisitorTags.FILLER in (data.tags or tuple()):
continue

item_pool.append(
ZorkGrandInquisitorItem(
item.value,
data.classification,
data.archipelago_id,
self.player,
)
)
item_pool.append(self.create_item(item.value))

total_locations = len(self.multiworld.get_unfilled_locations(self.player))

for _ in range(total_locations - len(item_pool)):
filler_item_name = self.get_filler_item_name()

item_pool.append(
ZorkGrandInquisitorItem(
filler_item_name,
ItemClassification.filler,
self.item_name_to_id[filler_item_name],
self.player,
)
)
item_pool.append(self.create_item(self.get_filler_item_name()))

self.multiworld.itempool += item_pool

if self.options.early_rope_and_lantern.value == 1:
self.multiworld.early_items[self.player][ZorkGrandInquisitorItems.ROPE.value] = 1
self.multiworld.early_items[self.player][ZorkGrandInquisitorItems.LANTERN.value] = 1

def create_item(self, name):
data = item_data[self.item_name_to_item[name]]

return ZorkGrandInquisitorItem(
name,
data.classification,
data.archipelago_id,
self.player,
)

def generate_basic(self):
self.multiworld.completion_condition[self.player] = lambda state: state.has("Victory", self.player)

Expand Down

0 comments on commit 9c1f79a

Please sign in to comment.