Example #1
0
bool ResourceManager::hasResources(TechType type)
{
	int nMinerals = type.mineralPrice();
	int nGas = type.gasPrice();

	return hasResources(nMinerals, nGas);
}
Example #2
0
bool ResourceManager::needWorker()
{
	int workersPerBase = 18;
	if (BuildPlanner::isZerg())
	{
		workersPerBase = 10;
	}

	int noBases = AgentManager::Instance().countNoBases();
	int noRefinery = AgentManager::Instance().countNoUnits(Broodwar->self()->getRace().getRefinery());
	int idealNoWorkers = noBases * workersPerBase + noRefinery * 3;
	if (idealNoWorkers > 60) idealNoWorkers = 60;

	int noWorkers = AgentManager::Instance().getNoWorkers();
	if (noWorkers < idealNoWorkers)
	{
		//Check if we have enough resources
		int nMinerals = Broodwar->self()->getRace().getWorker().mineralPrice();
		if (hasProductionBuilding())
		{
			nMinerals += 150;
		}
		return hasResources(nMinerals, 0);
	}
	return false;
}
Example #3
0
bool ResourceManager::hasResources(UpgradeType type)
{
	int nMinerals = type.mineralPrice();
	int nGas = type.gasPrice();

	return hasResources(nMinerals, nGas, false);
}
Example #4
0
bool ResourceManager::needWorker()
{
	int workersPerBase = 18;
	if (BuildPlanner::isZerg())
	{
		workersPerBase = 11;
	}

	int noBases = AgentManager::getInstance()->countNoBases();
	int noRefinery = AgentManager::getInstance()->countNoUnits(Broodwar->self()->getRace().getRefinery());
	int idealNoWorkers = (noBases > 1 ? noBases - 1 : noBases) * workersPerBase + noRefinery * 2;
	if (idealNoWorkers > 30) idealNoWorkers = 30;

	int noWorkers = AgentManager::getInstance()->getNoWorkers();
	if (noWorkers < idealNoWorkers)
	{
		////Check if we have enough resources
		//int nMinerals = Broodwar->self()->getRace().getWorker().mineralPrice();
		//if (hasProductionBuilding())
		//{
		//	nMinerals += 150;
		//}
		//return hasResources(nMinerals, 0, false);
		return hasResources(Broodwar->self()->getRace().getWorker());
	}
	return false;
}
Example #5
0
bool ResourceManager::hasResources(UnitType type)
{
	int nMinerals = type.mineralPrice();
	int nGas = type.gasPrice();

	if (type.isBuilding())
	{
		if (hasProductionBuilding())
		{
			nMinerals += 150;
			if (nGas > 0)
			{
				nGas += 100;
			}
		}
	}

	return hasResources(nMinerals, nGas);
}
Example #6
0
bool ResourceManager::hasResources(UnitType type)
{
	int nMinerals = type.mineralPrice();
	int nGas = type.gasPrice();

	/*if (type.isBuilding())
	{
		if (hasProductionBuilding())
		{
			nMinerals += 150;
			if (nGas > 0)
			{
				nGas += 100;
			}
		}
	}*/

	return hasResources(nMinerals, nGas, type.isResourceDepot() || type.isWorker());
}