Пример #1
0
// 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();
}
Пример #2
0
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;});
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
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;});
Пример #5
0
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;
}
Пример #6
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);
}