Move duplicate name item link check to verify.

This commit is contained in:
CaitSith2 2022-02-23 15:17:24 -08:00
parent f167e11905
commit 6e0165986f
2 changed files with 4 additions and 5 deletions

View File

@ -205,12 +205,7 @@ class MultiWorld():
item_links = {}
for player in self.player_ids:
player_item_links = set()
for item_link in self.item_links[player].value:
if item_link["name"] in player_item_links:
raise Exception(f"Cannot name more than one item_link with the same name in the same yaml ({item_link['name']}) ({self.get_player_name(player)})")
else:
player_item_links.add(item_link["name"])
if item_link["name"] in item_links:
item_links[item_link["name"]]["players"][player] = item_link["replacement_item"]
item_links[item_link["name"]]["item_pool"] &= set(item_link["item_pool"])

View File

@ -470,7 +470,11 @@ class ItemLinks(OptionList):
def verify(self, world):
super(ItemLinks, self).verify(world)
existing_links = set()
for link in self.value:
if link["name"] in existing_links:
raise Exception(f"You cannot have more than one link named {link['name']}.")
existing_links.add(link["name"])
for item_name in link["item_pool"]:
if item_name not in world.item_names and item_name not in world.item_name_groups:
raise Exception(f"Item {item_name} from option {self} "