diff --git a/dungeonbattle/display/statsdisplay.py b/dungeonbattle/display/statsdisplay.py index 2eb76aa..70c6f0c 100644 --- a/dungeonbattle/display/statsdisplay.py +++ b/dungeonbattle/display/statsdisplay.py @@ -35,8 +35,13 @@ class StatsDisplay(Display): for _ in range(self.width - len(string3) - 1): string3 = string3 + " " self.pad.addstr(2, 0, string3) + + inventory_str = "Inventaire : " + "".join( + self.pack[item.name.upper()] for item in self.player.inventory) + self.pad.addstr(3, 0, inventory_str) + if self.player.dead: - self.pad.addstr(3, 0, "YOU ARE DEAD", + self.pad.addstr(4, 0, "VOUS ÊTES MORT", curses.A_BOLD | curses.A_BLINK | curses.A_STANDOUT | self.color_pair(3)) @@ -44,4 +49,4 @@ class StatsDisplay(Display): self.pad.clear() self.update_pad() self.pad.refresh(0, 0, self.y, self.x, - 3 + self.y, self.width + self.x) + 4 + self.y, self.width + self.x) diff --git a/dungeonbattle/entities/items.py b/dungeonbattle/entities/items.py index e4eb74d..4cfd26b 100644 --- a/dungeonbattle/entities/items.py +++ b/dungeonbattle/entities/items.py @@ -13,8 +13,10 @@ class Item(Entity): self.held = False def drop(self, y: int, x: int) -> None: - self.held = False - self.held_by = None + if self.held: + self.held_by.inventory.remove(self) + self.held = False + self.held_by = None self.map.add_entity(self) self.move(y, x) diff --git a/dungeonbattle/entities/player.py b/dungeonbattle/entities/player.py index 663a774..c1bde5e 100644 --- a/dungeonbattle/entities/player.py +++ b/dungeonbattle/entities/player.py @@ -15,9 +15,13 @@ class Player(FightingEntity): level: int = 1 current_xp: int = 0 max_xp: int = 10 - inventory: list = list() + inventory: list paths: Dict[Tuple[int, int], Tuple[int, int]] + def __init__(self): + super().__init__() + self.inventory = list() + def move(self, y: int, x: int) -> None: """ When the player moves, move the camera of the map.