1 #ifndef LIFEFORM_H_
2 #define LIFEFORM_H_
3 
4 #ifdef _WIN32
5 #include "windows.h"
6 #endif //_WIN32W
7 #include "../../system/graphic/StaticObject.h"
8 #include "../../system/graphic/DynamicObject.h"
9 #include "../../system/sound/Sound.h"
10 #include "../../system/utility/UidGenerator.h"
11 
12 namespace violetland {
13 enum LifeFormType {
14 	LIFEFORM_PLAYER = 0, LIFEFORM_MONSTER
15 };
16 
17 enum LifeFormState {
18 	LIFEFORM_STATE_ALIVE = 0,
19 	LIFEFORM_STATE_SMITTEN,
20 	LIFEFORM_STATE_DYING,
21 	LIFEFORM_STATE_DIED,
22 	LIFEFORM_STATE_BURST
23 };
24 
25 class LifeForm: public Object {
26 private:
27 	int m_lastAttackTime;
28 	float m_health;
29 	const float fixHealth(float health) const;
30 protected:
31 	DynamicObject *m_body;
32 	bool m_walking;
33 	int m_walkTime;
34 	int m_walkDelay;
35 public:
36 	LifeFormType Type;
37 	LifeForm(float x, float y, int w, int h);
38 
39 	virtual void process(int deltaTime);
40 	virtual void draw();
41 	virtual Sound* hit(float damage, bool poison);
42 
43 	void move(float direction, int deltaTime);
44 
45 	std::string Id;
46 	std::string Name;
47 	float TargetX, TargetY;
48 	LifeFormState State;
49 
50 	// Attributes
51 
52 	int Level;
53 	float Strength;
54 	float Agility;
55 	float Vitality;
56 
57 	bool Poisoned;
58 	bool Burning;
59 	int Frozen;
60 
setHealth(float value)61 	void setHealth(float value) { m_health = fixHealth(value); }
getHealth()62 	const float getHealth() { return m_health = fixHealth(m_health); }
getStrength()63 	virtual float getStrength() const { return Strength; }
getAgility()64 	virtual float getAgility() const { return Agility; }
getVitality()65 	virtual float getVitality() const { return Vitality; }
66 	const float MaxHealth() const;
67 	const float MaxSpeed() const;
68 	const float ChanceToEvade() const;
69 	const bool Attack();
70 	const float Damage() const;
71 	const int AttackDelay() const;
72 	const float ReloadSpeedMod() const;
73 	const float WeaponRetForceMod() const;
74 	const float HealthRegen() const;
75 	virtual StaticObject* getCorpse() = 0;
76 	virtual ~LifeForm();
77 };
78 }
79 
80 #endif /* LIFEFORM_H_ */
81