Core+RB: Make has_from_list, has_from_list_unique, has_group and has_group_unique return True if count <= 0 and list is empty (#6240)

This commit is contained in:
Ishigh1
2026-06-03 08:20:04 +02:00
committed by GitHub
parent ad0af18f51
commit 2a8ebe2399
2 changed files with 25 additions and 6 deletions
+8
View File
@@ -1038,6 +1038,8 @@ class CollectionState():
def has_from_list(self, items: Iterable[str], player: int, count: int) -> bool:
"""Returns True if the state contains at least `count` items matching any of the item names from a list."""
if count <= 0:
return True
found: int = 0
player_prog_items = self.prog_items[player]
for item_name in items:
@@ -1049,6 +1051,8 @@ class CollectionState():
def has_from_list_unique(self, items: Iterable[str], player: int, count: int) -> bool:
"""Returns True if the state contains at least `count` items matching any of the item names from a list.
Ignores duplicates of the same item."""
if count <= 0:
return True
found: int = 0
player_prog_items = self.prog_items[player]
for item_name in items:
@@ -1077,6 +1081,8 @@ class CollectionState():
# item name group related
def has_group(self, item_name_group: str, player: int, count: int = 1) -> bool:
"""Returns True if the state contains at least `count` items present in a specified item group."""
if count <= 0:
return True
found: int = 0
player_prog_items = self.prog_items[player]
for item_name in self.multiworld.worlds[player].item_name_groups[item_name_group]:
@@ -1089,6 +1095,8 @@ class CollectionState():
"""Returns True if the state contains at least `count` items present in a specified item group.
Ignores duplicates of the same item.
"""
if count <= 0:
return True
found: int = 0
player_prog_items = self.prog_items[player]
for item_name in self.multiworld.worlds[player].item_name_groups[item_name_group]: