From b053fee3e5d552fe2fbce8d4c879e3f9737dbc52 Mon Sep 17 00:00:00 2001 From: qwint Date: Fri, 7 Jun 2024 12:12:10 -0500 Subject: [PATCH] HK: adds schema to validate plando charm costs (#3471) --- worlds/hk/Options.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/worlds/hk/Options.py b/worlds/hk/Options.py index 0ad1acff..38be2cd7 100644 --- a/worlds/hk/Options.py +++ b/worlds/hk/Options.py @@ -2,6 +2,7 @@ import typing import re from .ExtractedData import logic_options, starts, pool_options from .Rules import cost_terms +from schema import And, Schema, Optional from Options import Option, DefaultOnToggle, Toggle, Choice, Range, OptionDict, NamedRange, DeathLink from .Charms import vanilla_costs, names as charm_names @@ -296,6 +297,9 @@ class PlandoCharmCosts(OptionDict): This is set after any random Charm Notch costs, if applicable.""" display_name = "Charm Notch Cost Plando" valid_keys = frozenset(charm_names) + schema = Schema({ + Optional(name): And(int, lambda n: 6 >= n >= 0) for name in charm_names + }) def get_costs(self, charm_costs: typing.List[int]) -> typing.List[int]: for name, cost in self.value.items():