本文整理汇总了C++中bwta::BaseLocation::getGeysers方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseLocation::getGeysers方法的具体用法?C++ BaseLocation::getGeysers怎么用?C++ BaseLocation::getGeysers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bwta::BaseLocation
的用法示例。
在下文中一共展示了BaseLocation::getGeysers方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getBuildingLocation
BWAPI::TilePosition BuildingManager::getBuildingLocation(const Building & b)
{
int numPylons = BWAPI::Broodwar->self()->completedUnitCount(BWAPI::UnitTypes::Protoss_Pylon);
if (b.isGasSteal)
{
BWTA::BaseLocation * enemyBaseLocation = InformationManager::Instance().getMainBaseLocation(BWAPI::Broodwar->enemy());
UAB_ASSERT(enemyBaseLocation,"Should have enemy base location before attempting gas steal");
UAB_ASSERT(enemyBaseLocation->getGeysers().size() > 0,"Should have spotted an enemy geyser");
for (auto & unit : enemyBaseLocation->getGeysers())
{
BWAPI::TilePosition tp(unit->getInitialTilePosition());
return tp;
}
}
if (b.type.requiresPsi() && numPylons == 0)
{
return BWAPI::TilePositions::None;
}
//if building a bunker for strategy "Terran_Custom", return one location near an attacked unit
if ((b.type == BWAPI::UnitTypes::Terran_Bunker) && (Config::Strategy::StrategyName == "Terran_Custom"))
{
for (auto & unit : BWAPI::Broodwar->self()->getUnits())
{
if (unit->isUnderAttack())
{
return BuildingPlacer::Instance().getBuildLocationNear(b, 1, false);
break;
}
}
}
if (b.type.isRefinery())
{
return BuildingPlacer::Instance().getRefineryPosition();
}
if (b.type.isResourceDepot())
{
// get the location
BWAPI::TilePosition tile = MapTools::Instance().getNextExpansion();
return tile;
}
// set the building padding specifically
int distance = b.type == BWAPI::UnitTypes::Protoss_Photon_Cannon ? 0 : Config::Macro::BuildingSpacing;
if (b.type == BWAPI::UnitTypes::Protoss_Pylon && (numPylons < 3))
{
distance = Config::Macro::PylonSpacing;
}
// get a position within our region
return BuildingPlacer::Instance().getBuildLocationNear(b,distance,false);
}
示例2: getBuildingLocation
BWAPI::TilePosition BuildingManager::getBuildingLocation(const Building & b)
{
int numPylons = BWAPI::Broodwar->self()->completedUnitCount(BWAPI::UnitTypes::Protoss_Pylon);
if (b.isGasSteal)
{
BWTA::BaseLocation * enemyBaseLocation = InformationManager::Instance().getMainBaseLocation(BWAPI::Broodwar->enemy());
UAB_ASSERT(enemyBaseLocation,"Should have enemy base location before attempting gas steal");
UAB_ASSERT(enemyBaseLocation->getGeysers().size() > 0,"Should have spotted an enemy geyser");
for (auto & unit : enemyBaseLocation->getGeysers())
{
BWAPI::TilePosition tp(unit->getInitialTilePosition());
return tp;
}
}
if (b.type.requiresPsi() && numPylons == 0)
{
return BWAPI::TilePositions::None;
}
if (b.type.isRefinery())
{
return BuildingPlacer::Instance().getRefineryPosition();
}
if (b.type.isResourceDepot())
{
// get the location
BWAPI::TilePosition tile = MapTools::Instance().getNextExpansion();
return tile;
}
if (b.type == BWAPI::UnitTypes::Terran_Bunker)
{
BWTA::BaseLocation * enemyBaseLocation = InformationManager::Instance().getMainBaseLocation(BWAPI::Broodwar->enemy());
UAB_ASSERT(enemyBaseLocation, "Should have enemy base location before attempting gas steal");
BWTA::Chokepoint * chokePoint = BWTA::getNearestChokepoint(enemyBaseLocation->getTilePosition());
std::pair<BWAPI::Position, BWAPI::Position> sides = chokePoint->getSides();
BWAPI::Position poi = enemyBaseLocation->getPosition().getDistance(sides.first) > enemyBaseLocation->getPosition().getDistance(sides.second) ? sides.first : sides.second;
//BWAPI::Broodwar->printf("Tisssle Position (%d, %d)", BWAPI::TilePosition(poi).x, BWAPI::TilePosition(poi).y);
return BWAPI::TilePosition(sides.second);
}
// set the building padding specifically
int distance = b.type == BWAPI::UnitTypes::Protoss_Photon_Cannon ? 0 : Config::Macro::BuildingSpacing;
if (b.type == BWAPI::UnitTypes::Protoss_Pylon && (numPylons < 3))
{
distance = Config::Macro::PylonSpacing;
}
// get a position within our region
return BuildingPlacer::Instance().getBuildLocationNear(b,distance,false);
}
示例3: getEnemyGeyser
BWAPI::Unit ScoutManager::getEnemyGeyser()
{
BWAPI::Unit geyser = nullptr;
BWTA::BaseLocation * enemyBaseLocation = InformationManager::Instance().getMainBaseLocation(BWAPI::Broodwar->enemy());
for (auto & unit : enemyBaseLocation->getGeysers())
{
geyser = unit;
}
return geyser;
}
示例4: getEnemyGeyser
BWAPI::UnitInterface* ScoutManager::getEnemyGeyser()
{
BWAPI::UnitInterface* geyser = NULL;
BWTA::BaseLocation * enemyBaseLocation = InformationManager::Instance().getMainBaseLocation(BWAPI::Broodwar->enemy());
for (BWAPI::UnitInterface* unit : enemyBaseLocation->getGeysers())
{
geyser = unit;
}
return geyser;
}
示例5: isGasStealRefinery
bool WorkerManager::isGasStealRefinery(BWAPI::Unit unit)
{
BWTA::BaseLocation * enemyBaseLocation = InformationManager::Instance().getMainBaseLocation(BWAPI::Broodwar->enemy());
if (!enemyBaseLocation)
{
return false;
}
if (enemyBaseLocation->getGeysers().empty())
{
return false;
}
for (auto & u : enemyBaseLocation->getGeysers())
{
if (unit->getTilePosition() == u->getTilePosition())
{
return true;
}
}
return false;
}
示例6: getSunkenPosition
// Get a sunken position depending on whether or not we have an expansion.
BWAPI::TilePosition BuildingManager::getSunkenPosition()
{
BWAPI::UnitType sunk = BWAPI::UnitTypes::Zerg_Creep_Colony;
// Always make sunkens at natural expansion if you can.
if (createdHatcheriesSet.size() >= 1)
{
BWAPI::TilePosition hatchPosition = createdHatcheriesVector[0];
BWAPI::Unit pExpansion = BWAPI::Broodwar->getClosestUnit(BWAPI::Position(hatchPosition), BWAPI::Filter::IsResourceDepot);
BWAPI::Unitset myUnits = pExpansion->getUnitsInRadius(200);
BWAPI::UnitType larva = BWAPI::UnitTypes::Zerg_Larva;
BWAPI::UnitType egg = BWAPI::UnitTypes::Zerg_Egg;
std::set<BWAPI::TilePosition> stuffBlocking;
for (BWAPI::Unit p : myUnits)
{
if (p->getType() == larva || p->getType() == egg)
{
stuffBlocking.insert(p->getTilePosition());
}
}
while (buildableSunkenTilePositions.size() >= 1)
{
std::set<BWAPI::TilePosition>::iterator it = buildableSunkenTilePositions.begin();
BWAPI::TilePosition mySunkPosition = *it;
Building z(sunk, mySunkPosition);
if (!isCreepStarted())
{
if (BWAPI::Broodwar->hasCreep(mySunkPosition) && createdBuilding.find(mySunkPosition) == createdBuilding.end() && stuffBlocking.find(mySunkPosition) == stuffBlocking.end())
{
return *it;
}
else
{
buildableSunkenTilePositions.erase(*it);
}
}
else
{
if (BWAPI::Broodwar->hasCreep(mySunkPosition) && BuildingPlacer::Instance().canBuildHere(mySunkPosition, z) && createdBuilding.find(mySunkPosition) == createdBuilding.end() && stuffBlocking.find(mySunkPosition) == stuffBlocking.end())
{
return *it;
}
else
{
buildableSunkenTilePositions.erase(*it);
}
}
}
//BWAPI::Position hatchPositionBWP = BWAPI::Position(hatchPosition);
BWAPI::TilePosition sunkPosition;
const std::set<BWTA::BaseLocation*, std::less<BWTA::BaseLocation*>> locations = BWTA::getBaseLocations();
BWTA::BaseLocation *myLocation;
for (BWTA::BaseLocation *p : locations) {
BWAPI::TilePosition z = p->getTilePosition();
if (z == hatchPosition){
// This is the BWTA::Location of the first hatchery.
myLocation = p;
}
}
// Get the set of mineral patches closest to BWTA::Location of the hatchery(it will return like 8 mineral patches usually in the set)
const BWAPI::Unitset mineralSet = myLocation->getMinerals();
//const std::set<BWAPI::Unit*> mineralSet = myLocation->getMinerals();
int counter3 = 0;
int theX = 0;
int theY = 0;
for (BWAPI::Unit p : mineralSet)
{
// Calculate the difference between LeftMostMineralPatch.x - ExpansionHatchery.x and store it in theX
theX = p->getTilePosition().x - hatchPosition.x;
// Calculate the difference between LeftMostMineralPatch.y - ExpansionHatchery.y and store it in theY
theY = p->getTilePosition().y - hatchPosition.y;
break;
}
int gasX = 0;
int gasY = 0;
int counter4 = 0;
//Get all geysers near the expansion -- it should only return 1 for every map we play..
const BWAPI::Unitset gasSet = myLocation->getGeysers();
for (BWAPI::Unit p : gasSet)
{
// Calculate the difference between Geyser.x- ExpansionHatchery.x and store it in gasX
gasX = p->getTilePosition().x - hatchPosition.x;
//.........这里部分代码省略.........
示例7: getBuildingLocation
BWAPI::TilePosition BuildingManager::getBuildingLocation(const Building & b)
{
int numPylons = BWAPI::Broodwar->self()->completedUnitCount(BWAPI::UnitTypes::Protoss_Pylon);
if (b.isGasSteal)
{
BWTA::BaseLocation * enemyBaseLocation = InformationManager::Instance().getMainBaseLocation(BWAPI::Broodwar->enemy());
UAB_ASSERT(enemyBaseLocation,"Should have enemy base location before attempting gas steal");
UAB_ASSERT(enemyBaseLocation->getGeysers().size() > 0,"Should have spotted an enemy geyser");
for (auto & unit : enemyBaseLocation->getGeysers())
{
BWAPI::TilePosition tp(unit->getInitialTilePosition());
return tp;
}
}
if (b.type.requiresPsi() && numPylons == 0)
{
return BWAPI::TilePositions::None;
}
if (b.type.isRefinery())
{
return BuildingPlacer::Instance().getRefineryPosition();
}
if (b.type.isResourceDepot())
{
// get the location
// Make every other base for zerg a macro hatch.
bool is_macro = false;
if (BWAPI::Broodwar->self()->getRace() == BWAPI::Races::Zerg) {
int num_mains = UnitUtil::GetAllUnitCount(BWAPI::UnitTypes::Zerg_Hatchery) + UnitUtil::GetAllUnitCount(BWAPI::UnitTypes::Zerg_Lair) + UnitUtil::GetAllUnitCount(BWAPI::UnitTypes::Zerg_Hive);
if (num_mains % 2 == 1)
is_macro = true;
}
if (!is_macro || Config::Strategy::StrategyName == "GreedyHydras") {
BWAPI::TilePosition tile = MapTools::Instance().getNextExpansion();
return tile;
}
}
if (b.type == BWAPI::UnitTypes::Zerg_Creep_Colony) {
// Half way between start and choke.
BWAPI::TilePosition startLocation = BWAPI::Broodwar->self()->getStartLocation();
BWAPI::TilePosition chokeLocation = BWAPI::TilePosition(BWTA::getNearestChokepoint(startLocation)->getCenter());
// IS THIS HOW I AVERAGE POINTS? HAHA, LET'S SEE.
return BWAPI::Broodwar->getBuildLocation(b.type, chokeLocation, 64, true);
}
// set the building padding specifically
int distance = b.type == BWAPI::UnitTypes::Protoss_Photon_Cannon ? 0 : Config::Macro::BuildingSpacing;
if (b.type == BWAPI::UnitTypes::Protoss_Pylon && (numPylons < 3))
{
distance = Config::Macro::PylonSpacing;
}
// get a position within our region
return BuildingPlacer::Instance().getBuildLocationNear(b,distance,false);
}