Skip to content

Commit

Permalink
Merge pull request #152 from hanzi/fix-item-stack-size
Browse files Browse the repository at this point in the history
Fix item stack sizes for 'bag full' calculation
  • Loading branch information
40Cakes authored Dec 14, 2023
2 parents eb11b79 + afed78f commit 9c3c9d9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,14 @@ def has_space_for(self, item: Item) -> bool:
if len(pocket) < pocket_size:
return True

# In FireRed/LeafGreen, you can always put 999 items in a stack. In RSE, this only works for berries.
if context.rom.game_title in ["POKEMON FIRE", "POKEMON LEAF"] or item.pocket == ItemPocket.Berries:
stack_size = 999
else:
stack_size = 99

for slot in pocket:
if slot.item == item and slot.quantity < 99:
if slot.item == item and slot.quantity < stack_size:
return True

return False
Expand Down Expand Up @@ -243,7 +249,7 @@ def has_space_for(self, item: Item) -> bool:
return True

for slot in self.items:
if slot.item == item and slot.quantity < 99:
if slot.item == item and slot.quantity < 999:
return True

return False
Expand Down

0 comments on commit 9c3c9d9

Please sign in to comment.