diff --git a/squirrelbattle/entities/items.py b/squirrelbattle/entities/items.py index 8b99a8d..05654e9 100644 --- a/squirrelbattle/entities/items.py +++ b/squirrelbattle/entities/items.py @@ -276,7 +276,6 @@ class Sword(Weapon): def __init__(self, name: str = "sword", price: int = 20, *args, **kwargs): super().__init__(name=name, price=price, *args, **kwargs) - self.name = name class Armor(Item): @@ -307,24 +306,27 @@ class Shield(Armor): Class of shield items, they can be equipped in the other hand. """ - def __init__(self, constitution: int = 2, *args, **kwargs): - super().__init__(name="shield", constitution=constitution, *args, **kwargs) + def __init__(self, name: str = "shield", constitution: int = 2,\ + price: int = 6, *args, **kwargs): + super().__init__(name=name, constitution=constitution, *args, **kwargs) class Helmet(Armor): """ Class of helmet items, they can be equipped on the head. """ - def __init__(self, constitution: int = 2, *args, **kwargs): - super().__init__(name="helmet", constitution=constitution, *args, **kwargs) + def __init__(self, name: str = "helmet", constitution: int = 2, \ + price: int = 8, *args, **kwargs): + super().__init__(name=name, constitution=constitution, *args, **kwargs) class Chestplate(Armor): """ Class of chestplate items, they can be equipped on the body. """ - def __init__(self, constitution: int = 4, *args, **kwargs): - super().__init__(name="chestplate", constitution=constitution, *args, **kwargs) + def __init__(self, name: str = "chestplate", constitution: int = 4,\ + price: int = 15, *args, **kwargs): + super().__init__(name=name, constitution=constitution, *args, **kwargs) class BodySnatchPotion(Item): diff --git a/squirrelbattle/game.py b/squirrelbattle/game.py index d0aaf84..939325c 100644 --- a/squirrelbattle/game.py +++ b/squirrelbattle/game.py @@ -127,8 +127,8 @@ class Game: elif key == KeyValues.INVENTORY: self.state = GameMode.INVENTORY self.display_actions(DisplayActions.UPDATE) - elif key == KeyValues.USE and self.player.equipped_item: - self.player.equipped_item.use() + elif key == KeyValues.USE and self.player.equipped_main: + self.player.equipped_main.use() elif key == KeyValues.SPACE: self.state = GameMode.MAINMENU elif key == KeyValues.CHAT: diff --git a/squirrelbattle/interfaces.py b/squirrelbattle/interfaces.py index 25a8baa..cc5b36e 100644 --- a/squirrelbattle/interfaces.py +++ b/squirrelbattle/interfaces.py @@ -374,7 +374,7 @@ class Entity: TeddyBear, GiantSeaEagle from squirrelbattle.entities.friendly import Merchant, Sunflower from squirrelbattle.entities.items import BodySnatchPotion, Bomb, \ - Heart, Sword + Heart, Sword, Shield, Chestplate, Helmet return { "Tiger": Tiger, "Bomb": Bomb, @@ -388,6 +388,9 @@ class Entity: "Sunflower": Sunflower, "Sword": Sword, "Eagle": GiantSeaEagle, + "Shield": Shield, + "Chestplate": Chestplate, + "Helmet": Helmet, } def save_state(self) -> dict: