From 76bbee7e6db23677c2b3c2119edc53db1cf02d96 Mon Sep 17 00:00:00 2001 From: eichhornchen Date: Fri, 27 Nov 2020 16:56:22 +0100 Subject: [PATCH] Added a merchant class and a talk_to method to interact with friendly entities --- squirrelbattle/entities/friendly.py | 20 ++++++++++++++++++++ squirrelbattle/interfaces.py | 3 +++ 2 files changed, 23 insertions(+) create mode 100644 squirrelbattle/entities/friendly.py diff --git a/squirrelbattle/entities/friendly.py b/squirrelbattle/entities/friendly.py new file mode 100644 index 0000000..7cbd03a --- /dev/null +++ b/squirrelbattle/entities/friendly.py @@ -0,0 +1,20 @@ +from ..interfaces import FriendlyEntity, Map + +class Merchant(FriendlyEntity) : + """ + The class for merchants in the dungeon + """ + + inventory = list + + def __init__(self, inventory : list): + super().__init__() + self.inventory = inventory + + def talk_to(self, player : Player) -> None: + """ + This function is used to open the merchant's inventory in a menu, + and allow the player to buy/sell objects + """ + #TODO + diff --git a/squirrelbattle/interfaces.py b/squirrelbattle/interfaces.py index 7fc4171..b629b96 100644 --- a/squirrelbattle/interfaces.py +++ b/squirrelbattle/interfaces.py @@ -435,4 +435,7 @@ class FriendlyEntity(Entity): super().__init__(*args, **kwargs) self.maxhealth = maxhealth self.health = maxhealth if health is None else health + + def talk_to(self, player : Player) -> None: + #TODO