BWAPI
|
#include <UnitType.h>
Public Member Functions | |
UnitType () | |
UnitType (int id) | |
UnitType (const UnitType &other) | |
UnitType & | operator= (const UnitType &other) |
operator int () const | |
int | getID () const |
std::string | getName () const |
Race | getRace () const |
const std::pair< UnitType, int > | whatBuilds () const |
const std::map< UnitType, int > & | requiredUnits () const |
TechType | requiredTech () const |
TechType | cloakingTech () const |
const std::set< TechType > & | abilities () const |
const std::set< UpgradeType > & | upgrades () const |
UpgradeType | armorUpgrade () const |
int | maxHitPoints () const |
int | maxShields () const |
int | maxEnergy () const |
int | armor () const |
int | mineralPrice () const |
int | gasPrice () const |
int | buildTime () const |
int | supplyRequired () const |
int | supplyProvided () const |
int | spaceRequired () const |
int | spaceProvided () const |
int | buildScore () const |
int | destroyScore () const |
UnitSizeType | size () const |
int | tileWidth () const |
int | tileHeight () const |
int | dimensionLeft () const |
int | dimensionUp () const |
int | dimensionRight () const |
int | dimensionDown () const |
int | seekRange () const |
int | sightRange () const |
WeaponType | groundWeapon () const |
int | maxGroundHits () const |
WeaponType | airWeapon () const |
int | maxAirHits () const |
double | topSpeed () const |
int | acceleration () const |
int | haltDistance () const |
int | turnRadius () const |
bool | canProduce () const |
bool | canAttack () const |
bool | canMove () const |
bool | isFlyer () const |
bool | regeneratesHP () const |
bool | isSpellcaster () const |
bool | hasPermanentCloak () const |
bool | isInvincible () const |
bool | isOrganic () const |
bool | isMechanical () const |
bool | isRobotic () const |
bool | isDetector () const |
bool | isResourceContainer () const |
bool | isResourceDepot () const |
bool | isRefinery () const |
bool | isWorker () const |
bool | requiresPsi () const |
bool | requiresCreep () const |
bool | isTwoUnitsInOneEgg () const |
bool | isBurrowable () const |
bool | isCloakable () const |
bool | isBuilding () const |
bool | isAddon () const |
bool | isFlyingBuilding () const |
bool | isNeutral () const |
bool | isHero () const |
bool | isPowerup () const |
bool | isBeacon () const |
bool | isFlagBeacon () const |
bool | isSpecialBuilding () const |
bool | isSpell () const |
bool | producesLarva () const |
bool | isMineralField () const |
Private Attributes | |
int | id |
The UnitType class is used to get information about a particular type of unit, such as the build time of a Lurker, or the mineral price of an Ultralisk. TODO Add the unittype table from the wiki
Definition at line 18 of file UnitType.h.
BWAPI::UnitType::UnitType | ( | int | id | ) |
BWAPI::UnitType::UnitType | ( | const UnitType & | other | ) |
const std::set< TechType >& BWAPI::UnitType::abilities | ( | ) | const |
Returns the set of tech types this unit can use, provided the tech types have been researched and the unit has enough energy.
Referenced by MacroManagerClass::onChangeBuild().
int BWAPI::UnitType::acceleration | ( | ) | const |
Returns how fast the unit can accelerate to its top speed. What units this quantity is measured in is currently unknown.
WeaponType BWAPI::UnitType::airWeapon | ( | ) | const |
Returns the unit's air weapon.
Referenced by UnitClass::canAttackAir(), UnitClass::getWeapon(), UnitClass::getWeaponCooldown(), and UnitClass::getWeaponMinRange().
int BWAPI::UnitType::armor | ( | ) | const |
Returns the amount of armor the non-upgraded unit type has.
UpgradeType BWAPI::UnitType::armorUpgrade | ( | ) | const |
Returns the upgrade that increase's the unit's armor, or UpgradeTypes::None if no upgrade increase's this unit's armor. For example UnitTypes::Terran_Marine.armorUpgrade() will return a pointer to UpgradeTypes::Terran_Infantry_Armor.
int BWAPI::UnitType::buildScore | ( | ) | const |
Returns the score which is used to determine the total scores in the after-game stats screen.
int BWAPI::UnitType::buildTime | ( | ) | const |
Returns the number of frames needed to make this unit type.
Referenced by UnitClass::drawUnitPosition(), UnitClass::getCompletedTime(), MorphTask::getEndTime(), TrainTask::getEndTime(), ConstructionTask::getEndTime(), UnitClass::setBuildTime(), UnitClass::UnitClass(), SupplyManagerClass::update(), UnitClass::update(), TrainTask::updateRequirements(), MorphTask::updateRequirements(), and ConstructionTask::updateRequirements().
bool BWAPI::UnitType::canAttack | ( | ) | const |
Returns true if the unit can attack (either ground or air). Returns false for units that can only inflict damage via special abilities (such as Protoss High Templar).
bool BWAPI::UnitType::canMove | ( | ) | const |
Returns true if the unit can move. Note that buildings will return false, even Terran buildings which can move once lifted.
Referenced by UnitClass::accessibility(), and UnitClass::getTargetPosition().
bool BWAPI::UnitType::canProduce | ( | ) | const |
Returns true if the unit can train other units. For example, UnitTypes::Terran_Barracks.canProduce() will return true, while UnitTypes::Terran_Marine?.canProduce() will return false. This is also true for two non-building units: Protoss Carrier (can produce interceptors) and Protoss Reaver (can produce scarabs).
TechType BWAPI::UnitType::cloakingTech | ( | ) | const |
Returns the tech used to cloak the unit, or TechTypes::None if the unit cannot cloak or is permanently cloaked
int BWAPI::UnitType::destroyScore | ( | ) | const |
Returns the score which is used to determine the total scores in the after-game stats screen.
int BWAPI::UnitType::dimensionDown | ( | ) | const |
Distance from the center of the unit to the bottom edge of the unit, measured in pixels.
Referenced by UnitClass::drawUnitPosition(), UnitHelper::getDistance(), and PossibleLocationCompare::operator()().
int BWAPI::UnitType::dimensionLeft | ( | ) | const |
Distance from the center of the unit to the left edge of the unit, measured in pixels.
Referenced by UnitClass::drawUnitPosition(), UnitHelper::getDistance(), and PossibleLocationCompare::operator()().
int BWAPI::UnitType::dimensionRight | ( | ) | const |
Distance from the center of the unit to the right edge of the unit, measured in pixels.
Referenced by UnitClass::drawUnitPosition(), UnitHelper::getDistance(), and PossibleLocationCompare::operator()().
int BWAPI::UnitType::dimensionUp | ( | ) | const |
Distance from the center of the unit to the top edge of the unit, measured in pixels.
Referenced by UnitClass::drawUnitPosition(), UnitHelper::getDistance(), and PossibleLocationCompare::operator()().
int BWAPI::UnitType::gasPrice | ( | ) | const |
UnitTypes::Siege_Tank_Tank_Mode.gasPrice() returns 100.
Referenced by MorphTask::freeResources(), TrainTask::freeResources(), ConstructionTask::freeResources(), MacroManagerClass::onChangeBuild(), MorphTask::reserveResources(), TrainTask::reserveResources(), ConstructionTask::reserveResources(), TrainTask::updateRequirements(), MorphTask::updateRequirements(), and ConstructionTask::updateRequirements().
int BWAPI::UnitType::getID | ( | ) | const |
Returns a unique ID for this unit type.
std::string BWAPI::UnitType::getName | ( | ) | const |
Returns the name of the unit.
Referenced by ConstructionTask::freeLocation(), ConstructionTask::freeResources(), MacroItem::getDebugInfo(), MorphTask::getOutputName(), TrainTask::getOutputName(), ConstructionTask::getOutputName(), ConstructionTask::giveUnit(), UnitTrackerClass::onMorphRenegade(), ConstructionTask::reserveLocation(), ConstructionTask::reserveResources(), ConstructionTask::returnUnit(), ConstructionTask::setRequiredSatisfyTime(), and ConstructionTask::update().
Race BWAPI::UnitType::getRace | ( | ) | const |
Returns the race that the unit belongs to. For example UnitTypes::Terran_SCV.getRace() will return Races::Terran.
Referenced by TaskManagerClass::build(), ConstructionTask::finishedWithBuilder(), ConstructionTask::getEndTime(), BuildingPlacerClass::isTileBuildable(), ConstructionTask::preUpdate(), ConstructionTask::update(), and ConstructionTask::updateRequirements().
WeaponType BWAPI::UnitType::groundWeapon | ( | ) | const |
Returns the unit's ground weapon.
Referenced by UnitClass::canAttackGround(), UnitClass::getWeapon(), UnitClass::getWeaponCooldown(), and UnitClass::getWeaponMinRange().
int BWAPI::UnitType::haltDistance | ( | ) | const |
Related to how fast the unit can halt. What units this quantity is measured in is currently unknown.
bool BWAPI::UnitType::hasPermanentCloak | ( | ) | const |
Returns true for the two units that are permanently cloaked - Protoss Observer and Protoss Dark Templar.
Referenced by DetectorAction::update().
bool BWAPI::UnitType::isAddon | ( | ) | const |
Returns true if the unit is an add-on, such as a Terran Comsat Station.
Referenced by TaskManagerClass::build(), and DefaultSquadTask::updateRequirements().
bool BWAPI::UnitType::isBeacon | ( | ) | const |
Returns true if the unit is a regular Beacon.
bool BWAPI::UnitType::isBuilding | ( | ) | const |
Returns true if the unit is a building (also true for mineral field and vespene geyser).
Referenced by BaseClass::addUnit(), TaskManagerClass::build(), UnitHelper::isArmyUnit(), PsiStormAction::update(), ArbiterAction::update(), DetectorAction::update(), PlayerTrackerClass::update(), and DefaultSquadTask::updateRequirements().
bool BWAPI::UnitType::isBurrowable | ( | ) | const |
Returns true for Zerg Lurker and units that can burrow when burrow tech is researched.
bool BWAPI::UnitType::isCloakable | ( | ) | const |
Returns true for units that can be cloaked - Terran Ghost and Terran Wraith. Does not include units which have permanent cloak (Protoss Observer and Protoss Dark Templar).
bool BWAPI::UnitType::isDetector | ( | ) | const |
Returns true for the seven units that can detect cloaked units - Terran Science Vessel, Spell Scanner Sweep, Zerg Overlord, Protoss Observer, Terran Missile Turret, Zerg Spore Colony, and Protoss Photon Cannon.
Referenced by Behaviour::createDefaultActions().
bool BWAPI::UnitType::isFlagBeacon | ( | ) | const |
Returns true if the unit is a flag Beacon.
bool BWAPI::UnitType::isFlyer | ( | ) | const |
Returns true for flying/air units.
Referenced by UnitHelper::unitProducesGround().
bool BWAPI::UnitType::isFlyingBuilding | ( | ) | const |
Returns true for Terran buildings that can lift off (i.e. Barracks).
Referenced by UnitClass::accessibility(), UnitClass::getTargetPosition(), UnitClass::isLifted(), and UnitClass::update().
bool BWAPI::UnitType::isHero | ( | ) | const |
Returns true if the unit is a Hero unit.
bool BWAPI::UnitType::isInvincible | ( | ) | const |
Returns true for units that cannot be destroyed (i.e. Terran Nuclear Missile, Mineral Field, Vespene Geyser, etc)
bool BWAPI::UnitType::isMechanical | ( | ) | const |
Returns true if the unit is mechanical such as a Terran Vulture.
bool BWAPI::UnitType::isMineralField | ( | ) | const |
Returns true if the unit is one of the three mineral field types.
bool BWAPI::UnitType::isNeutral | ( | ) | const |
Returns true if the unit is neutral, such as a critter or mineral field.
bool BWAPI::UnitType::isOrganic | ( | ) | const |
Returns true if the unit is organic, such as a Terran Marine.
bool BWAPI::UnitType::isPowerup | ( | ) | const |
Returns true if the unit is a Powerup unit.
bool BWAPI::UnitType::isRefinery | ( | ) | const |
Returns true for Terran Refinery, Zerg Extractor, and Protoss Assimilator.
Referenced by BaseClass::addUnit(), BuildingPlacerClass::buildingLocationToTile(), BuildingPlacerClass::isLocationBuildable(), BaseClass::removeUnit(), and ConstructionTask::waitingForUnit().
bool BWAPI::UnitType::isResourceContainer | ( | ) | const |
Returns true for the five units that hold resources - Mineral Field, Vespene Geyser, Terran Refinery, Zerg Extractor, and Protoss Assimilator.
bool BWAPI::UnitType::isResourceDepot | ( | ) | const |
Returns true for the five units that can accept resources - Terran Command Center, Protoss Nexus, Zerg Hatchery, Zerg Lair, and Zerg Hive.
Referenced by BaseClass::addUnit(), BuildingPlacerClass::isLocationBuildable(), BuildingPlacerClass::isTileBuildable(), and BaseClass::removeUnit().
bool BWAPI::UnitType::isRobotic | ( | ) | const |
Returns true for the four robotic Protoss units - Probe, Shuttle, Reaver, and Observer.
bool BWAPI::UnitType::isSpecialBuilding | ( | ) | const |
Returns true if the unit is a special building.
bool BWAPI::UnitType::isSpell | ( | ) | const |
Returns true if the unit is a spell unit.
Referenced by UnitHelper::isArmyUnit().
bool BWAPI::UnitType::isSpellcaster | ( | ) | const |
Returns true if the unit type is capable of casting spells / using technology.
bool BWAPI::UnitType::isTwoUnitsInOneEgg | ( | ) | const |
Returns true for Zergling and Scourge.
bool BWAPI::UnitType::isWorker | ( | ) | const |
Returns true for Protoss Probe, Terran SCV, and Zerg Drone.
Referenced by UnitHelper::isArmyUnit(), BasicUnitAction::update(), PlayerTrackerClass::update(), BaseClass::update(), and DefaultSquadTask::updateRequirements().
int BWAPI::UnitType::maxAirHits | ( | ) | const |
int BWAPI::UnitType::maxEnergy | ( | ) | const |
Returns the maximum amount of energy the unit type can have.
int BWAPI::UnitType::maxGroundHits | ( | ) | const |
int BWAPI::UnitType::maxHitPoints | ( | ) | const |
Returns the maximum amount of hit points the unit type can have.
Referenced by UnitClass::drawUnitPosition().
int BWAPI::UnitType::maxShields | ( | ) | const |
Returns the maximum amount of shields the unit type can have.
Referenced by UnitClass::drawUnitPosition().
int BWAPI::UnitType::mineralPrice | ( | ) | const |
Returns the mineral price of the unit.
Example: UnitTypes::Siege_Tank_Tank_Mode.mineralPrice() returns 150.
Referenced by MorphTask::freeResources(), TrainTask::freeResources(), ConstructionTask::freeResources(), MacroManagerClass::onChangeBuild(), MorphTask::reserveResources(), TrainTask::reserveResources(), ConstructionTask::reserveResources(), TrainScarabAction::update(), MorphTask::updateRequirements(), TrainTask::updateRequirements(), and ConstructionTask::updateRequirements().
BWAPI::UnitType::operator int | ( | ) | const |
bool BWAPI::UnitType::producesLarva | ( | ) | const |
Returns true if the unit produces larva.
bool BWAPI::UnitType::regeneratesHP | ( | ) | const |
Returns true for units that regenerate health (i.e. zerg units).
TechType BWAPI::UnitType::requiredTech | ( | ) | const |
Included in the API for completeness, since the only units that actually needs tech to be trained are the Zerg_Lurker and Zerg_Lurker_Egg. The tech type needed is TechTypes::Lurker_Aspect.
const std::map< UnitType, int >& BWAPI::UnitType::requiredUnits | ( | ) | const |
Returns the units the player is required to have before it can train or build the given unit type.
Example: UnitTypes::Terran_Battlecruiser.requiredUnits() will return a map of three keys: UnitTypes::Terran_Starport, UnitTypes::Terran_Control_Tower, and UnitTypes::Terran_Physics_Lab.
Referenced by MacroManagerClass::addNeeded(), Requirement::earliestTime(), MacroManagerClass::getNeededUnits(), and MacroManagerClass::hasRequirements().
bool BWAPI::UnitType::requiresCreep | ( | ) | const |
Returns true for buildings that can only be built on zerg creep.
bool BWAPI::UnitType::requiresPsi | ( | ) | const |
Returns true for buildings that must be near a pylon to be constructed.
Referenced by BuildingPlacerClass::baseToBuildAtOrder(), BuildingPlacerClass::buildingLocationToTile(), BuildingPlacerClass::isLocationBuildable(), and ExpansionManagerClass::updateDefense().
int BWAPI::UnitType::seekRange | ( | ) | const |
Returns the range at which the unit will start targeting enemy units, measured in pixels.
Referenced by BasicUnitAction::update().
int BWAPI::UnitType::sightRange | ( | ) | const |
Returns how far the un-upgraded unit type can see into the fog of war, measured in pixels.
UnitSizeType BWAPI::UnitType::size | ( | ) | const |
Returns the size of the unit - either Small, Medium, Large, or Independent.
int BWAPI::UnitType::spaceProvided | ( | ) | const |
Returns the amount of space this unit type provides.
int BWAPI::UnitType::spaceRequired | ( | ) | const |
Returns the amount of space this unit type takes up inside a bunker or transport unit.
Referenced by DropAction::getRequestedUnits().
int BWAPI::UnitType::supplyProvided | ( | ) | const |
Returns the amount of supply produced by this unit (i.e. for a Protoss_Pylon). Supply counts returned by BWAPI are double what you would expect to see from playing the game. This is because zerglings take up 0.5 in-game supply.
Referenced by BaseClass::addUnit(), BaseClass::removeUnit(), and BasicUnitAction::update().
int BWAPI::UnitType::supplyRequired | ( | ) | const |
Returns the amount of supply used by this unit. Supply counts returned by BWAPI are double what you would expect to see from playing the game. This is because zerglings take up 0.5 in-game supply.
Referenced by MorphTask::freeResources(), TrainTask::freeResources(), ConstructionTask::freeResources(), MorphTask::reserveResources(), TrainTask::reserveResources(), ConstructionTask::reserveResources(), TrainTask::updateRequirements(), MorphTask::updateRequirements(), and ConstructionTask::updateRequirements().
int BWAPI::UnitType::tileHeight | ( | ) | const |
Returns the tile height of the unit. Useful for determining the size of buildings. For example UnitTypes::Terran_Supply_Depot.tileHeight() will return 2.
Referenced by UnitClass::build(), UnitClass::drawUnitTilePosition(), BuildingPlacerClass::getSurroundingTiles(), UnitClass::getTilePosition(), PylonPowerTrackerClass::hasPower(), MapHelper::isAllVisible(), MapHelper::isAnyVisible(), BuildingPlacerClass::isLocationBuildable(), PossibleLocationCompare::operator()(), ReservedLocationClass::setTilePosition(), and UnitHelper::tileToPosition().
int BWAPI::UnitType::tileWidth | ( | ) | const |
Returns the tile width of the unit. Useful for determining the size of buildings. For example UnitTypes::Terran_Supply_Depot.tileWidth() will return 3.
Referenced by UnitClass::build(), UnitClass::drawUnitTilePosition(), BuildingPlacerClass::getSurroundingTiles(), UnitClass::getTilePosition(), PylonPowerTrackerClass::hasPower(), MapHelper::isAllVisible(), MapHelper::isAnyVisible(), BuildingPlacerClass::isLocationBuildable(), PossibleLocationCompare::operator()(), ReservedLocationClass::setTilePosition(), and UnitHelper::tileToPosition().
double BWAPI::UnitType::topSpeed | ( | ) | const |
Returns the unit's non-upgraded top speed in pixels per frame. For Terran buildings that can lift off and the Zerg Infested Command Center, this returns how fast the building moves when it is lifted.
Referenced by UnitClass::getPosition(), and BasicUnitAction::update().
int BWAPI::UnitType::turnRadius | ( | ) | const |
Related to how fast the unit can turn. What units this quantity is measured in is currently unknown.
const std::set< UpgradeType >& BWAPI::UnitType::upgrades | ( | ) | const |
Returns the set of upgrade types that can affect this unit.
Referenced by MacroManagerClass::onChangeBuild().
const std::pair< UnitType, int > BWAPI::UnitType::whatBuilds | ( | ) | const |
Returns what builds this unit type. The second number will usually be 1 unless the unit type is Protoss_Archon or Protoss_Dark_Archon. Units that cannot be created, such as critters and mineral fields, will return a pair where the unit type is UnitTypes::None, and the second component is 0.
Example: UnitTypes::Terran_Marine.whatBuilds() will return an std::pair, where the first component is UnitTypes::Terran_Barracks.
Referenced by MacroManagerClass::addNeeded(), TaskManagerClass::build(), MacroManagerClass::getNeededUnits(), MorphTask::giveUnit(), TrainTask::giveUnit(), ConstructionTask::giveUnit(), MacroManagerClass::hasRequirements(), MacroManagerClass::onBuildTask(), UnitHelper::unitProducesGround(), MacroManagerClass::updateProductionProduction(), MorphTask::updateRequirements(), TrainTask::updateRequirements(), ConstructionTask::updateRequirements(), and MacroManagerClass::updateUnitProduction().
int BWAPI::UnitType::id [private] |
Definition at line 285 of file UnitType.h.