TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
Represents a unit in the game. More...
#include <unitsinfo.h>
Public Member Functions | |
Unit () | |
bool | flag (tc::Unit::Flags n) const |
bool | attacking () const |
bool | burrowed () const |
bool | cloaked () const |
bool | idle () const |
bool | completed () const |
bool | detected () const |
bool | morphing () const |
bool | beingGathered () const |
bool | active () const |
bool | powered () const |
bool | lifted () const |
bool | carryingMinerals () const |
bool | carryingGas () const |
bool | carryingResources () const |
bool | moving () const |
bool | upgrading () const |
bool | researching () const |
bool | blind () const |
bool | beingConstructed () const |
bool | flying () const |
bool | invincible () const |
bool | irradiated () const |
bool | plagued () const |
bool | underDarkSwarm () const |
bool | gatheringGas () const |
bool | gatheringMinerals () const |
bool | gathering () const |
bool | constructing () const |
bool | repairing () const |
bool | stimmed () const |
bool | ensnared () const |
double | atTopSpeed () const |
bool | canKite (Unit const *dest) const |
bool | canAttack (Unit const *dest) const |
double | cd () const |
double | maxCdAir () const |
double | maxCdGround () const |
Vec2 | velocity () const |
Vec2 | pxVelocity () const |
double | pxTopSpeed () const |
double | maxCdAgainst (Unit const *target) const |
double | rangeAgainst (Unit const *target) const |
double | pxRangeAgainst (Unit const *target) const |
Position | pos () const |
Vec2 | posf () const |
bool | inRangeOf (Unit const *source, double frames=0U) const |
void | computeDamageTo (Unit const *dest, int *hpDamage, int *shieldDamage) const |
Compute HP and shield damage to dest when attacking now. More... | |
void | computeDamageTo (Unit const *dest, int *hpDamage, int *shieldDamage, int destShield) const |
Compute HP and shield damage to dest when attacking now and dest has destShield shield points left. More... | |
double | computeEHP (Unit const *dest) const |
double | computeHPDamage (Unit const *dest, double dmg) const |
double | computeHPDamage (Unit const *dest) const |
double | computeShieldDamage (Unit const *dest, double dmg) const |
double | computeShieldDamage (Unit const *dest) const |
Position | getMovingTarget () const |
double | damageMultiplier (Unit const *dest) const |
double | damageMultiplier (int damageType, int unitSize) const |
Public Attributes | |
UnitId | id = -1 |
int | x = 0 |
int | y = 0 |
PlayerId | playerId = -1 |
bool | visible = false |
This unit is currently visible. More... | |
bool | dead = false |
We've seen this unit die. More... | |
bool | gone = false |
If the unit is not visible, but we've scouted the last location it was at, and we don't have a better clue about where it is, then this is set to true. More... | |
FrameNum | firstSeen = 0 |
FrameNum | lastSeen = 0 |
FrameNum | goneFrame = 0 |
FrameNum | lastLarvaSpawn = 0 |
bool | isMine = false |
bool | isEnemy = false |
bool | isNeutral = false |
const BuildType * | type = nullptr |
FrameNum | busyUntil = 0 |
int | buildX = 0 |
X coordinate of the walktile the build location (top left corner) of the unit. More... | |
int | buildY = 0 |
Y coordinate of the walktile the build location (top left corner) of the unit. More... | |
const BuildType * | constructingType = nullptr |
const BuildType * | upgradingType = nullptr |
const BuildType * | researchingType = nullptr |
int | remainingBuildTrainTime = 0 |
int | remainingUpgradeResearchTime = 0 |
Unit * | associatedUnit = nullptr |
int | associatedCount = 0 |
Unit * | addon = nullptr |
int | sightRange = 0 |
Unit * | attackingTarget = nullptr |
int | lastAttacked = 0 |
double | topSpeed = 0 |
bool | hasCollision = true |
Position | lastSeenPos |
std::unordered_set< Unit * > | inferNearbyUnitsToMove |
tc::Unit | unit = {} |
A copy of the torchcraft unit data. More... | |
UpcId | lastUpcId = kInvalidUpcId |
The last UPC that was used to send a TC command involving this unit. More... | |
uint32_t | lastUpcCommands = Command::None |
Bitwise combination of last UPC command and all its sources. More... | |
std::vector< Unit * > | threateningEnemies |
std::vector< Unit * > | beingAttackedByEnemies |
std::vector< Unit * > | unitsInSightRange |
std::vector< Unit * > | obstaclesInSightRange |
std::vector< Unit * > | enemyUnitsInSightRange |
std::vector< Unit * > | allyUnitsInSightRange |
std::array< size_t, 16 > | containerIndices |
Static Public Attributes | |
static float constexpr | kLastUpcCommandThreshold = 0.5f |
Commands with a probility higher than this will be considered for lastUpcCommands. More... | |
static const size_t | invalidIndex = (size_t)-1 |
Represents a unit in the game.
Unit objects have game lifetime. Thus, you can hold pointers to them.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool cherrypi::Unit::canKite | ( | Unit const * | dest | ) | const |
|
inline |
|
inline |
|
inline |
double cherrypi::Unit::cd | ( | ) | const |
|
inline |
|
inline |
void cherrypi::Unit::computeDamageTo | ( | Unit const * | dest, |
int * | hpDamage, | ||
int * | shieldDamage | ||
) | const |
Compute HP and shield damage to dest when attacking now.
void cherrypi::Unit::computeDamageTo | ( | Unit const * | dest, |
int * | hpDamage, | ||
int * | shieldDamage, | ||
int | destShield | ||
) | const |
Compute HP and shield damage to dest when attacking now and dest has destShield
shield points left.
double cherrypi::Unit::computeEHP | ( | Unit const * | dest | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
double cherrypi::Unit::damageMultiplier | ( | Unit const * | dest | ) | const |
double cherrypi::Unit::damageMultiplier | ( | int | damageType, |
int | unitSize | ||
) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Position cherrypi::Unit::getMovingTarget | ( | ) | const |
|
inline |
bool cherrypi::Unit::inRangeOf | ( | Unit const * | source, |
double | frames = 0U |
||
) | const |
|
inline |
|
inline |
|
inline |
double cherrypi::Unit::maxCdAgainst | ( | Unit const * | target | ) | const |
double cherrypi::Unit::maxCdAir | ( | ) | const |
double cherrypi::Unit::maxCdGround | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
Vec2 cherrypi::Unit::posf | ( | ) | const |
|
inline |
double cherrypi::Unit::pxRangeAgainst | ( | Unit const * | target | ) | const |
double cherrypi::Unit::pxTopSpeed | ( | ) | const |
Vec2 cherrypi::Unit::pxVelocity | ( | ) | const |
double cherrypi::Unit::rangeAgainst | ( | Unit const * | target | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Vec2 cherrypi::Unit::velocity | ( | ) | const |
Unit* cherrypi::Unit::addon = nullptr |
std::vector<Unit*> cherrypi::Unit::allyUnitsInSightRange |
int cherrypi::Unit::associatedCount = 0 |
Unit* cherrypi::Unit::associatedUnit = nullptr |
Unit* cherrypi::Unit::attackingTarget = nullptr |
std::vector<Unit*> cherrypi::Unit::beingAttackedByEnemies |
int cherrypi::Unit::buildX = 0 |
X coordinate of the walktile the build location (top left corner) of the unit.
int cherrypi::Unit::buildY = 0 |
Y coordinate of the walktile the build location (top left corner) of the unit.
FrameNum cherrypi::Unit::busyUntil = 0 |
const BuildType* cherrypi::Unit::constructingType = nullptr |
std::array<size_t, 16> cherrypi::Unit::containerIndices |
bool cherrypi::Unit::dead = false |
We've seen this unit die.
std::vector<Unit*> cherrypi::Unit::enemyUnitsInSightRange |
FrameNum cherrypi::Unit::firstSeen = 0 |
bool cherrypi::Unit::gone = false |
If the unit is not visible, but we've scouted the last location it was at, and we don't have a better clue about where it is, then this is set to true.
The unit might still be in the game, or it might be dead.
FrameNum cherrypi::Unit::goneFrame = 0 |
bool cherrypi::Unit::hasCollision = true |
UnitId cherrypi::Unit::id = -1 |
std::unordered_set<Unit*> cherrypi::Unit::inferNearbyUnitsToMove |
|
static |
bool cherrypi::Unit::isEnemy = false |
bool cherrypi::Unit::isMine = false |
bool cherrypi::Unit::isNeutral = false |
|
static |
Commands with a probility higher than this will be considered for lastUpcCommands.
int cherrypi::Unit::lastAttacked = 0 |
FrameNum cherrypi::Unit::lastLarvaSpawn = 0 |
FrameNum cherrypi::Unit::lastSeen = 0 |
Position cherrypi::Unit::lastSeenPos |
uint32_t cherrypi::Unit::lastUpcCommands = Command::None |
Bitwise combination of last UPC command and all its sources.
UpcId cherrypi::Unit::lastUpcId = kInvalidUpcId |
The last UPC that was used to send a TC command involving this unit.
std::vector<Unit*> cherrypi::Unit::obstaclesInSightRange |
PlayerId cherrypi::Unit::playerId = -1 |
int cherrypi::Unit::remainingBuildTrainTime = 0 |
int cherrypi::Unit::remainingUpgradeResearchTime = 0 |
const BuildType* cherrypi::Unit::researchingType = nullptr |
int cherrypi::Unit::sightRange = 0 |
std::vector<Unit*> cherrypi::Unit::threateningEnemies |
double cherrypi::Unit::topSpeed = 0 |
const BuildType* cherrypi::Unit::type = nullptr |
tc::Unit cherrypi::Unit::unit = {} |
A copy of the torchcraft unit data.
std::vector<Unit*> cherrypi::Unit::unitsInSightRange |
const BuildType* cherrypi::Unit::upgradingType = nullptr |
bool cherrypi::Unit::visible = false |
This unit is currently visible.
If this field is set, all other fields are up-to-date, otherwise everything is from when we last saw it.
int cherrypi::Unit::x = 0 |
int cherrypi::Unit::y = 0 |