HK: adds schema to validate plando charm costs (#3471)

This commit is contained in:
qwint 2024-06-07 12:12:10 -05:00 committed by GitHub
parent 8c614865bb
commit b053fee3e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -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():