diff --git a/dungeonbattle/entities/items.py b/dungeonbattle/entities/items.py index 1443e2d..989b52f 100644 --- a/dungeonbattle/entities/items.py +++ b/dungeonbattle/entities/items.py @@ -6,8 +6,10 @@ from ..interfaces import Entity, FightingEntity, Map class Item(Entity): held: bool - hold_by: Optional["Player"] - can_be_in_inventory: bool = False + held_by: Optional["Player"] + # When it is False, items disappear when they are hold. + # Action is done when the item is picked up. + can_be_in_inventory: bool = True def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -15,13 +17,13 @@ class Item(Entity): def drop(self, y: int, x: int) -> None: self.held = False - self.hold_by = None + self.held_by = None self.map.add_entity(self) self.move(y, x) def hold(self, player: "Player") -> None: self.held = True - self.hold_by = player + self.held_by = player self.map.remove_entity(self) if self.can_be_in_inventory: player.inventory.append(self)