コード例 #1
0
bool BuildOrderManager::hasResources(BWAPI::UpgradeType t)
{
  if (BWAPI::Broodwar->self()->cumulativeMinerals()-this->usedMinerals< t.mineralPriceBase()+t.mineralPriceFactor()*(BWAPI::Broodwar->self()->getUpgradeLevel(t)-1))
    return false;
  if (BWAPI::Broodwar->self()->cumulativeGas()-this->usedGas<t.gasPriceBase()+t.gasPriceFactor()*(BWAPI::Broodwar->self()->getUpgradeLevel(t)-1))
    return false;
  return true;
}
コード例 #2
0
bool BuildOrderManager::hasResources(BWAPI::UpgradeType t, int time)
{
  pair<int, Resources> res;
  res.first=time;
  res.second.minerals=t.mineralPrice(this->upgradeManager->getPlannedLevel(t));
  res.second.gas=t.gasPrice(this->upgradeManager->getPlannedLevel(t));
  return hasResources(res);
}
コード例 #3
0
bool UpgradeManager::upgrade(BWAPI::UpgradeType type)
{
  int level=BWAPI::Broodwar->self()->getUpgradeLevel(type)+1;
  if (level>type.maxRepeats()) return false;
  Upgrade newUpgrade;
  newUpgrade.type=type;
  newUpgrade.level=level;
  upgradeQueues[*type.whatUpgrades()].push_back(newUpgrade);
  plannedLevel[type]=level;
  return true;
}
コード例 #4
0
ファイル: UpgradeManager.cpp プロジェクト: Ellyster/microAIUR
bool UpgradeManager::upgrade(BWAPI::UpgradeType type, int level)
{
	if (level<=0)
		level=this->getPlannedLevel(type)+1;
	if (level>type.maxRepeats()) return false;
	Upgrade newUpgrade;
	newUpgrade.type=type;
	newUpgrade.level=level;
	upgradeQueues[type.whatUpgrades()].push_back(newUpgrade);
	plannedLevel[type]=level;
	return true;
}
コード例 #5
0
ファイル: ActionTypeData.cpp プロジェクト: Cdingram/GGEZ-Bot
ActionID ActionTypeData::GetActionID(const BWAPI::UpgradeType & type) 
{
    const RaceID raceID = GetRaceID(type.getRace());
    for (ActionID a(0); a < ActionTypeData::GetNumActionTypes(raceID); ++a)
    {
        const ActionTypeData & data = GetActionTypeData(raceID, a);
        if (data.isUpgrade() && data.getUpgradeType() == type)
        {
            return data.getActionID();
        }
    }
   
	BOSS_ASSERT(false, "Could not find TechType: %d %s", type.getID(), type.getName().c_str());
    return 0;
}
コード例 #6
0
ファイル: ActionTypeData.cpp プロジェクト: Cdingram/GGEZ-Bot
// UpgradeType action
ActionTypeData::ActionTypeData(BWAPI::UpgradeType t, const ActionID id) 
	: type(UpgradeType)
	, upgrade(t)
	, actionID(id)
    , raceID(GetRaceID(t.getRace()))
	, mineralPriceVal(t.mineralPrice() * Constants::RESOURCE_SCALE)
	, gasPriceVal(t.gasPrice() * Constants::RESOURCE_SCALE)
	, supplyRequiredVal(0)
	, supplyProvidedVal(0)
	, buildTimeVal(t.upgradeTime())
	, numberProduced(1)
	, name(t.getName())
	, metaName(t.getName())
	, building(false)
	, worker(false)
	, refinery(false)
	, resourceDepot(false)
	, supplyProvider(false)
	, canProduceBool(false)
	, canAttackBool(false)
	, whatBuildsUnitType(t.whatUpgrades())
    , addon(false)
    , reqAddon(false)
    , reqAddonID(0)
    , morphed(false)
{
    setShortName();
}
コード例 #7
0
ファイル: UpgradeTest.cpp プロジェクト: RadicalZephyr/bwapi
UpgradeTest::UpgradeTest(BWAPI::UpgradeType upgradeType) : upgradeType(upgradeType),
                                                           upgrader(NULL),
                                                           startUpgradeFrame(-1),
                                                           nextUpdateFrame(-1)
{
  fail = false;
  running = false;
  upgraderType = upgradeType.whatUpgrades();
  BWAssertF(upgraderType!=UnitTypes::None,{fail=true;return;});
コード例 #8
0
CancelUpgradeTest::CancelUpgradeTest(BWAPI::UpgradeType upgradeType) : upgradeType(upgradeType),
                                                                       upgraderType(upgradeType.whatUpgrades()),
                                                                       startFrame(-1),
                                                                       nextFrame(-1),
                                                                       upgrader(NULL),
                                                                       correctMineralCount(0),
                                                                       correctGasCount(0),
                                                                       correctSupplyUsedCount(0)
{
  fail = false;
  running = false;
  BWAssertF(upgraderType!=UnitTypes::None,{fail=true;return;});
コード例 #9
0
ファイル: Producer.cpp プロジェクト: AIUR-group/BroodwarBotQ
/***
 * Researches the UpgradeType t
 */
void Producer::researchUpgrade(BWAPI::UpgradeType t)
{
	if (Broodwar->self()->getUpgradeLevel(t) >= t.maxRepeats())
		return;
	checkCanUpgrade(t);
	for (list<UpgradeType>::const_iterator it = _upgradesQueue.begin();
		it != _upgradesQueue.end(); ++it)
	{
		if (*it == t)
			return;
	}
	_upgradesQueue.push_back(t);
}
コード例 #10
0
bool CheeseStrategies::StandardPlay::startUpgrade(BWAPI::UpgradeType upgrade) {
   UnitType upBuildingType = upgrade.whatUpgrades();

    if (Broodwar->self()->completedUnitCount(upBuildingType) == 0) {
        return false;
    }

    UnitSet myUnits = BWAPI::Broodwar->self()->getUnits();
    UnitSet::iterator it;

    BWAPI::Unit* upBuilding;

    for (it=myUnits.begin(); it!=myUnits.end(); it++) {
        if ((*it)->getType() == upBuildingType) {
            upBuilding = (*it);
        }
    }

    return upBuilding->upgrade(upgrade);
}
コード例 #11
0
void BuildOrderManager::spendResources(BWAPI::UpgradeType t)
{
  this->usedMinerals+=t.mineralPrice(this->upgradeManager->getPlannedLevel(t));
  this->usedGas+=t.gasPrice(this->upgradeManager->getPlannedLevel(t));
}
コード例 #12
0
MetaType::MetaType (BWAPI::UpgradeType t)
    : _upgradeType(t)
    , _type(MetaTypes::Upgrade)
    , _race(t.getRace())
{
}
コード例 #13
0
ファイル: Resources.cpp プロジェクト: albertouri/dementor-bot
Resources::Resources(BWAPI::UpgradeType type, int level)
{
  minerals = type.mineralPrice(level);
  gas      = type.gasPrice(level);
  supply   = 0.0;
}
コード例 #14
0
void BuildOrderManager::spendResources(BWAPI::UpgradeType t)
{
  this->usedMinerals+=t.mineralPriceBase()+t.mineralPriceFactor()*(BWAPI::Broodwar->self()->getUpgradeLevel(t)-1);
  this->usedGas+=t.gasPriceBase()+t.gasPriceFactor()*(BWAPI::Broodwar->self()->getUpgradeLevel(t)-1);
}
コード例 #15
0
ファイル: ActionTypeData.cpp プロジェクト: Cdingram/GGEZ-Bot
ActionTypeData ActionTypeData::GetActionTypeData(const BWAPI::UpgradeType & a)
{
    return GetActionTypeData(GetRaceID(a.getRace()), GetActionID(a));
}