Swords add strength
This commit is contained in:
parent
fe769c4488
commit
1b4612afd0
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue