#include "BaseModelConsistencyMonitor.h"
#include "Overseer.h"

BaseModelConsistencyMonitor::BaseModelConsistencyMonitor(Overseer* ov, BaseModel* b)
{
	owner = b;
	overseer = ov;
	//registerNewBuilding(Broodwar->self()->getRace().getCenter());
}

BaseModelConsistencyMonitor::BaseModelConsistencyMonitor( Overseer* ov )
{
	overseer = ov;
}

void BaseModelConsistencyMonitor::registerNewBuilding( UnitType t )
{
	if(owner != NULL) {
	if(t == UnitTypes::Protoss_Nexus) {
		if(owner->getStartMinerals()*0.25 >= owner->getCurMineralsLeft()) {

		} else {
			return;
		}
	}
	//////Broodwar->sendText("rebuilding.... %s", t.getName().c_str());

	owner->getBuildOrder()->addToOpeningSequenceUrgent(t);
	if(t == UnitTypes::Protoss_Photon_Cannon) {
	int r = rand()%100;
	if(r > 90) {
		owner->getBuildOrder()->addToOpeningSequenceUrgent(t);
	}
	}
	}

}

void BaseModelConsistencyMonitor::attachBaseModel( BaseModel* bm )
{
	owner = bm;
}
