diff --git a/squirrelbattle/entities/items.py b/squirrelbattle/entities/items.py index 9719e3a..5564cb0 100644 --- a/squirrelbattle/entities/items.py +++ b/squirrelbattle/entities/items.py @@ -225,9 +225,28 @@ class Sword(Weapon): """ A basic weapon """ - def __init__(self, name: str = "sword", price: int = 20, *args, **kwargs): + strength: int + + def __init__(self, name: str = "sword", price: int = 20, strength: int = 3, + *args, **kwargs): super().__init__(name=name, price=price, *args, **kwargs) self.name = name + self.strength = strength + + def equip(self) -> None: + """ + When a sword is equipped, the player gains strength. + """ + super().equip() + self.held_by.strength += self.strength + + def unequip(self) -> None: + """ + Remove the strength earned by the sword. + :return: + """ + super().unequip() + self.held_by.strength -= self.strength class BodySnatchPotion(Item):