mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-03-07 07:03:44 -08:00
Core: Add missing args to rule builder inits (#5912)
* add filtered_resolution to inits * update from_dict calls too
This commit is contained in:
@@ -316,8 +316,13 @@ class NestedRule(Rule[TWorld], game="Archipelago"):
|
||||
children: tuple[Rule[TWorld], ...]
|
||||
"""The child rules this rule's logic is based on"""
|
||||
|
||||
def __init__(self, *children: Rule[TWorld], options: Iterable[OptionFilter] = ()) -> None:
|
||||
super().__init__(options=options)
|
||||
def __init__(
|
||||
self,
|
||||
*children: Rule[TWorld],
|
||||
options: Iterable[OptionFilter] = (),
|
||||
filtered_resolution: bool = False,
|
||||
) -> None:
|
||||
super().__init__(options=options, filtered_resolution=filtered_resolution)
|
||||
self.children = children
|
||||
|
||||
@override
|
||||
@@ -341,7 +346,7 @@ class NestedRule(Rule[TWorld], game="Archipelago"):
|
||||
def from_dict(cls, data: Mapping[str, Any], world_cls: "type[World]") -> Self:
|
||||
children = [world_cls.rule_from_dict(c) for c in data.get("children", ())]
|
||||
options = OptionFilter.multiple_from_dict(data.get("options", ()))
|
||||
return cls(*children, options=options)
|
||||
return cls(*children, options=options, filtered_resolution=data.get("filtered_resolution", False))
|
||||
|
||||
@override
|
||||
def __str__(self) -> str:
|
||||
@@ -605,7 +610,11 @@ class WrapperRule(Rule[TWorld], game="Archipelago"):
|
||||
if child is None:
|
||||
raise ValueError("Child rule cannot be None")
|
||||
options = OptionFilter.multiple_from_dict(data.get("options", ()))
|
||||
return cls(world_cls.rule_from_dict(child), options=options)
|
||||
return cls(
|
||||
world_cls.rule_from_dict(child),
|
||||
options=options,
|
||||
filtered_resolution=data.get("filtered_resolution", False),
|
||||
)
|
||||
|
||||
@override
|
||||
def __str__(self) -> str:
|
||||
@@ -749,8 +758,13 @@ class HasAll(Rule[TWorld], game="Archipelago"):
|
||||
item_names: tuple[str, ...]
|
||||
"""A tuple of item names to check for"""
|
||||
|
||||
def __init__(self, *item_names: str, options: Iterable[OptionFilter] = ()) -> None:
|
||||
super().__init__(options=options)
|
||||
def __init__(
|
||||
self,
|
||||
*item_names: str,
|
||||
options: Iterable[OptionFilter] = (),
|
||||
filtered_resolution: bool = False,
|
||||
) -> None:
|
||||
super().__init__(options=options, filtered_resolution=filtered_resolution)
|
||||
self.item_names = tuple(sorted(set(item_names)))
|
||||
|
||||
@override
|
||||
@@ -772,7 +786,7 @@ class HasAll(Rule[TWorld], game="Archipelago"):
|
||||
args = {**data.get("args", {})}
|
||||
item_names = args.pop("item_names", ())
|
||||
options = OptionFilter.multiple_from_dict(data.get("options", ()))
|
||||
return cls(*item_names, **args, options=options)
|
||||
return cls(*item_names, **args, options=options, filtered_resolution=data.get("filtered_resolution", False))
|
||||
|
||||
@override
|
||||
def __str__(self) -> str:
|
||||
@@ -862,8 +876,13 @@ class HasAny(Rule[TWorld], game="Archipelago"):
|
||||
item_names: tuple[str, ...]
|
||||
"""A tuple of item names to check for"""
|
||||
|
||||
def __init__(self, *item_names: str, options: Iterable[OptionFilter] = ()) -> None:
|
||||
super().__init__(options=options)
|
||||
def __init__(
|
||||
self,
|
||||
*item_names: str,
|
||||
options: Iterable[OptionFilter] = (),
|
||||
filtered_resolution: bool = False,
|
||||
) -> None:
|
||||
super().__init__(options=options, filtered_resolution=filtered_resolution)
|
||||
self.item_names = tuple(sorted(set(item_names)))
|
||||
|
||||
@override
|
||||
@@ -885,7 +904,7 @@ class HasAny(Rule[TWorld], game="Archipelago"):
|
||||
args = {**data.get("args", {})}
|
||||
item_names = args.pop("item_names", ())
|
||||
options = OptionFilter.multiple_from_dict(data.get("options", ()))
|
||||
return cls(*item_names, **args, options=options)
|
||||
return cls(*item_names, **args, options=options, filtered_resolution=data.get("filtered_resolution", False))
|
||||
|
||||
@override
|
||||
def __str__(self) -> str:
|
||||
@@ -1188,8 +1207,14 @@ class HasFromList(Rule[TWorld], game="Archipelago"):
|
||||
count: int = 1
|
||||
"""The number of items the player needs to have"""
|
||||
|
||||
def __init__(self, *item_names: str, count: int = 1, options: Iterable[OptionFilter] = ()) -> None:
|
||||
super().__init__(options=options)
|
||||
def __init__(
|
||||
self,
|
||||
*item_names: str,
|
||||
count: int = 1,
|
||||
options: Iterable[OptionFilter] = (),
|
||||
filtered_resolution: bool = False,
|
||||
) -> None:
|
||||
super().__init__(options=options, filtered_resolution=filtered_resolution)
|
||||
self.item_names = tuple(sorted(set(item_names)))
|
||||
self.count = count
|
||||
|
||||
@@ -1213,7 +1238,7 @@ class HasFromList(Rule[TWorld], game="Archipelago"):
|
||||
args = {**data.get("args", {})}
|
||||
item_names = args.pop("item_names", ())
|
||||
options = OptionFilter.multiple_from_dict(data.get("options", ()))
|
||||
return cls(*item_names, **args, options=options)
|
||||
return cls(*item_names, **args, options=options, filtered_resolution=data.get("filtered_resolution", False))
|
||||
|
||||
@override
|
||||
def __str__(self) -> str:
|
||||
@@ -1316,8 +1341,14 @@ class HasFromListUnique(Rule[TWorld], game="Archipelago"):
|
||||
count: int = 1
|
||||
"""The number of items the player needs to have"""
|
||||
|
||||
def __init__(self, *item_names: str, count: int = 1, options: Iterable[OptionFilter] = ()) -> None:
|
||||
super().__init__(options=options)
|
||||
def __init__(
|
||||
self,
|
||||
*item_names: str,
|
||||
count: int = 1,
|
||||
options: Iterable[OptionFilter] = (),
|
||||
filtered_resolution: bool = False,
|
||||
) -> None:
|
||||
super().__init__(options=options, filtered_resolution=filtered_resolution)
|
||||
self.item_names = tuple(sorted(set(item_names)))
|
||||
self.count = count
|
||||
|
||||
@@ -1341,7 +1372,7 @@ class HasFromListUnique(Rule[TWorld], game="Archipelago"):
|
||||
args = {**data.get("args", {})}
|
||||
item_names = args.pop("item_names", ())
|
||||
options = OptionFilter.multiple_from_dict(data.get("options", ()))
|
||||
return cls(*item_names, **args, options=options)
|
||||
return cls(*item_names, **args, options=options, filtered_resolution=data.get("filtered_resolution", False))
|
||||
|
||||
@override
|
||||
def __str__(self) -> str:
|
||||
|
||||
Reference in New Issue
Block a user