BWAPI 4.2.0 An API for interacting with Starcraft: Broodwar (1.16.1) |
Public Member Functions | |
virtual int | allUnitCount (UnitType unit=UnitTypes::AllUnits) const =0 |
int | armor (UnitType unit) const |
virtual int | completedUnitCount (UnitType unit=UnitTypes::AllUnits) const =0 |
int | damage (WeaponType wpn) const |
virtual int | deadUnitCount (UnitType unit=UnitTypes::AllUnits) const =0 |
virtual int | gas () const =0 |
virtual int | gatheredGas () const =0 |
virtual int | gatheredMinerals () const =0 |
virtual int | getBuildingScore () const =0 |
virtual BWAPI::Color | getColor () const =0 |
virtual int | getCustomScore () const =0 |
virtual Force | getForce () const =0 |
virtual int | getID () const =0 |
virtual int | getKillScore () const =0 |
virtual int | getMaxUpgradeLevel (UpgradeType upgrade) const =0 |
virtual std::string | getName () const =0 |
virtual Race | getRace () const =0 |
virtual int | getRazingScore () const =0 |
virtual TilePosition | getStartLocation () const =0 |
char | getTextColor () const |
virtual PlayerType | getType () const =0 |
virtual const Unitset & | getUnits () const =0 |
virtual int | getUnitScore () const =0 |
virtual int | getUpgradeLevel (UpgradeType upgrade) const =0 |
virtual bool | hasResearched (TechType tech) const =0 |
bool | hasUnitTypeRequirement (UnitType unit, int amount=1) const |
int | incompleteUnitCount (UnitType unit=UnitTypes::AllUnits) const |
virtual bool | isAlly (const Player player) const =0 |
virtual bool | isDefeated () const =0 |
virtual bool | isEnemy (const Player player) const =0 |
virtual bool | isNeutral () const =0 |
virtual bool | isObserver () const =0 |
virtual bool | isResearchAvailable (TechType tech) const =0 |
virtual bool | isResearching (TechType tech) const =0 |
virtual bool | isUnitAvailable (UnitType unit) const =0 |
virtual bool | isUpgrading (UpgradeType upgrade) const =0 |
virtual bool | isVictorious () const =0 |
virtual int | killedUnitCount (UnitType unit=UnitTypes::AllUnits) const =0 |
virtual bool | leftGame () const =0 |
int | maxEnergy (UnitType unit) const |
virtual int | minerals () const =0 |
virtual int | refundedGas () const =0 |
virtual int | refundedMinerals () const =0 |
virtual int | repairedGas () const =0 |
virtual int | repairedMinerals () const =0 |
int | sightRange (UnitType unit) const |
virtual int | spentGas () const =0 |
virtual int | spentMinerals () const =0 |
virtual int | supplyTotal (Race race=Races::None) const =0 |
virtual int | supplyUsed (Race race=Races::None) const =0 |
double | topSpeed (UnitType unit) const |
virtual int | visibleUnitCount (UnitType unit=UnitTypes::AllUnits) const =0 |
int | weaponDamageCooldown (UnitType unit) const |
int | weaponMaxRange (WeaponType weapon) const |
The Player represents a unique controller in the game.
Each player in a match will have his or her own player instance. There is also a neutral player which owns all the neutral units (such as mineral patches and vespene geysers).
Retrieves a unique ID that represents the player.
Retrieves the name of the player.
Example usage:
Retrieves the set of all units that the player owns.
This also includes incomplete units.
Example usage:
Retrieves the race of the player.
This allows you to change strategies against different races, or generalize some commands for yourself.
Races::Unknown | If the player chose Races::Random when the game started and they have not been seen. |
Example usage:
Retrieves the player's controller type.
This allows you to distinguish betweeen computer and human players.
Retrieves the player's force.
A force is the team that the player is playing on.
Checks if this player is allied to the specified player.
player | The player to check alliance with. |
true | if this player is allied with player . |
false | if this player is not allied with player . |
player
is neutral or an observer.Checks if this player is unallied to the specified player.
player | The player to check alliance with. |
true | if this player is allied with player . |
false | if this player is not allied with player . |
player
is neutral or an observer.Checks if this player is the neutral player.
true | if this player is the neutral player. |
false | if this player is any other player. |
Retrieve's the player's starting location.
TilePositions::None | if the player does not have a start location. |
TilePositions::Unknown | if an error occured while trying to retrieve the start location. |
Checks if the player has achieved victory.
Checks if the player has been defeated.
Checks if the player has left the game.
Retrieves the current amount of minerals/ore that this player has.
Retrieves the current amount of vespene gas that this player has.
Retrieves the cumulative amount of minerals/ore that this player has gathered since the beginning of the game, including the amount that the player starts the game with (if any).
Retrieves the cumulative amount of vespene gas that this player has gathered since the beginning of the game, including the amount that the player starts the game with (if any).
Retrieves the cumulative amount of minerals/ore that this player has spent on repairing units since the beginning of the game.
This function only applies to Terran players.
Retrieves the cumulative amount of vespene gas that this player has spent on repairing units since the beginning of the game.
This function only applies to Terran players.
Retrieves the cumulative amount of minerals/ore that this player has gained from refunding (cancelling) units and structures.
Retrieves the cumulative amount of vespene gas that this player has gained from refunding (cancelling) units and structures.
Retrieves the cumulative amount of minerals/ore that this player has spent, excluding repairs.
Retrieves the cumulative amount of vespene gas that this player has spent, excluding repairs.
Retrieves the total amount of supply the player has available for unit control.
race | (optional) The race to query the total supply for. If this is omitted, then the player's current race will be used. |
race
.Example usage:
Retrieves the current amount of supply that the player is using for unit control.
race | (optional) The race to query the used supply for. If this is omitted, then the player's current race will be used. |
race
. UnitTypes::AllUnits
) const pure virtualRetrieves the total number of units that the player has.
If the information about the player is limited, then this function will only return the number of visible units.
unit | (optional) The unit type to query. UnitType macros are accepted. If this parameter is omitted, then it will use UnitTypes::AllUnits by default. |
UnitTypes::AllUnits
) const pure virtualRetrieves the total number of strictly visible units that the player has, even if information on the player is unrestricted.
unit | (optional) The unit type to query. UnitType macros are accepted. If this parameter is omitted, then it will use UnitTypes::AllUnits by default. |
UnitTypes::AllUnits
) const pure virtualRetrieves the number of completed units that the player has.
If the information about the player is limited, then this function will only return the number of visible completed units.
unit | (optional) The unit type to query. UnitType macros are accepted. If this parameter is omitted, then it will use UnitTypes::AllUnits by default. |
Example usage:
UnitTypes::AllUnits
) constRetrieves the number of incomplete units that the player has.
If the information about the player is limited, then this function will only return the number of visible incomplete units.
unit | (optional) The unit type to query. UnitType macros are accepted. If this parameter is omitted, then it will use UnitTypes::AllUnits by default. |
UnitTypes::AllUnits
) const pure virtualRetrieves the number units that have died for this player.
unit | (optional) The unit type to query. UnitType macros are accepted. If this parameter is omitted, then it will use UnitTypes::AllUnits by default. |
UnitTypes::AllUnits
) const pure virtualRetrieves the number units that the player has killed.
unit | (optional) The unit type to query. UnitType macros are accepted. If this parameter is omitted, then it will use UnitTypes::AllUnits by default. |
Retrieves the current upgrade level that the player has attained for a given upgrade type.
upgrade | The UpgradeType to query. |
upgrade
has been upgraded for this player.Example usage:
Checks if the player has already researched a given technology.
tech | The TechType to query. |
tech
, or false if they have not Checks if the player is researching a given technology type.
tech | The TechType to query. |
tech
, or false otherwise Checks if the player is upgrading a given upgrade type.
upgrade | The upgrade type to query. |
upgrade
, false otherwiseExample usage:
Retrieves the color value of the current player.
Retrieves the control code character that changes the color of text messages to represent this player.
Retrieves the maximum amount of energy that a unit type will have, taking the player's energy upgrades into consideration.
unit | The UnitType to retrieve the maximum energy for. |
Retrieves the top speed of a unit type, taking the player's speed upgrades into consideration.
unit | The UnitType to retrieve the top speed for. |
Retrieves the maximum weapon range of a weapon type, taking the player's weapon upgrades into consideration.
weapon | The WeaponType to retrieve the maximum range for. |
Retrieves the sight range of a unit type, taking the player's sight range upgrades into consideration.
unit | The UnitType to retrieve the sight range for. |
Retrieves the weapon cooldown of a unit type, taking the player's attack speed upgrades into consideration.
unit | The UnitType to retrieve the damage cooldown for. |
Calculates the armor that a given unit type will have, including upgrades.
unit | The unit type to calculate armor for, using the current player's upgrades. |
Calculates the damage that a given weapon type can deal, including upgrades.
wpn | The weapon type to calculate for. |
Retrieves the total unit score, as seen in the end-game score screen.
Retrieves the total kill score, as seen in the end-game score screen.
Retrieves the total building score, as seen in the end-game score screen.
Retrieves the total razing score, as seen in the end-game score screen.
Retrieves the player's custom score.
This score is used in Use Map Settings game types.
Checks if the player is an observer player, typically in a Use Map Settings observer game.
An observer player does not participate in the game.
Retrieves the maximum upgrades available specific to the player.
This value is only different from UpgradeType::maxRepeats in Use Map Settings games.
upgrade | The UpgradeType to retrieve the maximum upgrade level for. |
upgrade
type.Example usage:
Checks if a technology can be researched by the player.
Certain technologies may be disabled in Use Map Settings game types.
tech | The TechType to query. |
tech
type is available to the player for research. Checks if a unit type can be created by the player.
Certain unit types may be disabled in Use Map Settings game types.
unit | The UnitType to check. |
unit
type is available to the player. Verifies that this player satisfies a unit type requirement.
This verifies complex type requirements involving morphable Zerg structures. For example, if something requires a Spire, but the player has (or is in the process of morphing) a Greater Spire, this function will identify the requirement. It is simply a convenience function that performs all of the requirement checks.
unit | The UnitType to check. |
amount | (optional) The amount of units that are required. |