Friendly entities are now a subclass of fighting entities, and can die. The T key is now used to talk to friendly entities

This commit is contained in:
eichhornchen
2020-12-04 00:27:25 +01:00
parent 654bab7c1d
commit 3886bee1ba
5 changed files with 57 additions and 16 deletions

View File

@ -10,6 +10,12 @@ class Merchant(FriendlyEntity) :
name = "Merchant"
inventory = list
hazel = int
def keys(self) -> list :
"""
Returns a friendly entitie's specific attributes
"""
return ["maxhealth", "health", "inventory", "hazel"]
def __init__(self, inventory : list, hazel : int = 75):
super().__init__()
@ -22,8 +28,7 @@ class Merchant(FriendlyEntity) :
and allow the player to buy/sell objects
"""
# TODO
class Sunflower(FriendlyEntity) :
"""
A friendly sunflower

View File

@ -84,7 +84,10 @@ 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))
return super().check_move(y, x, move_if_possible)
def recalculate_paths(self, max_distance: int = 8) -> None: