Testing + linting (yes there remains two linting errors, i don't know what to do.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
from random import choice, shuffle
|
||||
|
||||
from .items import Item, Bomb
|
||||
from .items import Bomb, Item
|
||||
from .monsters import Monster
|
||||
from .player import Player
|
||||
from ..interfaces import Entity, FightingEntity, FriendlyEntity, \
|
||||
@@ -48,11 +48,14 @@ class Chest(InventoryHolder, FriendlyEntity):
|
||||
"""
|
||||
A class of chest inanimate entities which contain objects.
|
||||
"""
|
||||
annihilated: bool
|
||||
|
||||
def __init__(self, name: str = "chest", inventory: list = None,
|
||||
hazel: int = 0, *args, **kwargs):
|
||||
super().__init__(name=name, *args, **kwargs)
|
||||
self.hazel = hazel
|
||||
self.inventory = self.translate_inventory(inventory or [])
|
||||
self.annihilated = False
|
||||
if not self.inventory:
|
||||
for i in range(3):
|
||||
self.inventory.append(choice(Item.get_all_items())())
|
||||
@@ -68,8 +71,9 @@ class Chest(InventoryHolder, FriendlyEntity):
|
||||
"""
|
||||
A chest is not living, it can not take damage
|
||||
"""
|
||||
if isinstance(attacker, Bomb) :
|
||||
if isinstance(attacker, Bomb):
|
||||
self.die()
|
||||
self.annihilated = True
|
||||
return _("The chest exploded")
|
||||
return _("It's not really effective")
|
||||
|
||||
@@ -78,7 +82,7 @@ class Chest(InventoryHolder, FriendlyEntity):
|
||||
"""
|
||||
Chest can not die
|
||||
"""
|
||||
return False
|
||||
return self.annihilated
|
||||
|
||||
|
||||
class Sunflower(FriendlyEntity):
|
||||
|
||||
Reference in New Issue
Block a user