summaryrefslogtreecommitdiff
path: root/inc/creature.hpp
blob: 67617c6a3a16cd7ee771b031e7f760abf7eb572a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef creature_h
#define creature_h

#include <SDL2/SDL.h>
#include <vector>
#include <algorithm>

#include "entity.hpp"
#include "constants.hpp"
#include "functions.hpp"
#include "dna.hpp"

class Creature: public Entity
{
  public:
    Creature(Window M, SDL_Rect R, Dna D);
    void    Behavior();
    void    Action();
    void    Priority();
    void    setTarget();
    void    checkTarget();
    void    moveTowards(SDL_Rect R);
    void    impregnate(Dna D);
    void    giveN(std::vector<Entity*> n){N = n;};
    
    Dna     getDNA(){return mine;};
    Dna     getChildDNA(){return childs;};
    int     getHealth(){return health;};
    int     getBestSense(){return mine.bestSense;};
    bool    getGender(){return gender;};
    bool    getPregnancyReady(){return pregnancyReady;};
    void    hadPregnancy(){pregnate = pregnancyReady = false;};
  
  private:
    SDL_Rect                wTarget;
    Entity                  *target;
    std::vector<Entity*>    N;
    Dna                     mine;
    Dna                     childs;

    int     health; 
    int     amountAte;
    int     pregnancyTime;
    int     age;

    bool    hungry; 
    bool    pregnancyReady;
    bool    able;     
    bool    hasTarget;
    bool    wander;
};

#endif