1 #ifndef POWERUP_H_
2 #define POWERUP_H_
3 
4 #include <sstream>
5 
6 #include <boost/format.hpp>
7 
8 //#include "Game.h"
9 #include "Weapon.h"
10 #include "lifeforms/Player.h"
11 #include "../system/graphic/StaticObject.h"
12 #include "../system/InputHandler.h"
13 
14 
15 namespace violetland {
16 class Game;
17 
18 enum BonusType {
19 	BONUS_MEDIKIT = 0,
20 	BONUS_WEAPON,
21 	BONUS_GRENADES,
22 	BONUS_FREEZE,
23 	BONUS_PENBULLETS,
24 	BONUS_NUKE,
25 	BONUS_VITALITYROIDS,
26 	BONUS_AGILITYROIDS,
27 	BONUS_STRENGTHROIDS,
28 	BONUS_TELEPORTS
29 };
30 
31 class BasePowerup: public StaticObject {
32 	const std::string m_hudInfo;
33 public:
34 	BasePowerup(float x, float y, Texture *tex);
35 
36 	virtual const std::string getHudInfo() const = 0;
37 	virtual BonusType getType() const = 0;
38 	virtual bool modify(Game* game, Player* player) = 0;
39 	void process(int timeDelta);
40 	int Time;
41 	int Dir;
42 };
43 
44 /*class Powerup: public BasePowerup {
45 	const std::string m_hudInfo;
46 	const BonusType m_type;
47 public:
48 	Powerup(float x, float y, Texture *tex, std::string hudInfo,
49 				BonusType type, void* object):
50 				BasePowerup(x, y, tex), m_hudInfo(hudInfo),
51 				m_type(type), Object(object)
52 				{}
53 	~Powerup();
54 	const std::string getHudInfo() const {
55 		return m_hudInfo;
56 	}
57 	BonusType getType() const {
58 		return m_type;
59 	}
60 	void *Object;
61 };*/
62 
63 class MedikitPowerup: public BasePowerup {
64 	const float m_value;
65 public:
MedikitPowerup(float x,float y,Texture * tex,float value)66 	MedikitPowerup(float x, float y, Texture *tex, float value):
67 				BasePowerup(x, y, tex), m_value(value)
68 				{}
69 	const std::string getHudInfo() const;
getType()70 	BonusType getType() const {
71 		return BONUS_MEDIKIT;
72 	}
73 	bool modify(Game* game, Player* player);
74 };
75 
76 class GrenadePowerup: public BasePowerup {
77 public:
GrenadePowerup(float x,float y,Texture * tex)78 	GrenadePowerup(float x, float y, Texture *tex):
79 				BasePowerup(x, y, tex)
80 				{}
81 	const std::string getHudInfo() const;
getType()82 	BonusType getType() const {
83 		return BONUS_GRENADES;
84 	}
85 	bool modify(Game* game, Player* player);
86 };
87 
88 
89 class FreezePowerup: public BasePowerup {
90 public:
FreezePowerup(float x,float y,Texture * tex)91 	FreezePowerup(float x, float y, Texture *tex):
92 				BasePowerup(x, y, tex)
93 				{}
94 	const std::string getHudInfo() const;
getType()95 	BonusType getType() const {
96 		return BONUS_FREEZE;
97 	}
98 	bool modify(Game* game, Player* player);
99 };
100 
101 class NukePowerup: public BasePowerup {
102 public:
NukePowerup(float x,float y,Texture * tex)103 	NukePowerup(float x, float y, Texture *tex):
104 				BasePowerup(x, y, tex)
105 				{}
106 	const std::string getHudInfo() const;
getType()107 	BonusType getType() const {
108 		return BONUS_NUKE;
109 	}
110 	bool modify(Game* game, Player* player);
111 };
112 
113 class PenetrationBulletsPowerup: public BasePowerup {
114 public:
PenetrationBulletsPowerup(float x,float y,Texture * tex)115 	PenetrationBulletsPowerup(float x, float y, Texture *tex):
116 				BasePowerup(x, y, tex)
117 				{}
118 	const std::string getHudInfo() const;
getType()119 	BonusType getType() const {
120 		return BONUS_PENBULLETS;
121 	}
122 	bool modify(Game* game, Player* player);
123 };
124 
125 
126 class VitalityPowerup: public BasePowerup {
127 public:
VitalityPowerup(float x,float y,Texture * tex)128 	VitalityPowerup(float x, float y, Texture *tex):
129 				BasePowerup(x, y, tex)
130 				{}
131 	const std::string getHudInfo() const;
getType()132 	BonusType getType() const {
133 		return BONUS_VITALITYROIDS;
134 	}
135 	bool modify(Game* game, Player* player);
136 };
137 
138 class StrengthPowerup: public BasePowerup {
139 public:
StrengthPowerup(float x,float y,Texture * tex)140 	StrengthPowerup(float x, float y, Texture *tex):
141 				BasePowerup(x, y, tex)
142 				{}
143 	const std::string getHudInfo() const;
getType()144 	BonusType getType() const {
145 		return BONUS_STRENGTHROIDS;
146 	}
147 	bool modify(Game* game, Player* player);
148 };
149 
150 class AgilityPowerup: public BasePowerup {
151 public:
AgilityPowerup(float x,float y,Texture * tex)152 	AgilityPowerup(float x, float y, Texture *tex):
153 				BasePowerup(x, y, tex)
154 				{}
155 	const std::string getHudInfo() const;
getType()156 	BonusType getType() const {
157 		return BONUS_AGILITYROIDS;
158 	}
159 	bool modify(Game* game, Player* player);
160 };
161 
162 class TeleportPowerup: public BasePowerup {
163 public:
TeleportPowerup(float x,float y,Texture * tex)164 	TeleportPowerup(float x, float y, Texture *tex):
165 				BasePowerup(x, y, tex)
166 				{}
167 	const std::string getHudInfo() const;
getType()168 	BonusType getType() const {
169 		return BONUS_TELEPORTS;
170 	}
171 	bool modify(Game* game, Player* player);
172 };
173 
174 
175 class WeaponPowerup: public BasePowerup {
176 public:
177 	Weapon* weapon;
178 
WeaponPowerup(float x,float y,Weapon * weapon)179 	WeaponPowerup(float x, float y, Weapon* weapon):
180 		BasePowerup(x, y, weapon->getDroppedTex()), weapon(weapon) {}
181 
getHudInfo()182 	const std::string getHudInfo() const {
183 		return weapon->Name;
184 	}
getType()185 	BonusType getType() const {
186 		return BONUS_WEAPON;
187 	}
188 
189 	bool modify(Game* game, Player* player);
190 };
191 
192 }
193 
194 #endif /* POWERUP_H_ */
195