Skip to content

Commit 6b671cb

Browse files
alwaysintrebleqwint
authored andcommitted
Core: fix item_name_groups unfolding in item links (ArchipelagoMW#3088)
1 parent 72b7bfe commit 6b671cb

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Options.py

+1
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,7 @@ def verify(self, world: typing.Type[World], player_name: str, plando_options: "P
11241124
raise Exception(f"item_link {link['name']} has {intersection} "
11251125
f"items in both its local_items and non_local_items pool.")
11261126
link.setdefault("link_replacement", None)
1127+
link["item_pool"] = list(pool)
11271128

11281129

11291130
class Removed(FreeText):

test/general/test_options.py

+30
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import unittest
2+
3+
from BaseClasses import PlandoOptions
4+
from Options import ItemLinks
25
from worlds.AutoWorld import AutoWorldRegister
36

47

@@ -17,3 +20,30 @@ def test_options_are_not_set_by_world(self):
1720
with self.subTest(game=gamename):
1821
self.assertFalse(hasattr(world_type, "options"),
1922
f"Unexpected assignment to {world_type.__name__}.options!")
23+
24+
def test_item_links_name_groups(self):
25+
"""Tests that item links successfully unfold item_name_groups"""
26+
item_link_groups = [
27+
[{
28+
"name": "ItemLinkGroup",
29+
"item_pool": ["Everything"],
30+
"link_replacement": False,
31+
"replacement_item": None,
32+
}],
33+
[{
34+
"name": "ItemLinkGroup",
35+
"item_pool": ["Hammer", "Bow"],
36+
"link_replacement": False,
37+
"replacement_item": None,
38+
}]
39+
]
40+
# we really need some sort of test world but generic doesn't have enough items for this
41+
world = AutoWorldRegister.world_types["A Link to the Past"]
42+
plando_options = PlandoOptions.from_option_string("bosses")
43+
item_links = [ItemLinks.from_any(item_link_groups[0]), ItemLinks.from_any(item_link_groups[1])]
44+
for link in item_links:
45+
link.verify(world, "tester", plando_options)
46+
self.assertIn("Hammer", link.value[0]["item_pool"])
47+
self.assertIn("Bow", link.value[0]["item_pool"])
48+
49+
# TODO test that the group created using these options has the items

0 commit comments

Comments
 (0)