This commit is contained in:
Yohann D'ANELLO
2020-12-07 21:22:06 +01:00
parent b24cc1877f
commit 57fab7db51
8 changed files with 80 additions and 70 deletions

View File

@@ -15,7 +15,7 @@ class Player(FightingEntity):
max_xp: int = 10
inventory: list
paths: Dict[Tuple[int, int], Tuple[int, int]]
hazel: int #It is the currency of this game
hazel: int # It is the currency of this game
def __init__(self, name: str = "player", maxhealth: int = 20,
strength: int = 5, intelligence: int = 1, charisma: int = 1,
@@ -91,7 +91,7 @@ class Player(FightingEntity):
elif entity.is_item():
entity.hold(self)
elif entity.is_friendly():
# self.map.logs.add_message(entity.talk_to(self))
# self.map.logs.add_message(entity.talk_to(self))
self.map.logs.add_message(self.hit(entity))
if entity.dead:
self.add_xp(randint(3, 7))
@@ -124,12 +124,12 @@ class Player(FightingEntity):
queue.append((new_y, new_x))
self.paths = predecessors
def add_to_inventory(self, obj : Any) -> None :
def add_to_inventory(self, obj: Any) -> None:
"""
Adds an object to inventory
"""
self.inventory.append(obj)
def save_state(self) -> dict:
"""
Saves the state of the entity into a dictionary