From 519504fc32bdb4526309af26e7cc142bcdf1d819 Mon Sep 17 00:00:00 2001 From: Nicolas Margulies Date: Sun, 10 Jan 2021 22:26:43 +0100 Subject: [PATCH] Mark equipped items and allow unequipping --- squirrelbattle/display/menudisplay.py | 3 ++- squirrelbattle/game.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/squirrelbattle/display/menudisplay.py b/squirrelbattle/display/menudisplay.py index ccc3561..8dba478 100644 --- a/squirrelbattle/display/menudisplay.py +++ b/squirrelbattle/display/menudisplay.py @@ -176,7 +176,8 @@ class PlayerInventoryDisplay(MenuDisplay): selection = f"[{rep}]" if i == self.menu.position \ and self.selected else f" {rep} " self.addstr(self.pad, i + 1, 0, selection - + " " + item.translated_name.capitalize() + + " " + ("[E]" if item.equipped else "") + + item.translated_name.capitalize() + (f" ({item.description})" if item.description else "") + (": " + str(item.price) + " Hazels" if self.store_mode else "")) diff --git a/squirrelbattle/game.py b/squirrelbattle/game.py index 9cfa721..28bb1a3 100644 --- a/squirrelbattle/game.py +++ b/squirrelbattle/game.py @@ -309,7 +309,8 @@ class Game: if key == KeyValues.USE: self.inventory_menu.validate().use() elif key == KeyValues.EQUIP: - self.inventory_menu.validate().equip() + item = self.inventory_menu.validate() + item.unequip() if item.equipped else item.equip() elif key == KeyValues.DROP: self.inventory_menu.validate().drop()