#ifndef CAPTURETHEDRAGONBALLS_H
#define CAPTURETHEDRAGONBALLS_H

/**
* Capture the dragonballs gamerules
* @version 16-9-2001
* @author Herwin 'harSens' van Welbergen
*/
class CHalfLifeCaptureTheDragonBalls : public CHalfLifeTeamplay
{
public:
	/**
	* constructor
	*/
	CHalfLifeCaptureTheDragonBalls();

	/**
	* initialize the hud
	* @param CBasePlayer *pl: the player to update the HUD for
	*/
	void InitHUD( CBasePlayer *pl );

	/**
	* Think function
	*/
	void Think();

	/**
	* Handles commands from the client
	* CBasePlayer *pPlayer: the player who got the command
	* const char *pcmd: the command
	* @returns BOOL: command handled?
	*/
	BOOL ClientCommand( CBasePlayer *pPlayer, const char *pcmd );
	
	/**
	* Dragonball has been picked up
	* @param int nr: the dragonball that's picked up
	*/
	void DragonBallPickUp(int nr, int playerIndex);

	/**
	* Dragonball has been dropped
	* @param int nr: the nr of the dropped dragonball
	* @param DragonBall *ball: the dropped dragonball
	*/
	void DragonBallDrop(int nr, CDragonBall *ball);

	/**
	* Player pressed use (to do a wish)
	* @param CBasePlayer *pl: the player who pressed use
	*/
	virtual BOOL PlayerUses(CBasePlayer *pl);

	//added by Rick: can we wish?
	virtual BOOL CanWish(void) { return m_fCanWish; };

private:
	/**
	* searches places to spawn the dragonballs
	*/
	void SpawnDragonBalls();

	/**
	* Checks if the balls are gathered
	* @returns BOOL: true if balls are gathered
	*/
	BOOL DragonBallsGathered();

	/**
	* add wishpoints and spreads the dragonballs
	* @param CBasePlayer *pl: the player doing the wish
	* @param int wishpoints: the wishpoints to add
	*/
	void FinishWish(CBasePlayer *pl, int wishpoints);

	/**
	* gets the game name that gets seen in the server browser
	* @return const char: The name of the play mode
	*/
	virtual const char *GetGameDescription( void ) { return "ESF Capture the Dragonballs"; }
	
	int m_fSpawnedBalls;
	int m_fRespawnBalls;
	int m_fCanWish;
	float m_flRespawnBallsTime;
	int m_fDragonBallsGathered;
	CDragonBall *m_pDragonBalls[7];
	CShenlong *m_pShenlong;
	BOOL m_fTeamPlayOnly;
};
#endif
