Added a merchant class and a talk_to method to interact with friendly entities
This commit is contained in:
		
							
								
								
									
										20
									
								
								squirrelbattle/entities/friendly.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								squirrelbattle/entities/friendly.py
									
									
									
									
									
										Normal file
									
								
							@@ -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
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
@@ -436,3 +436,6 @@ class FriendlyEntity(Entity):
 | 
				
			|||||||
        self.maxhealth = maxhealth
 | 
					        self.maxhealth = maxhealth
 | 
				
			||||||
        self.health = maxhealth if health is None else health
 | 
					        self.health = maxhealth if health is None else health
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def talk_to(self, player : Player) -> None:
 | 
				
			||||||
 | 
					        #TODO
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user