Added a friendly entity class.
This commit is contained in:
		@@ -422,3 +422,17 @@ class FightingEntity(Entity):
 | 
			
		||||
        for name in self.keys():
 | 
			
		||||
            d[name] = getattr(self, name)
 | 
			
		||||
        return d
 | 
			
		||||
 | 
			
		||||
class FriendlyEntity(Entity):
 | 
			
		||||
    """
 | 
			
		||||
    Friendly entities are living entities which do not attack the player
 | 
			
		||||
    """
 | 
			
		||||
    maxhealth: int
 | 
			
		||||
    health: int #Friendly entities can be killed
 | 
			
		||||
 | 
			
		||||
    def __init__(self, maxhealth: int = 0, health: Optional[int] = None,
 | 
			
		||||
                 *args, **kwargs) -> None:
 | 
			
		||||
        super().__init__(*args, **kwargs)
 | 
			
		||||
        self.maxhealth = maxhealth
 | 
			
		||||
        self.health = maxhealth if health is None else health
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user