We can equip items
This commit is contained in:
@ -496,10 +496,10 @@ class InventoryHolder(Entity):
|
||||
"""
|
||||
for i in range(len(inventory)):
|
||||
if isinstance(inventory[i], dict):
|
||||
inventory[i] = self.dict_to_inventory(inventory[i])
|
||||
inventory[i] = self.dict_to_item(inventory[i])
|
||||
return inventory
|
||||
|
||||
def dict_to_inventory(self, item_dict: dict) -> Entity:
|
||||
def dict_to_item(self, item_dict: dict) -> Entity:
|
||||
"""
|
||||
Translate a dict object that contains the state of an item
|
||||
into an item object.
|
||||
@ -522,13 +522,15 @@ class InventoryHolder(Entity):
|
||||
"""
|
||||
Adds an object to inventory
|
||||
"""
|
||||
self.inventory.append(obj)
|
||||
if obj not in self.inventory:
|
||||
self.inventory.append(obj)
|
||||
|
||||
def remove_from_inventory(self, obj: Any) -> None:
|
||||
"""
|
||||
Removes an object from the inventory
|
||||
"""
|
||||
self.inventory.remove(obj)
|
||||
if obj in self.inventory:
|
||||
self.inventory.remove(obj)
|
||||
|
||||
def change_hazel_balance(self, hz: int) -> None:
|
||||
"""
|
||||
|
Reference in New Issue
Block a user