When an item is bought, remove it from the merchant inventory. Fixes #37

This commit is contained in:
Yohann D'ANELLO 2020-12-09 15:35:53 +01:00
parent 19b82ff71a
commit 405ee895d8
1 changed files with 3 additions and 1 deletions

View File

@ -193,7 +193,9 @@ class Game:
self.store_menu.go_down()
if self.store_menu.values and not self.player.dead:
if key == KeyValues.ENTER:
self.player.add_to_inventory(self.store_menu.validate())
item = self.store_menu.validate()
self.player.add_to_inventory(item)
self.store_menu.merchant.inventory.remove(item)
# Ensure that the cursor has a good position
self.store_menu.position = min(self.store_menu.position,
len(self.store_menu.values) - 1)