More bug fixes
This commit is contained in:
parent
65864e273b
commit
ae163319e0
|
@ -38,6 +38,7 @@ class AssembleOptions(type):
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
return validate
|
return validate
|
||||||
|
|
||||||
attrs["__init__"] = validate_decorator(attrs["__init__"])
|
attrs["__init__"] = validate_decorator(attrs["__init__"])
|
||||||
else:
|
else:
|
||||||
# construct an __init__ that calls parent __init__
|
# construct an __init__ that calls parent __init__
|
||||||
|
@ -53,6 +54,7 @@ class AssembleOptions(type):
|
||||||
|
|
||||||
return super(AssembleOptions, mcs).__new__(mcs, name, bases, attrs)
|
return super(AssembleOptions, mcs).__new__(mcs, name, bases, attrs)
|
||||||
|
|
||||||
|
|
||||||
T = typing.TypeVar('T')
|
T = typing.TypeVar('T')
|
||||||
|
|
||||||
|
|
||||||
|
@ -199,7 +201,7 @@ class Choice(Option[int]):
|
||||||
if isinstance(other, self.__class__):
|
if isinstance(other, self.__class__):
|
||||||
return other.value != self.value
|
return other.value != self.value
|
||||||
elif isinstance(other, str):
|
elif isinstance(other, str):
|
||||||
assert other in self.options , f"compared against a str that could never be equal. {self} != {other}"
|
assert other in self.options, f"compared against a str that could never be equal. {self} != {other}"
|
||||||
return other != self.current_key
|
return other != self.current_key
|
||||||
elif isinstance(other, int):
|
elif isinstance(other, int):
|
||||||
assert other in self.name_lookup, f"compared against am int that could never be equal. {self} != {other}"
|
assert other in self.name_lookup, f"compared against am int that could never be equal. {self} != {other}"
|
||||||
|
@ -507,7 +509,6 @@ per_game_common_options = {
|
||||||
"item_links": ItemLinks
|
"item_links": ItemLinks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
from worlds.alttp.Options import Logic
|
from worlds.alttp.Options import Logic
|
||||||
|
|
|
@ -2,6 +2,20 @@ import typing
|
||||||
from .ExtractedData import logic_options, starts, pool_options
|
from .ExtractedData import logic_options, starts, pool_options
|
||||||
from Options import Option, DefaultOnToggle, Toggle, Choice, Range
|
from Options import Option, DefaultOnToggle, Toggle, Choice, Range
|
||||||
|
|
||||||
|
|
||||||
|
class Disabled(Toggle):
|
||||||
|
def __init__(self, value: int):
|
||||||
|
super(Disabled, self).__init__(0)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_text(cls, text: str) -> Toggle:
|
||||||
|
return cls(0)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_any(cls, data: typing.Any):
|
||||||
|
return cls(0)
|
||||||
|
|
||||||
|
|
||||||
locations = {"option_" + start: i for i, start in enumerate(starts)}
|
locations = {"option_" + start: i for i, start in enumerate(starts)}
|
||||||
# This way the dynamic start names are picked up by the MetaClass Choice belongs to
|
# This way the dynamic start names are picked up by the MetaClass Choice belongs to
|
||||||
StartLocation = type("StartLocation", (Choice,), {"auto_display_name": False, **locations})
|
StartLocation = type("StartLocation", (Choice,), {"auto_display_name": False, **locations})
|
||||||
|
@ -24,23 +38,25 @@ disabled = {
|
||||||
"RandomizeSwim",
|
"RandomizeSwim",
|
||||||
"RandomizeMimics",
|
"RandomizeMimics",
|
||||||
"RandomizeNail",
|
"RandomizeNail",
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hollow_knight_randomize_options: typing.Dict[str, type(Option)] = {}
|
hollow_knight_randomize_options: typing.Dict[str, type(Option)] = {}
|
||||||
|
|
||||||
for option_name, option_data in pool_options.items():
|
for option_name, option_data in pool_options.items():
|
||||||
extra_data = {"items": option_data[0], "locations": option_data[1]}
|
extra_data = {"items": option_data[0], "locations": option_data[1]}
|
||||||
|
if option_name in disabled:
|
||||||
|
extra_data["__doc__"] = "Disabled Option. Not implemented."
|
||||||
|
option = type(option_name, (Disabled,), extra_data)
|
||||||
if option_name in default_on:
|
if option_name in default_on:
|
||||||
option = type(option_name, (DefaultOnToggle,), extra_data)
|
option = type(option_name, (DefaultOnToggle,), extra_data)
|
||||||
else:
|
else:
|
||||||
option = type(option_name, (Toggle,), extra_data)
|
option = type(option_name, (Toggle,), extra_data)
|
||||||
hollow_knight_randomize_options[option_name] = option
|
hollow_knight_randomize_options[option_name] = option
|
||||||
|
|
||||||
|
|
||||||
hollow_knight_logic_options: typing.Dict[str, type(Option)] = {
|
hollow_knight_logic_options: typing.Dict[str, type(Option)] = {
|
||||||
option_name: Toggle for option_name in logic_options.values() if
|
option_name: Disabled if option_name in disabled else Toggle for option_name in logic_options.values() if
|
||||||
option_name not in hollow_knight_randomize_options
|
option_name not in hollow_knight_randomize_options}
|
||||||
and option_name != "RandomizeCharmNotches"}
|
|
||||||
|
|
||||||
|
|
||||||
class MinimumGrubPrice(Range):
|
class MinimumGrubPrice(Range):
|
||||||
|
|
Loading…
Reference in New Issue