//	MADGenerator.cpp - The Mutually Assured Destruction pickup generation
//					   method.
//  ----------------------------------------------------------------------------
//	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/>.
//	----------------------------------------------------------------------------

#include "MADGenerator.h"
#include "GamePlayState.h"

//------------------------------------------------------------------------------
MADGenerator::MADGenerator(ModifierFactory& modFactory):
PickupGenerator(modFactory),
modifierFactory(modFactory),
maxGrade(2)
{

}

//------------------------------------------------------------------------------
MADGenerator::~MADGenerator()
{

}

//------------------------------------------------------------------------------
void MADGenerator::addStartingPickups(GamePlayState& state, int maxPickups)
{
	int i;

	for(i=0;i<maxPickups;++i)
		state.addPickup(modifierFactory.getGradedPickup(maxGrade));

	state.addMADButton();
}

//------------------------------------------------------------------------------
void MADGenerator::addNewPickup(GamePlayState& state)
{
	std::wstring pickup(modifierFactory.getGradedPickup(maxGrade));

	if(pickup != L"")
		state.addPickup(pickup);
}

//------------------------------------------------------------------------------
void MADGenerator::madButtonCollected(GamePlayState& state)
{
	int i;

	maxGrade = 3;

	for(i=state.getNumPickups();i<2;++i)
		addNewPickup(state);
}
