mechanic: cap new item wins on huge inventories

This commit is contained in:
Dash committed 2026-10-17 15:55:46 +02:00
1 parent 17e1b91a18
commit 9942091af7
5 files changed
+3898 -3832

No files matched your search

+11 -1
View File
@@ -469,7 +469,17 @@ class Player(SignalMixin):
self.equipment.put(choice, name)
def win_item(self, data: GameData) -> None:
self.inventory.add(special_item(data), 1)
# Past 250 rows, sometimes add one more of something already carried.
# Upstream counts the Gold row too, and picking it yields 1 gold.
rows = len(self.inventory) + 1
if max(250, random.below(999)) < rows:
index = random.below(rows)
if index == 0:
self.inventory.add_gold(1)
else:
self.inventory.add(self.inventory[index - 1].name, 1)
else:
self.inventory.add(special_item(data), 1)
class Simulation: