Work in progress on printing a store menu. Its buggy though
This commit is contained in:
		@@ -1,13 +1,14 @@
 | 
			
		||||
from ..interfaces import FriendlyEntity
 | 
			
		||||
from ..translations import gettext as _
 | 
			
		||||
from .player import Player
 | 
			
		||||
from .items import Item
 | 
			
		||||
from random import choice
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Merchant(FriendlyEntity) :
 | 
			
		||||
    """
 | 
			
		||||
    The class for merchants in the dungeon
 | 
			
		||||
    """
 | 
			
		||||
    name = "Merchant"
 | 
			
		||||
    inventory = list
 | 
			
		||||
    hazel = int
 | 
			
		||||
    
 | 
			
		||||
@@ -17,10 +18,13 @@ class Merchant(FriendlyEntity) :
 | 
			
		||||
        """
 | 
			
		||||
        return ["maxhealth", "health", "inventory", "hazel"]
 | 
			
		||||
 | 
			
		||||
    def __init__(self, inventory : list, hazel : int = 75):
 | 
			
		||||
        super().__init__()
 | 
			
		||||
        self.inventory = inventory
 | 
			
		||||
    def __init__(self, name : str = "merchant", hazel : int = 75):
 | 
			
		||||
        super().__init__(name = name)
 | 
			
		||||
        self.hazel = hazel
 | 
			
		||||
        self.name = name
 | 
			
		||||
        self.inventory = []
 | 
			
		||||
        for i in range(5) :
 | 
			
		||||
            self.inventory.append(choice(Item.get_all_items())())
 | 
			
		||||
 | 
			
		||||
    def talk_to(self, player : Player) -> str:
 | 
			
		||||
        """
 | 
			
		||||
 
 | 
			
		||||
@@ -59,6 +59,9 @@ class Item(Entity):
 | 
			
		||||
        d = super().save_state()
 | 
			
		||||
        d["held"] = self.held
 | 
			
		||||
        return d
 | 
			
		||||
    
 | 
			
		||||
    def get_all_items() -> list:
 | 
			
		||||
        return [BodySnatchPotion, Bomb, Heart, Weapon, Sword]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Heart(Item):
 | 
			
		||||
@@ -166,9 +169,9 @@ class Sword(Weapon) :
 | 
			
		||||
    """
 | 
			
		||||
    A basic weapon
 | 
			
		||||
    """
 | 
			
		||||
    def __init__(self, name: int, *args, **kwargs):
 | 
			
		||||
        super().__init__(*args, **kwargs)
 | 
			
		||||
        self.name = "sword"
 | 
			
		||||
    def __init__(self, name: str = "sword", *args, **kwargs):
 | 
			
		||||
        super().__init__(name = name, *args, **kwargs)
 | 
			
		||||
        self.name = name
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
class BodySnatchPotion(Item):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user