//	MineModifiers.h - Base classes for the various Mine modifiers.
//  ----------------------------------------------------------------------------
//	This file is part of 'NiallsAVLib', base code for any kind of audiovisual
//	apps.
//	Copyright (C) 2012  Niall Moody
//	
//	This program is free software: you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation, either version 3 of the License, or
//	(at your option) any later version.
//
//	This program is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU General Public License
//	along with this program.  If not, see <http://www.gnu.org/licenses/>.
//	----------------------------------------------------------------------------

#ifndef MINEMODIFIERS_H_
#define MINEMODIFIERS_H_

#include "ThreeFloats.h"
#include "c0xHeaders.h"
#include "TwoFloats.h"

class GamePlayState;
class Bullet;
class Zombie;
class Puddle;
class Mine;
class Tank;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
///	Base class for all modifiers which are called when a mine is triggered.
class MineTrigger
{
  public:
	///	Constructor.
	MineTrigger() {};
	///	Destructor.
	virtual ~MineTrigger() {};

	///	Called when a mine is triggered.
	virtual void trigger(const shared_ptr<Mine>& mine,
						 GamePlayState& state) = 0;
};

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
///	Base class for any puddle collision modifiers.
class PuddleCollisionModifier
{
  public:
	///	Constructor.
	PuddleCollisionModifier(const shared_ptr<Mine>& mine) {};
	///	Destructor.
	virtual ~PuddleCollisionModifier() {};

	///	Called when a tank collides with the puddle.
	virtual void collideTank(Puddle& puddle,
							 Tank& tank,
							 GamePlayState& state) = 0;
	///	Called when a bullet collides with the puddle.
	virtual void collideBullet(Puddle& puddle,
							   Bullet& bullet,
							   GamePlayState& state) = 0;
	///	Called when a zombie collides with the puddle.
	virtual void collideZombie(Puddle& puddle,
							   Zombie& zombie,
							   GamePlayState& state) = 0;
	///	Returns the colour for this modifier.
	virtual const ThreeFloats getColour() const = 0;
};

//------------------------------------------------------------------------------
///	Base class used to create a PuddleCollisionModifier.
class PuddleCollisionCreatorBase
{
  public:
	///	Constructor.
	PuddleCollisionCreatorBase() {};
	///	Destructor.
	virtual ~PuddleCollisionCreatorBase() {};

	///	Constructs the modifier.
	virtual shared_ptr<PuddleCollisionModifier> createModifier(const shared_ptr<Mine>& mine) const = 0;
};
///	The template class used to actually create a PuddleCollisionModifier.
template <class T> class PuddleCollisionCreator : public PuddleCollisionCreatorBase
{
  public:
	///	Constructor.
	PuddleCollisionCreator() {};
	///	Destructor.
	~PuddleCollisionCreator() {};

	///	Constructs the modifier.
	shared_ptr<PuddleCollisionModifier> createModifier(const shared_ptr<Mine>& mine) const {return shared_ptr<PuddleCollisionModifier>(new T(mine));};
};

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
///	Base class for modifiers called whenever the secondary button is pressed.
class SecondaryModifier
{
  public:
	///	Constructor.
	SecondaryModifier() {};
	///	Destructor.
	virtual ~SecondaryModifier() {};

	///	Called when the player hits the secondary button (or Diarrhea Mines is on).
	virtual void trigger(Tank& tank, GamePlayState& state) = 0;
};

#endif
