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

	return hasResources(nMinerals, nGas);
}
示例#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;
}
示例#3
0
bool ResourceManager::hasResources(UpgradeType type)
{
	int nMinerals = type.mineralPrice();
	int nGas = type.gasPrice();

	return hasResources(nMinerals, nGas, false);
}
示例#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;
}
示例#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);
}
示例#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());
}