//	PickupRandom.cpp - Random Pickup.
//  ----------------------------------------------------------------------------
//	This file is part of 'GameTemplate', template code for a game.
//	Copyright (C) 2011  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/>.
//	----------------------------------------------------------------------------

#include "drawing/Drawer.h"
#include "PickupRandom.h"
#include "DebugHeaders.h"
#include "GameCounter.h"
#include "../Tone.h"
#include "Random.h"

#include "../pickups/Pickup2xSpeed.h"
#include "../pickups/PickupHalfSpeed.h"
#include "../pickups/PickupFreeze.h"
#include "../pickups/PickupSticky.h"
#include "../pickups/PickupReverse.h"
#include "../pickups/PickupDeflectUp.h"
#include "../pickups/PickupDeflectDown.h"
#include "../pickups/PickupPendulum.h"
#include "../pickups/PickupSplit.h"
#include "../pickups/PickupAutopilot.h"

#include <sstream>

using namespace std;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
PickupRandom::PickupRandom():
Pickup(L"Random")
{

}

//------------------------------------------------------------------------------
PickupRandom::~PickupRandom()
{

}

//------------------------------------------------------------------------------
shared_ptr<OverrideBehaviour> PickupRandom::getBehaviour() const
{
	int pickup;
	const int NumPickupTypes = 10;

	pickup = (int)(Random::getGlobal().getRandomFloat() * ((float)NumPickupTypes - 0.001f));

	switch(pickup)
	{
		case 0:
			return shared_ptr<OverrideBehaviour>(NiallNew Behaviour2xSpeed(L"pickup-2xSpeed"));
		case 1:
			return shared_ptr<OverrideBehaviour>(NiallNew BehaviourHalfSpeed(L"pickup-0.5xSpeed"));
		case 2:
			return shared_ptr<OverrideBehaviour>(NiallNew BehaviourFreeze(L"pickup-freeze"));
		case 3:
			return shared_ptr<OverrideBehaviour>(NiallNew BehaviourReverse(L"pickup-reverse"));
		case 4:
			return shared_ptr<OverrideBehaviour>(NiallNew BehaviourSticky(L"pickup-stickToRail"));
		case 5:
			return shared_ptr<OverrideBehaviour>(NiallNew BehaviourDeflectDown(L"pickup-deflectDown"));
		case 6:
			return shared_ptr<OverrideBehaviour>(NiallNew BehaviourDeflectUp(L"pickup-deflectUp"));
		case 7:
			return shared_ptr<OverrideBehaviour>(NiallNew BehaviourPendulum(L"pickup-pendulum"));
		case 8:
			return shared_ptr<OverrideBehaviour>(NiallNew BehaviourSplit(L"pickup-split"));
		case 9:
			return shared_ptr<OverrideBehaviour>(NiallNew BehaviourAutopilot(L"pickup-autopilot"));
		default:
			return shared_ptr<OverrideBehaviour>(NiallNew Behaviour2xSpeed(L"pickup-2xSpeed"));
	}
}
