This commit is contained in:
Yohann D'ANELLO
2021-01-06 18:02:58 +01:00
parent ae505166b7
commit a8c0c197ed
5 changed files with 32 additions and 22 deletions

View File

@ -107,7 +107,7 @@ class Item(Entity):
@staticmethod
def get_all_items() -> list:
return [BodySnatchPotion, Bomb, Heart, Shield, Sword,\
return [BodySnatchPotion, Bomb, Heart, Shield, Sword,
Chestplate, Helmet, RingCritical, RingXP]
def be_sold(self, buyer: InventoryHolder, seller: InventoryHolder) -> bool:
@ -283,7 +283,7 @@ class Armor(Item):
Class of items that increase the player's constitution.
"""
constitution: int
def __init__(self, constitution: int, *args, **kwargs):
super().__init__(*args, **kwargs)
self.constitution = constitution
@ -301,30 +301,33 @@ class Armor(Item):
d["constitution"] = self.constitution
return d
class Shield(Armor):
"""
Class of shield items, they can be equipped in the other hand.
"""
def __init__(self, name: str = "shield", constitution: int = 2,\
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, name: str = "helmet", constitution: int = 2, \
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, name: str = "chestplate", constitution: int = 4,\
def __init__(self, name: str = "chestplate", constitution: int = 4,
price: int = 15, *args, **kwargs):
super().__init__(name=name, constitution=constitution, *args, **kwargs)
@ -362,6 +365,7 @@ class BodySnatchPotion(Item):
self.held_by.inventory.remove(self)
class Ring(Item):
"""
A class of rings that boost the player's statistics.
@ -375,9 +379,9 @@ class Ring(Item):
critical: int
experience: float
def __init__(self, maxhealth: int = 0, strength: int = 0,\
intelligence: int = 0, charisma: int = 0,\
dexterity: int = 0, constitution: int = 0,\
def __init__(self, maxhealth: int = 0, strength: int = 0,
intelligence: int = 0, charisma: int = 0,
dexterity: int = 0, constitution: int = 0,
critical: int = 0, experience: float = 0, *args, **kwargs):
super().__init__(*args, **kwargs)
self.maxhealth = maxhealth
@ -416,14 +420,16 @@ class Ring(Item):
d["constitution"] = self.constitution
return d
class RingCritical(Ring):
def __init__(self, name: str = "ring_of_critical_damage", price: int = 15,
critical: int = 20, *args, **kwargs):
super().__init__(name=name, price=price, critical=critical, \
super().__init__(name=name, price=price, critical=critical,
*args, **kwargs)
class RingXP(Ring):
def __init__(self, name: str = "ring_of_more_experience", price: int = 25,
experience: float = 2, *args, **kwargs):
super().__init__(name=name, price=price, experience=experience, \
super().__init__(name=name, price=price, experience=experience,
*args, **kwargs)