Report which linked option is badly formatted if possible.

This commit is contained in:
CaitSith2 2020-09-12 13:23:48 -07:00
parent 42661f7348
commit ce8d9ff6a9
1 changed files with 7 additions and 2 deletions

View File

@ -252,8 +252,13 @@ def roll_settings(weights):
if "linked_options" in weights:
weights = weights.copy() # make sure we don't write back to other weights sets in same_settings
for option_set in weights["linked_options"]:
if random.random() < (option_set["percentage"] / 100):
weights.update(option_set["options"])
if "name" not in option_set:
raise ValueError("One of your linked options does not have a name.")
try:
if random.random() < (option_set["percentage"] / 100):
weights.update(option_set["options"])
except Exception as e:
raise ValueError(f"Linked option {option_set['name']} is destroyed. Please fix your linked option.") from e
ret.name = get_choice('name', weights)
if ret.name: