From 1649aaffb0914932f8577018e13aff03fd331664 Mon Sep 17 00:00:00 2001 From: "barraux.a" Date: Wed, 21 Sep 2022 11:23:28 +0200 Subject: [PATCH] patch de l'invetaire --- main.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index d51219a..f9b083b 100644 --- a/main.py +++ b/main.py @@ -245,7 +245,7 @@ class App: gui.draw('Eau de vie', 30*x+10, 17*y+2, color=color_fill) for i in range(len(self.potion_shape)): gui.draw(self.potion_shape[i], 30*x+6, 17*y+3+i, color=color_fill) - gui.display() + gui.display() def combat(self, ennemi): """Simule l'attaque des joeurs""" @@ -345,10 +345,11 @@ class App: if position[0] > 0: position[0] -= 1 elif key == getkey.keys.ENTER: - self.character.pdv += round((self.character.max_pdv - self.character.pdv) * 0.5) - if self.character.pdv > self.character.max_pdv: - self.character.pdv = self.character.max_pdv - self.character.inv.remove('potion') + if self.character.inv.count('potion') > 0: + self.character.pdv += round((self.character.max_pdv - self.character.pdv) * 0.5) + if self.character.pdv > self.character.max_pdv: + self.character.pdv = self.character.max_pdv + self.character.inv.remove('potion') elif key == getkey.keys.ESCAPE: break if choice == 2: