From dd1773e142aca9bc1768eae5e0069006643dbfe9 Mon Sep 17 00:00:00 2001 From: Niklas Haiden Date: Fri, 8 May 2026 16:56:14 +0200 Subject: [PATCH] fix: fix buying logic for shop --- src/shop.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/shop.py b/src/shop.py index e20548c..f0a13eb 100644 --- a/src/shop.py +++ b/src/shop.py @@ -3,8 +3,8 @@ from src.item import Item class Shop: def __init__(self, ects, buyable_items): - self.ects = ects # give the ects object ot the shop - self.buyable_items: list[Item] = buyable_items # give the buyable items to the shop + self.ects = ects # give the ects object to the shop + self.buyable_items: list[Item] = buyable_items def buy(self, item_name): item_to_buy = self.get_item(item_name) @@ -12,11 +12,12 @@ class Shop: return False cost = item_to_buy.get_cost() - if self.ects.is_over_balance(cost): + + # is_over_balance() means "has enough balance" + if not self.ects.is_over_balance(cost): return False self.ects.decrease_balance(cost) - # self.buyable_items.remove(item_to_buy) return True def get_item(self, item_name):