2020-12-01 17:12:22 +01:00
|
|
|
from ..interfaces import FriendlyEntity
|
|
|
|
from ..translations import gettext as _
|
2020-11-27 18:35:52 +01:00
|
|
|
from .player import Player
|
2020-12-07 20:54:53 +01:00
|
|
|
from .items import Item
|
|
|
|
from random import choice
|
2020-11-27 16:56:22 +01:00
|
|
|
|
2020-12-01 17:12:22 +01:00
|
|
|
|
2020-11-27 16:56:22 +01:00
|
|
|
class Merchant(FriendlyEntity) :
|
|
|
|
"""
|
|
|
|
The class for merchants in the dungeon
|
|
|
|
"""
|
|
|
|
inventory = list
|
2020-11-27 18:35:52 +01:00
|
|
|
hazel = int
|
2020-12-04 00:27:25 +01:00
|
|
|
|
2020-12-05 21:43:13 +01:00
|
|
|
def keys(self) -> list:
|
2020-12-04 00:27:25 +01:00
|
|
|
"""
|
|
|
|
Returns a friendly entitie's specific attributes
|
|
|
|
"""
|
|
|
|
return ["maxhealth", "health", "inventory", "hazel"]
|
2020-11-27 16:56:22 +01:00
|
|
|
|
2020-12-07 21:13:55 +01:00
|
|
|
def __init__(self, name: str = "merchant", inventory: list = None,
|
|
|
|
hazel: int = 75, *args, **kwargs):
|
|
|
|
super().__init__(name=name, *args, **kwargs)
|
|
|
|
self.inventory = inventory or []
|
2020-11-27 18:35:52 +01:00
|
|
|
self.hazel = hazel
|
2020-12-07 21:13:55 +01:00
|
|
|
for i in range(5):
|
2020-12-07 20:54:53 +01:00
|
|
|
self.inventory.append(choice(Item.get_all_items())())
|
2020-11-27 16:56:22 +01:00
|
|
|
|
2020-12-05 21:43:13 +01:00
|
|
|
def talk_to(self, player : Player) -> str:
|
2020-11-27 16:56:22 +01:00
|
|
|
"""
|
|
|
|
This function is used to open the merchant's inventory in a menu,
|
|
|
|
and allow the player to buy/sell objects
|
|
|
|
"""
|
2020-12-01 17:12:22 +01:00
|
|
|
# TODO
|
2020-12-07 21:13:55 +01:00
|
|
|
return _("I don't sell any squirrel")
|
2020-12-04 00:27:25 +01:00
|
|
|
|
2020-11-27 18:35:52 +01:00
|
|
|
class Sunflower(FriendlyEntity) :
|
|
|
|
"""
|
|
|
|
A friendly sunflower
|
|
|
|
"""
|
2020-12-01 17:12:22 +01:00
|
|
|
dialogue_option = [_("Flower power!!"), _("The sun is warm today")]
|
2020-11-27 18:35:52 +01:00
|
|
|
|
|
|
|
def __init__(self, maxhealth: int = 15,
|
|
|
|
*args, **kwargs) -> None:
|
|
|
|
super().__init__(name="sunflower",
|
|
|
|
maxhealth=maxhealth, *args, **kwargs)
|