Skip to content

Commit 33b2a21

Browse files
authored
Merge pull request ArchipelagoMW#1 from ArchipelagoMW/main
Core: fix missing import for `MultiWorld.link_items()` (ArchipelagoMW#3731)
2 parents 16110e1 + c0ef02d commit 33b2a21

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

BaseClasses.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ def set_item_links(self):
290290

291291
def link_items(self) -> None:
292292
"""Called to link together items in the itempool related to the registered item link groups."""
293+
from worlds import AutoWorld
294+
293295
for group_id, group in self.groups.items():
294296
def find_common_pool(players: Set[int], shared_pool: Set[str]) -> Tuple[
295297
Optional[Dict[int, Dict[str, int]]], Optional[Dict[str, int]]
@@ -300,15 +302,15 @@ def find_common_pool(players: Set[int], shared_pool: Set[str]) -> Tuple[
300302
if item.player in counters and item.name in shared_pool:
301303
counters[item.player][item.name] += 1
302304
classifications[item.name] |= item.classification
303-
305+
304306
for player in players.copy():
305307
if all([counters[player][item] == 0 for item in shared_pool]):
306308
players.remove(player)
307309
del (counters[player])
308-
310+
309311
if not players:
310312
return None, None
311-
313+
312314
for item in shared_pool:
313315
count = min(counters[player][item] for player in players)
314316
if count:
@@ -318,19 +320,19 @@ def find_common_pool(players: Set[int], shared_pool: Set[str]) -> Tuple[
318320
for player in players:
319321
del (counters[player][item])
320322
return counters, classifications
321-
323+
322324
common_item_count, classifications = find_common_pool(group["players"], group["item_pool"])
323325
if not common_item_count:
324326
continue
325-
327+
326328
new_itempool: List[Item] = []
327329
for item_name, item_count in next(iter(common_item_count.values())).items():
328330
for _ in range(item_count):
329331
new_item = group["world"].create_item(item_name)
330332
# mangle together all original classification bits
331333
new_item.classification |= classifications[item_name]
332334
new_itempool.append(new_item)
333-
335+
334336
region = Region("Menu", group_id, self, "ItemLink")
335337
self.regions.append(region)
336338
locations = region.locations
@@ -341,16 +343,16 @@ def find_common_pool(players: Set[int], shared_pool: Set[str]) -> Tuple[
341343
None, region)
342344
loc.access_rule = lambda state, item_name = item.name, group_id_ = group_id, count_ = count: \
343345
state.has(item_name, group_id_, count_)
344-
346+
345347
locations.append(loc)
346348
loc.place_locked_item(item)
347349
common_item_count[item.player][item.name] -= 1
348350
else:
349351
new_itempool.append(item)
350-
352+
351353
itemcount = len(self.itempool)
352354
self.itempool = new_itempool
353-
355+
354356
while itemcount > len(self.itempool):
355357
items_to_add = []
356358
for player in group["players"]:

0 commit comments

Comments
 (0)