from common import deepcopy, dataclass, field, path_exists

@dataclass
class Object:    
    id:                str
    name:              str 
    sprite_name:       str
    sprite_state:      int = 0

    def draw(self, draw_data):
        if draw_data["spr_up"] == 0:
            if self.sprite_state == len(draw_data["sprites"][self.sprite_name]) - 1:
                self.sprite_state = 0
            else:
                self.sprite_state += 1  

        sp = draw_data["sprites"][self.sprite_name][self.sprite_state]
        rect = sp.get_rect(center = (draw_data["x"] + draw_data["w"] /2, draw_data["y"] + draw_data["h"]/ 2))
        draw_data["screen"].blit(sp, rect)

    
@dataclass
class Terrain(Object):
    pass

@dataclass
class Creature(Object):
    pass
    #status
    #actions
    #tasks
    #items

@dataclass
class Item(Object):
    pass

@dataclass
class Building(Object):
    pass