Skip to content

Commit 41cbf89

Browse files
committed
Merge "Don't count duplicate dungeon rewards or ocarina buttons" (#2319)
2 parents 0eb9b9b + 207d810 commit 41cbf89

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

State.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,8 @@ def has_all_of(self, items: Iterable[int]) -> bool:
6565
return False
6666
return True
6767

68-
def count_of(self, items: Iterable[int]) -> int:
69-
s = 0
70-
for i in items:
71-
s += self.solv_items[i]
72-
return s
68+
def count_distinct(self, items: Iterable[int]) -> int:
69+
return sum(1 for i in items if self.solv_items[i] > 0)
7370

7471
def item_count(self, item: int) -> int:
7572
return self.solv_items[item]
@@ -93,17 +90,17 @@ def heart_count(self) -> int:
9390
)
9491

9592
def has_medallions(self, count: int) -> bool:
96-
return self.count_of(ItemInfo.medallion_ids) >= count
93+
return self.count_distinct(ItemInfo.medallion_ids) >= count
9794

9895
def has_stones(self, count: int) -> bool:
99-
return self.count_of(ItemInfo.stone_ids) >= count
96+
return self.count_distinct(ItemInfo.stone_ids) >= count
10097

10198

10299
def has_dungeon_rewards(self, count: int) -> bool:
103-
return (self.count_of(ItemInfo.medallion_ids) + self.count_of(ItemInfo.stone_ids)) >= count
100+
return self.count_distinct(ItemInfo.medallion_ids) + self.count_distinct(ItemInfo.stone_ids) >= count
104101

105102
def has_ocarina_buttons(self, count: int) -> bool:
106-
return (self.count_of(ItemInfo.ocarina_buttons_ids)) >= count
103+
return self.count_distinct(ItemInfo.ocarina_buttons_ids) >= count
107104

108105
# TODO: Store the item's solver id in the goal
109106
def has_item_goal(self, item_goal: dict[str, Any]) -> bool:

version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '8.2.19'
1+
__version__ = '8.2.20'
22

33
# This is a supplemental version number for branches based off of main dev.
44
supplementary_version = 0

0 commit comments

Comments
 (0)