|
UnitType
Class header file: BWAPI/UnitType.h 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. Table of all UnitTypes (along with some stat info obtained via BWAPI).
MethodsgetIDint getID() const; Returns a unique ID for this unit type. getNamestd::string getName() const; Returns the name of the unit. getRaceRace getRace() const; Returns the race that the unit belongs to. For example UnitTypes::Terran_SCV.getRace() will return Races::Terran. whatBuildsconst std::pair< UnitType, int > 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. requiredUnitsconst std::map< UnitType, int > requiredUnits() const; Returns the units the player is required to have before it can train or build the given unit type. In addition to having the required units, the player must also have sufficient minerals, gas, and the requiredTech (if any). Example: UnitTypes::Terran_Battlecruiser.requiredUnits() will return a map of three keys: UnitTypes::Terran_Starport, UnitTypes::Terran_Control_Tower, and UnitTypes::Terran_Physics_Lab. requiredTechTechType 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. cloakingTechTechType cloakingTech() const; Returns the Tech type used for cloaking the unit, or TechTypes::None if the unit does not have the cloak ability or is permanently cloaked. abilitiesconst std::set< TechType >& 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. upgradesconst std::set< UpgradeType >& upgrades() const; Returns the set of upgrade types that can affect this unit. armorUpgradeUpgradeType 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. maxHitPointsint maxHitPoints() const; Returns the maximum amount of hit points the unit type can have. maxShieldsint maxShields() const; Returns the maximum amount of shields the unit type can have. maxEnergyint maxEnergy() const; Returns the maximum amount of energy the unit type can have. armorint armor() const; Returns the amount of armor the non-upgraded unit type has. mineralPriceint mineralPrice() const; Returns the mineral price of the unit. Example: UnitTypes::Siege_Tank_Tank_Mode.mineralPrice() returns 150. gasPriceint gasPrice() const; Returns the gas price of the unit. Example: UnitTypes::Siege_Tank_Tank_Mode.gasPrice() returns 100. buildTimeint buildTime() const; Returns the number of frames needed to make this unit type. supplyRequiredint 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. supplyProvidedint 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. spaceRequiredint spaceRequired() const; Returns the amount of space this unit type takes up inside a bunker or transport unit. spaceProvidedint spaceProvided() const; Returns the amount of space this unit type provides. buildScoreint buildScore() const; Returns the score which is used to determine the total scores in the after-game stats screen. destroyScoreint destroyScore() const; Returns the score which is used to determine the total scores in the after-game stats screen. sizeUnitSizeType size() const; Returns the size of the unit - either Small, Medium, Large, or Independent. tileWidthint 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. tileHeightint 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. dimensionLeftint dimensionLeft() const; Distance from the center of the unit to the left edge of the unit, measured in pixels. dimensionUpint dimensionUp() const; Distance from the center of the unit to the top edge of the unit, measured in pixels. dimensionRightint dimensionRight() const; Distance from the center of the unit to the right edge of the unit, measured in pixels. dimensionDownint dimensionDown() const; Distance from the center of the unit to the bottom edge of the unit, measured in pixels. seekRangeint seekRange() const; Returns the range at which the unit will start targeting enemy units, measured in pixels. sightRangeint sightRange() const; Returns how far the un-upgraded unit type can see into the fog of war, measured in pixels. groundWeaponWeaponType groundWeapon() const; Returns the unit's ground weapon, or WeaponTypes::None if the unit cannot shoot ground units. maxGroundHitsint maxGroundHits() const; airWeaponWeaponType airWeapon() const; Returns the unit's air weapon, or WeaponTypes::None if the unit cannot shoot air units. maxAirHitsint maxAirHits() const; topSpeeddouble 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. accelerationint acceleration() const; Returns how fast the unit can accelerate to its top speed. What units this quantity is measured in is currently unknown. haltDistanceint haltDistance() const; Related to how fast the unit can halt. What units this quantity is measured in is currently unknown. turnRadiusint turnRadius() const; Related to how fast the unit can turn. What units this quantity is measured in is currently unknown. canBuildAddonbool canBuildAddon() const; Returns true if the unit type is capable of constructing any addon. This includes the Command Center, Factory, Starport, and Science Facility. canProducebool 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). canAttackbool 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). canMovebool canMove() const; Returns true if the unit can move. Note that buildings will return false, even Terran buildings which can move once lifted. isFlyerbool isFlyer() const; Returns true for flying/air units. regeneratesHPbool regeneratesHP() const; Returns true for units that regenerate health (i.e. zerg units). isSpellcasterbool isSpellcaster() const; Returns true if the unit type is capable of casting spells / using technology. hasPermanentCloakbool hasPermanentCloak() const; Returns true for the two units that are permanently cloaked - Protoss Observer and Protoss Dark Templar. isInvinciblebool isInvincible() const; Returns true for units that cannot be destroyed (i.e. Terran Nuclear Missile, Mineral Field, Vespene Geyser, etc) isOrganicbool isOrganic() const; Returns true if the unit is organic, such as a Terran Marine. isMechanicalbool isMechanical() const; Returns true if the unit is mechanical such as a Terran Vulture. isRoboticbool isRobotic() const; Returns true for the four robotic Protoss units - Probe, Shuttle, Reaver, and Observer. isDetectorbool isDetector() const; Returns true if the unit is capable of detecting cloaked units. isResourceContainerbool isResourceContainer() const; Returns true for the seven units that hold resources - Mineral Field (Type 1, Type 2, Type 3), Vespene Geyser, Terran Refinery, Zerg Extractor, and Protoss Assimilator. isResourceDepotbool isResourceDepot() const; Returns true for the six units that can accept resources - Terran Command Center, Protoss Nexus, Zerg Hatchery, Zerg Lair, Zerg Hive, and Start Location. isRefinerybool isRefinery() const; Returns true for Terran Refinery, Zerg Extractor, and Protoss Assimilator. isMineralFieldbool isMineralField() const; Returns true for the three types of Mineral Fields. BWAPI typically interprets all resources as "Type 1", so this may be used in the future. isWorkerbool isWorker() const; Returns true for Protoss Probe, Terran SCV, and Zerg Drone. requiresPsibool requiresPsi() const; Returns true for buildings that must be near a pylon to be constructed. requiresCreepbool requiresCreep() const; Returns true for buildings that can only be built on zerg creep. isTwoUnitsInOneEggbool isTwoUnitsInOneEgg() const; Returns true for Zergling and Scourge. isBurrowablebool isBurrowable() const; Returns true for Zerg Lurker and units that can burrow when burrow tech is researched. isCloakablebool 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). isBuildingbool isBuilding() const; Returns true if the unit is a building (also true for mineral field and vespene geyser). isAddonbool isAddon() const; Returns true if the unit is an add-on, such as a Terran Comsat Station. isFlyingBuildingbool isFlyingBuilding() const; Returns true for Terran buildings that can lift off (i.e. Barracks). isNeutralbool isNeutral() const; Returns true if the unit is neutral, such as a critter or mineral field. isHerobool isHero() const; Returns true if the unit is a Hero unit. Hero units are special units used by the Campaign and Use Map Settings. isPowerupbool isPowerup() const; Returns true if the unit is a powerup. Powerups such as a Flag are used by other game types like Capture the Flag and can be carried by a worker unit. isBeaconbool isBeacon() const; Returns true if the unit is a Zerg, Terran, or Protoss Beacon. Beacons are used in the Campaign and Use Map Settings. isFlagBeaconbool isFlagBeacon() const; Returns true if the unit is a Zerg, Terran, or Protoss Flag Beacon. Flag beacons will create a flag unit for Capture the Flag mode and allow you to relocate the beacon to another location so that you may hide your flag from the enemy. isSpecialBuildingbool isSpecialBuilding() const; Returns true if the unit is a special building such as the Overmind. isSpellbool isSpell() const; Returns true if the unit is either a Scanner Sweep, Disruption Web, or Dark Swarm. Non-Member MethodsgetUnitTypeUnitType getUnitType(std::string name); Given the name of a unit type, this function will return the unit type. For example, UnitTypes::getUnitType("Terran Marine") will return UnitTypes::Terran_Marine. allUnitTypesstd::set<UnitType>& allUnitTypes(); Returns the set of all the UnitTypes. allMacroTypesstd::set<UnitType>& allMacroTypes(); Returns the set of all the macro UnitTypes. | |
I'm quite certain that turnRadius() and acceleration() return the UnitType's turn radius and acceleration (duh) per frame, but multiplied by 256. Similarly, haltDistance() returns the distance a unit travels while it accelerates from zero speed to top speed, but multiplied by 256. It'd be great if you could update the table of UnitTypes to include these values as well.