public class Player extends Object implements Comparable<Player>
PlayerType
,
Race
Modifier and Type | Method and Description |
---|---|
int |
allUnitCount() |
int |
allUnitCount(UnitType unit)
Retrieves the total number of units that the player has.
|
int |
armor(UnitType unit)
Calculates the armor that a given unit type will have, including upgrades.
|
int |
compareTo(Player other) |
int |
completedUnitCount() |
int |
completedUnitCount(UnitType unit)
Retrieves the number of completed units that the player has.
|
int |
damage(WeaponType wpn)
Calculates the damage that a given weapon type can deal, including upgrades.
|
int |
deadUnitCount() |
int |
deadUnitCount(UnitType unit)
Retrieves the number units that have died for this player.
|
boolean |
equals(Object o) |
int |
gas()
Retrieves the current amount of vespene gas that this player has.
|
int |
gatheredGas()
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).
|
int |
gatheredMinerals()
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).
|
int |
getBuildingScore()
Retrieves the total building score, as seen in the end-game score screen.
|
Color |
getColor()
Retrieves the color value of the current player.
|
int |
getCustomScore()
Retrieves the player's custom score.
|
Force |
getForce()
Retrieves the player's force.
|
int |
getID()
Retrieves a unique ID that represents the player.
|
int |
getKillScore()
Retrieves the total kill score, as seen in the end-game score screen.
|
int |
getMaxUpgradeLevel(UpgradeType upgrade)
Retrieves the maximum upgrades available specific to the player.
|
String |
getName()
Retrieves the name of the player.
|
Race |
getRace()
Retrieves the race of the player.
|
int |
getRazingScore()
Retrieves the total razing score, as seen in the end-game score screen.
|
TilePosition |
getStartLocation()
Retrieve's the player's starting location.
|
Text |
getTextColor()
Retrieves the control code character that changes the color of text messages to
represent this player.
|
PlayerType |
getType()
Retrieves the player's controller type.
|
List<Unit> |
getUnits()
Retrieves the set of all units that the player owns.
|
int |
getUnitScore()
Retrieves the total unit score, as seen in the end-game score screen.
|
int |
getUpgradeLevel(UpgradeType upgrade)
Retrieves the current upgrade level that the player has attained for a given
upgrade type.
|
int |
hashCode() |
boolean |
hasResearched(TechType tech)
Checks if the player has already researched a given technology.
|
boolean |
hasUnitTypeRequirement(UnitType unit) |
boolean |
hasUnitTypeRequirement(UnitType unit,
int amount)
Verifies that this player satisfies a unit type requirement.
|
int |
incompleteUnitCount() |
int |
incompleteUnitCount(UnitType unit)
Retrieves the number of incomplete units that the player has.
|
boolean |
isAlly(Player player)
Checks if this player is allied to the specified player.
|
boolean |
isDefeated()
Checks if the player has been defeated.
|
boolean |
isEnemy(Player player)
Checks if this player is unallied to the specified player.
|
boolean |
isNeutral()
Checks if this player is the neutral player.
|
boolean |
isObserver()
Checks if the player is an observer player, typically in a @UMS observer
game.
|
boolean |
isResearchAvailable(TechType tech)
Checks if a technology can be researched by the player.
|
boolean |
isResearching(TechType tech)
Checks if the player is researching a given technology type.
|
boolean |
isUnitAvailable(UnitType unit)
Checks if a unit type can be created by the player.
|
boolean |
isUpgrading(UpgradeType upgrade)
Checks if the player is upgrading a given upgrade type.
|
boolean |
isVictorious()
Checks if the player has achieved victory.
|
int |
killedUnitCount() |
int |
killedUnitCount(UnitType unit)
Retrieves the number units that the player has killed.
|
boolean |
leftGame()
Checks if the player has left the game.
|
int |
maxEnergy(UnitType unit)
Retrieves the maximum amount of energy that a unit type will have, taking the
player's energy upgrades into consideration.
|
int |
minerals()
Retrieves the current amount of minerals/ore that this player has.
|
int |
refundedGas()
Retrieves the cumulative amount of vespene gas that this player has gained from
refunding (cancelling) units and structures.
|
int |
refundedMinerals()
Retrieves the cumulative amount of minerals/ore that this player has gained from
refunding (cancelling) units and structures.
|
int |
repairedGas()
Retrieves the cumulative amount of vespene gas that this player has spent on
repairing units since the beginning of the game.
|
int |
repairedMinerals()
Retrieves the cumulative amount of minerals/ore that this player has spent on
repairing units since the beginning of the game.
|
int |
sightRange(UnitType unit)
Retrieves the sight range of a unit type, taking the player's sight range
upgrades into consideration.
|
int |
spentGas()
Retrieves the cumulative amount of vespene gas that this player has spent,
excluding repairs.
|
int |
spentMinerals()
Retrieves the cumulative amount of minerals/ore that this player has spent,
excluding repairs.
|
int |
supplyTotal() |
int |
supplyTotal(Race race)
Retrieves the total amount of supply the player has available for unit control.
|
int |
supplyUsed() |
int |
supplyUsed(Race race)
Retrieves the current amount of supply that the player is using for unit control.
|
double |
topSpeed(UnitType unit)
Retrieves the top speed of a unit type, taking the player's speed upgrades into
consideration.
|
int |
visibleUnitCount() |
int |
visibleUnitCount(UnitType unit)
Retrieves the total number of strictly visible units that the player has, even if
information on the player is unrestricted.
|
int |
weaponDamageCooldown(UnitType unit)
Retrieves the weapon cooldown of a unit type, taking the player's attack speed
upgrades into consideration.
|
int |
weaponMaxRange(WeaponType weapon)
Retrieves the maximum weapon range of a weapon type, taking the player's weapon
upgrades into consideration.
|
public int getID()
public String getName()
public List<Unit> getUnits()
This does not include units that are loaded into transports, @Bunkers, @Refineries, @Assimilators, or @Extractors.
public Race getRace()
Race.Unknown
if the player chose Race.Random
when the game started and they
have not been seen.public PlayerType getType()
PlayerType
that identifies who is controlling a player.
Other players using BWAPI will be treated as a human player and return PlayerType.Player
.
public Force getForce()
Force
object that the player is part of.public boolean isAlly(Player player)
player
- The player to check alliance with.
Returns true if this player is allied with player, false if this player is not allied with player.
This function will also return false if this player is neutral or an observer, or if player is neutral or an observer.
isEnemy(bwapi.Player)
public boolean isEnemy(Player player)
player
- The player to check alliance with.This function will also return false if this player is neutral or an observer, or if player is neutral or an observer.
isAlly(bwapi.Player)
public boolean isNeutral()
public TilePosition getStartLocation()
TilePosition
containing the position of the start location.
Returns TilePosition.None
if the player does not have a start location.
Returns TilePosition.Unknown
if an error occured while trying to retrieve the start
location.Game.getStartLocations()
public boolean isVictorious()
public boolean isDefeated()
public boolean leftGame()
public int minerals()
This function will return 0 if the player is inaccessible.
public int gas()
This function will return 0 if the player is inaccessible.
public int gatheredMinerals()
This function will return 0 if the player is inaccessible.
public int gatheredGas()
This function will return 0 if the player is inaccessible.
public int repairedMinerals()
This function will return 0 if the player is inaccessible.
public int repairedGas()
This function will return 0 if the player is inaccessible.
public int refundedMinerals()
This function will return 0 if the player is inaccessible.
public int refundedGas()
This function will return 0 if the player is inaccessible.
public int spentMinerals()
This function will return 0 if the player is inaccessible.
public int spentGas()
This function will return 0 if the player is inaccessible.
public int supplyTotal()
public int supplyTotal(Race race)
In Starcraft programming, the managed supply values are double than what they appear in the game. The reason for this is because @Zerglings use 0.5 visible supply.
In Starcraft, the supply for each race is separate. Having a @Pylon and an @Overlord will not give you 32 supply. It will instead give you 16 @Protoss supply and 16 @Zerg supply.
race
- The race to query the total supply for. If this is omitted, then the player's current race will be used.supplyUsed()
public int supplyUsed()
public int supplyUsed(Race race)
race
- The race to query the used supply for. If this is omitted, then the player's current race will be used.supplyTotal()
public int allUnitCount()
public int allUnitCount(UnitType unit)
While in-progress @Protoss and @Terran units will be counted, in-progress @Zerg units (i.e. inside of an egg) do not.
unit
- The unit type to query. UnitType macros are accepted. If this parameter is omitted, then it will use UnitType.AllUnits by default.visibleUnitCount()
,
completedUnitCount()
,
incompleteUnitCount()
public int visibleUnitCount()
public int visibleUnitCount(UnitType unit)
unit
- The unit type to query. UnitType macros are accepted. If this parameter is omitted, then it will use UnitType.AllUnits by default.allUnitCount()
,
completedUnitCount()
,
incompleteUnitCount()
public int completedUnitCount()
public int completedUnitCount(UnitType unit)
unit
- The unit type to query. UnitType macros are accepted. If this parameter is omitted, then it will use UnitType.AllUnits by default.allUnitCount()
,
visibleUnitCount()
,
incompleteUnitCount()
public int incompleteUnitCount()
public int incompleteUnitCount(UnitType unit)
This function is a macro for allUnitCount() - completedUnitCount().
Incomplete @Zerg units inside of eggs are not counted.
unit
- The unit type to query. UnitType macros are accepted. If this parameter is omitted, then it will use UnitType.AllUnits by default.allUnitCount()
,
visibleUnitCount()
,
completedUnitCount()
public int deadUnitCount()
public int deadUnitCount(UnitType unit)
unit
- The unit type to query. UnitType
macros are accepted. If this parameter is omitted, then it will use UnitType.AllUnits
by default.public int killedUnitCount()
public int killedUnitCount(UnitType unit)
unit
- The unit type to query. UnitType macros are accepted. If this parameter is omitted, then it will use UnitType.AllUnits
by default.public int getUpgradeLevel(UpgradeType upgrade)
upgrade
- The UpgradeType to query.Unit.upgrade(bwapi.UpgradeType)
,
getMaxUpgradeLevel(bwapi.UpgradeType)
public boolean hasResearched(TechType tech)
tech
- The TechType
to query.isResearching(bwapi.TechType)
,
Unit.research(bwapi.TechType)
,
isResearchAvailable(bwapi.TechType)
public boolean isResearching(TechType tech)
tech
- The TechType
to query.Unit.research(bwapi.TechType)
,
hasResearched(bwapi.TechType)
public boolean isUpgrading(UpgradeType upgrade)
upgrade
- The upgrade type to query.Unit.upgrade(bwapi.UpgradeType)
public Color getColor()
Color
object that represents the color of the current player.public Text getTextColor()
public int maxEnergy(UnitType unit)
unit
- The UnitType
to retrieve the maximum energy for.public double topSpeed(UnitType unit)
unit
- The UnitType
to retrieve the top speed for.public int weaponMaxRange(WeaponType weapon)
weapon
- The WeaponType
to retrieve the maximum range for.public int sightRange(UnitType unit)
unit
- The UnitType
to retrieve the sight range for.public int weaponDamageCooldown(UnitType unit)
unit
- The UnitType
to retrieve the damage cooldown for.public int armor(UnitType unit)
unit
- The unit type to calculate armor for, using the current player's upgrades.public int damage(WeaponType wpn)
wpn
- The weapon type to calculate for.public int getUnitScore()
public int getKillScore()
public int getBuildingScore()
public int getRazingScore()
public int getCustomScore()
public boolean isObserver()
public int getMaxUpgradeLevel(UpgradeType upgrade)
upgrade
- The UpgradeType
to retrieve the maximum upgrade level for.public boolean isResearchAvailable(TechType tech)
tech
- The TechType
to query.public boolean isUnitAvailable(UnitType unit)
unit
- The UnitType
to check.public boolean hasUnitTypeRequirement(UnitType unit)
public boolean hasUnitTypeRequirement(UnitType unit, int amount)
unit
- The UnitType to check.amount
- The amount of units that are required.public int compareTo(Player other)
compareTo
in interface Comparable<Player>
Copyright © 2022. All rights reserved.