Skip to content

Commit

Permalink
HK: adds schema to validate plando charm costs (ArchipelagoMW#3471)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwint committed Jun 24, 2024
1 parent 1baf0ee commit 4e1b27b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions worlds/hk/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
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
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit 4e1b27b

Please sign in to comment.