#ifndef GAMEWORMS
#define GAMEWORMS

/* 	When you run the program you should now see WORMCOUNT "worms" of cCritterStubProp 
critters.
What makes them act like worms is that each critter after the head is connected by 
a kind of spring force to the critter ahead of it.  Notice that when the head critter
 wraps around the edge of the screen, the second critter goes over to the other side of 
the screen to get close to the head again.  And the subsidiary critters follow along. 
 What would happen if you shot a worm like this in half?.
	In the code below, we put the word virtual in front of all the methods that we have
	inherited from the base classes and which we plan to overload.  (These methods were
	already declared as virtual in the base classes, so that our overloads can take effect.
	Declaring them virtual in this child class only means that they could be further overloaded 
	in the children of the child.)
*/

#include "game.h"
#include "critterarmed.h"

//=== cGameWorms Critters ====================================

class cCritterWormsPlayer : public cCritterArmedPlayer //Our player.
{
DECLARE_SERIAL(cCritterWormsPlayer);
public:
	cCritterWormsPlayer();
//overloads
	virtual void reset();
	virtual BOOL collide(cCritter *pcritter); 
	virtual void update(CPopView *pactiveview, Real dt);
};

class cCritterWormsPlayerBullet : public cCritterBullet
{
DECLARE_SERIAL(cCritterWormsPlayerBullet);
public:
	cCritterWormsPlayerBullet();
};

class cCritterWormsRival : public cCritterArmedRobot //Or just a cCritter if not shooting
{
DECLARE_SERIAL(cCritterWormsRival);
public:
	cCritterWormsRival(cGame *pownergame = NULL); 
//overloads
	virtual int damage(int hitstrength);
	virtual BOOL collide(cCritter *pcritter); 
	virtual void update(CPopView *pactiveview, Real dt);
};

	/* The cCritterBulletSilver only can damage the ptarget of the
	shooter.   */
class cCritterWormsRivalBullet : public cCritterBullet
{
DECLARE_SERIAL(cCritterWormsRivalBullet);
public:
	cCritterWormsRivalBullet();
	virtual BOOL isTarget(cCritter *pcritter){return FALSE;} /* Don't blow
		up when you hit anyone. */
	virtual void initialize(cCritterArmed *pshooter);
		//Might overload this to make the size of the bullet depend on size of shooter,
		//or to change the forces on the bullet.
};

class cCritterWormSegment : public cCritter
{
DECLARE_SERIAL(cCritterWormSegment);
	public:
	cCritterWormSegment(cGame *pownergame = NULL, cCritter* ppriorsegment = NULL); 
//overloads
	virtual int damage(int hitstrength);
	virtual BOOL collide(cCritter *pcritter); 
	virtual void update(CPopView *pactiveview, Real dt);
};

//======================= cGameWorms ================


class cGameWorms : public cGame
{
DECLARE_SERIAL(cGameWorms);
//Name your statics here
public:
	static int PLAYERHEALTH;
	static int WORMCOUNT;
	static Real SPRINGFORCE;
protected:
	int _rivalcount; //possible params, don't have to use these.
public:
	cGameWorms();
 //overloads
	virtual void Serialize(CArchive& ar); 
	virtual void reset();
	virtual void adjustGameParameters();
	virtual CString statusMessage();
	virtual void initializeView(CPopView *pview);
	virtual void seedCritters();
};

#endif //GAMEWORMS