Player now pays for what he buys and buying a heart does not put it in the inventory. Solves #38 and #36

This commit is contained in:
eichhornchen
2020-12-11 16:49:17 +01:00
parent 7ba49277a9
commit b9b776b7ad
4 changed files with 75 additions and 12 deletions

View File

@ -194,8 +194,10 @@ class Game:
if self.store_menu.values and not self.player.dead:
if key == KeyValues.ENTER:
item = self.store_menu.validate()
item.hold(self.player)
self.store_menu.merchant.inventory.remove(item)
flag = item.be_sold(self.player, self.store_menu.merchant, self)
if not flag :
self.message = _("You do not have enough money")
self.display_actions(DisplayActions.UPDATE)
# Ensure that the cursor has a good position
self.store_menu.position = min(self.store_menu.position,
len(self.store_menu.values) - 1)