#ifndef EXPLODINGATTACK_H
#define EXPLODINGATTACK_H
#include "../common/explosioncolors.h"
#define MIN_BLOCKPOINTS_FOR_STRUGGLE 15
#define MIN_EXPLOSION_PUSH_DMG 15	// added by pcjoe
class CPowerStruggle;
/**
* Exploding attacks
* @version 30-3-2002
* @author Herwin 'harSens' van Welbergen
*/
class CExplodingAttack:public CMagicAttack
{	
public:
	/**
	* init
	*/
	void Spawn( void );

	/**
	* init
	*/
	void Precache( void );

	/**
	* Explode on touch
	* @param CBaseEntity pOther: the entity wich is hit
	*/
	void EXPORT ExplodeTouch( CBaseEntity *pOther );

	/**
	* Struggles for power with another magic attack
	*/	                    
	void EXPORT PowerStruggleThink ( void );

	/**
	 * Struggles with a player
	 */
	void EXPORT BlockStruggleThink(void);
  
	int Classify(){return CLASS_EXPLODINGATTACK;}

	virtual int IsGuided(){return false;}
	/**
	 * explodes 
	 */
	virtual void Explode();

	int m_fPowerStruggle;
	int m_fBlockStruggle;
	int m_fBlockStruggleDamage;
	float m_flStruggleRatio;
	
	CBasePlayer *m_pBlockStruggler;	
	CPowerStruggle *m_pPowerStruggle;
	
	int m_fExploded;
	int m_fRemoveAfterExplode;

	/**
	 * Gets the explosion radius
	 * @return int: the explosion radius
	 */
	virtual float GetExplosionRadius() {return (pev->dmg * m_iRadius<RADIUS_UPPERLIMIT)?((pev->dmg * m_iRadius)<RADIUS_LOWERLIMIT?RADIUS_LOWERLIMIT:(pev->dmg * m_iRadius)):RADIUS_UPPERLIMIT;}

	/**
	 * Makes the attack disappear
	 */
	void Vaporize();

	/**
	 * stop bs, release guided attacks
	 */
	virtual void Release();

	int m_fStopped;
protected:
	/**
	 * draw the explosion fx
	 * @param radius the radius
	 * @param origin, the origin
	 */
	virtual void DrawExplosionFX(int radius, Vector origin);
	
	/**
	 * Swats the attack away
	 * CBasePlayer *pPlayer: player that swats it
	 * int fRandomDir: false, player can aim, true: random dir
	 */
	virtual void SwatAway(CBasePlayer *pPlayer, int fRandomDir);

	/**
	 * Powerstruggle an attack
	 * @param CExplodingAttack *pOther: the attack to ps with
	 * @param type: type of the ps, side or frontal
	 */
	void StartPowerStruggle(CExplodingAttack *pOther, int type);	

	/**
	 * Check if this attack can vaporize a player
	 * @return 1 if this attack can vaporize a player, 0 otherwise
	 */
	virtual int CanVaporizePlayer(){return 0;}

	int m_iRadius;				//the radius for the explosion
	// Edited by Pcjoe, made global
//	short m_sRockGibs;
	int m_iExplosionColor;	
	
	float m_flBlockStruggleDamage; //used to pile up damage < 1 in multiple thinks
};
#endif
