ItemLinks: allow linking replacement items as well (#1274)

This commit is contained in:
Fabian Dill
2022-12-07 06:37:47 +01:00
committed by GitHub
parent 449973687b
commit 7c3af68e59
4 changed files with 32 additions and 15 deletions

View File

@@ -927,7 +927,8 @@ class ItemLinks(OptionList):
Optional("exclude"): [And(str, len)],
"replacement_item": Or(And(str, len), None),
Optional("local_items"): [And(str, len)],
Optional("non_local_items"): [And(str, len)]
Optional("non_local_items"): [And(str, len)],
Optional("link_replacement"): Or(None, bool),
}
])
@@ -950,6 +951,7 @@ class ItemLinks(OptionList):
return pool
def verify(self, world, player_name: str, plando_options) -> None:
link: dict
super(ItemLinks, self).verify(world, player_name, plando_options)
existing_links = set()
for link in self.value:
@@ -974,7 +976,9 @@ class ItemLinks(OptionList):
intersection = local_items.intersection(non_local_items)
if intersection:
raise Exception(f"item_link {link['name']} has {intersection} items in both its local_items and non_local_items pool.")
raise Exception(f"item_link {link['name']} has {intersection} "
f"items in both its local_items and non_local_items pool.")
link.setdefault("link_replacement", None)
per_game_common_options = {