Linting and tests for chests
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
from ..interfaces import FriendlyEntity, InventoryHolder, Map, FightingEntity
|
||||
from ..interfaces import Entity, FriendlyEntity, InventoryHolder, \
|
||||
Map, FightingEntity
|
||||
from ..translations import gettext as _
|
||||
from .player import Player
|
||||
from .monsters import Monster
|
||||
@ -17,7 +18,7 @@ class Merchant(InventoryHolder, FriendlyEntity):
|
||||
return super().keys() + ["inventory", "hazel"]
|
||||
|
||||
def __init__(self, name: str = "merchant", inventory: list = None,
|
||||
hazel: int = 75, maxhealth = 8, *args, **kwargs):
|
||||
hazel: int = 75, maxhealth: int = 8, *args, **kwargs):
|
||||
super().__init__(name=name, maxhealth=maxhealth, *args, **kwargs)
|
||||
self.inventory = self.translate_inventory(inventory or [])
|
||||
self.hazel = hazel
|
||||
@ -38,6 +39,7 @@ class Merchant(InventoryHolder, FriendlyEntity):
|
||||
"""
|
||||
self.hazel += hz
|
||||
|
||||
|
||||
class Chest(InventoryHolder, FriendlyEntity):
|
||||
"""
|
||||
A class of chest inanimate entities which contain objects.
|
||||
@ -58,7 +60,7 @@ class Chest(InventoryHolder, FriendlyEntity):
|
||||
"""
|
||||
return _("You have opened the chest")
|
||||
|
||||
def take_damage(self, attacker: "Entity", amount: int) -> str:
|
||||
def take_damage(self, attacker: Entity, amount: int) -> str:
|
||||
"""
|
||||
A chest is not living, it can not take damage
|
||||
"""
|
||||
|
@ -88,7 +88,7 @@ class Item(Entity):
|
||||
Chestplate, Helmet, RingCritical, RingXP,
|
||||
ScrollofDamage, ScrollofWeakening, Ruler, Bow, FireBallStaff]
|
||||
|
||||
def be_sold(self, buyer: InventoryHolder, seller: InventoryHolder,\
|
||||
def be_sold(self, buyer: InventoryHolder, seller: InventoryHolder,
|
||||
for_free: bool = False) -> bool:
|
||||
"""
|
||||
Does all necessary actions when an object is to be sold.
|
||||
|
Reference in New Issue
Block a user