public class Unit
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
boolean |
attack(Position target)
Orders the unit to attack move to the specified location.
|
boolean |
attack(Position target,
boolean shiftQueueCommand) |
boolean |
attack(Unit target)
Orders the unit to attack the specified unit.
|
boolean |
attack(Unit target,
boolean shiftQueueCommand) |
boolean |
build(TilePosition target,
UnitType type)
Orders the unit to build the given unit type at the given position.
|
boolean |
buildAddon(UnitType type)
Orders the unit to build the given addon.
|
boolean |
burrow()
Orders the unit to burrow.
|
boolean |
cancelAddon()
Orders the unit to stop making the addon.
|
boolean |
cancelConstruction()
Orders the building to stop being constructed.
|
boolean |
cancelMorph()
Orders the unit to stop morphing.
|
boolean |
cancelResearch()
Orders the unit to cancel a research in progress.
|
boolean |
cancelTrain()
Orders the unit to remove the specified unit from its training queue.
|
boolean |
cancelTrain(int slot) |
boolean |
cancelUpgrade()
Orders the unit to cancel an upgrade in progress.
|
boolean |
canIssueCommand(UnitCommand command)
Returns true if the unit is able to execute the given command, or false if there is an error
|
boolean |
cloak()
Orders the unit to cloak.
|
boolean |
decloak()
Orders the unit to decloak.
|
boolean |
exists()
Returns the unit's custom client info.
|
boolean |
follow(Unit target)
Orders the unit to follow the specified unit.
|
boolean |
follow(Unit target,
boolean shiftQueueCommand) |
boolean |
gather(Unit target)
Orders the unit to gather the specified unit (must be mineral or refinery type).
|
boolean |
gather(Unit target,
boolean shiftQueueCommand) |
int |
getAcidSporeCount()
Returns the unit's acid spore count.
|
Unit |
getAddon()
Returns the add-on of this unit, or NULL if the unit doesn't have an add-on.
|
int |
getAirWeaponCooldown()
Returns unit's air weapon cooldown.
|
double |
getAngle()
Returns the direction the unit is facing, measured in radians.
|
int |
getBottom()
Returns the Y coordinate of the bottom side of the unit.
|
UnitType |
getBuildType()
Returns the building type a worker is about to construct.
|
Unit |
getBuildUnit()
If the unit is an SCV that is constructing a building, this will return the building it is
constructing.
|
Unit |
getCarrier()
For Protoss Interceptors, this returns the Carrier unit this Interceptor is controlled by.
|
int |
getDefenseMatrixPoints()
Returns the remaining hit points of the defense matrix.
|
int |
getDefenseMatrixTimer()
Returns the time until the defense matrix wears off. 0 -> No defense Matrix present.
|
int |
getDistance(Position target)
Returns the distance from the edge of the current unit to the target position.
|
int |
getDistance(Unit target)
Returns the edge-to-edge distance between the current unit and the target unit.
|
int |
getEnergy()
Returns the unit's current amount of energy.
|
int |
getEnsnareTimer()
Returns the time until the ensnare effect wears off. 0 -> No ensnare effect present.
|
int |
getGroundWeaponCooldown()
Returns unit's ground weapon cooldown.
|
Unit |
getHatchery()
For Zerg Larva, this returns the Hatchery, Lair, or Hive unit this Larva was spawned from.
|
int |
getHitPoints()
Returns the unit's current amount of hit points.
|
int |
getID()
Returns a unique ID for this unit.
|
int |
getInitialHitPoints()
Returns the unit's initial amount of hit points, or 0 if it wasn't a neutral unit at the beginning
of the game.
|
Position |
getInitialPosition()
Returns the initial position of the unit on the map, or Positions::Unknown if the unit wasn't a
neutral unit at the beginning of the game.
|
int |
getInitialResources()
Returns the unit's initial amount of containing resources, or 0 if the unit wasn't a neutral unit
at the beginning of the game.
|
TilePosition |
getInitialTilePosition()
Returns the initial build tile position of the unit on the map, or TilePositions::Unknown if the
unit wasn't a neutral unit at the beginning of the game.
|
UnitType |
getInitialType()
Returns the initial type of the unit or Unknown if it wasn't a neutral unit at the beginning of the
game.
|
int |
getInterceptorCount()
Returns the number of interceptors the Protoss Carrier has.
|
java.util.List<Unit> |
getInterceptors()
Returns the set of interceptors controlled by this unit.
|
int |
getIrradiateTimer()
Returns the time until the radiation wears off. 0 -> No radiation present.
|
int |
getKillCount()
Returns the unit's current kill count.
|
java.util.List<Unit> |
getLarva()
Returns the set of larva spawned by this unit.
|
Player |
getLastAttackingPlayer()
Returns the last successful command.
|
int |
getLastCommandFrame()
Returns the frame of the last successful command.
|
int |
getLeft()
Returns the X coordinate of the left side of the unit.
|
java.util.List<Unit> |
getLoadedUnits()
Returns a list of the units loaded into a Terran Bunker, Terran Dropship, Protoss Shuttle, or Zerg
Overlord.
|
int |
getLockdownTimer()
Returns the time until the lockdown wears off. 0 -> No lockdown present.
|
int |
getMaelstromTimer()
Returns the time until the maelstrom wears off. 0 -> No maelstrom present.
|
Unit |
getNydusExit()
Returns the corresponding connected nydus canal of this unit, or NULL if the unit does not have a
connected nydus canal.
|
Order |
getOrder() |
Unit |
getOrderTarget()
This is usually set when the low level unit AI acquires a new target automatically.
|
Position |
getOrderTargetPosition()
Returns the target position for the units order.
|
int |
getOrderTimer() |
int |
getPlagueTimer()
Returns the time until the plague wears off. 0 -> No plague present.
|
Player |
getPlayer()
Returns a pointer to the player that owns this unit.
|
Position |
getPosition()
Returns the position of the unit on the map.
|
Unit |
getPowerUp()
Returns the power up the unit is holding, or NULL if the unit is not holding a power up
|
Position |
getRallyPosition()
Returns the position the building is rallied to.
|
Unit |
getRallyUnit()
Returns the unit the building is rallied to.
|
Region |
getRegion()
Returns the region that this unit is currently in.
|
int |
getRemainingBuildTime()
Returns the remaining build time of a unit/building that is being constructed.
|
int |
getRemainingResearchTime()
Returns the amount of time until the unit is done researching its current tech.
|
int |
getRemainingTrainTime()
Returns the remaining time of the unit that is currently being trained.
|
int |
getRemainingUpgradeTime()
Returns the amount of time until the unit is done upgrading its current upgrade.
|
int |
getRemoveTimer()
Returns the amount of time until the unit is removed, or 0 if the unit does not have a remove timer.
|
int |
getReplayID()
Returns the unit ID that is used in a replay (*.rep) file's action recordings.
|
int |
getResourceGroup()
Retrieves the group ID of a resource.
|
int |
getResources()
Returns the unit's current amount of containing resources.
|
int |
getRight()
Returns the X coordinate of the right side of the unit.
|
int |
getScarabCount()
Returns the number of scarabs in the Protoss Reaver.
|
Order |
getSecondaryOrder() |
int |
getShields()
Returns the unit's current amount of shields.
|
int |
getSpellCooldown()
Returns unit's ground weapon cooldown.
|
int |
getSpiderMineCount()
Returns the number of spider mines in the Terran Vulture.
|
int |
getStasisTimer()
Returns the time until the stasis field wears off. 0 -> No stasis field present.
|
int |
getStimTimer()
Returns the time until the stimpack wears off. 0 -> No stimpack boost present.
|
Unit |
getTarget()
Generally returns the appropriate target unit after issuing an order that accepts a target unit
(i.e. attack, repair, gather, follow, etc.).
|
Position |
getTargetPosition()
Returns the target position the unit is moving to (provided a valid path to the target position
exists).
|
TechType |
getTech()
Returns the list of units queued up to be trained.
|
TilePosition |
getTilePosition()
Returns the build tile position of the unit on the map.
|
int |
getTop()
Returns the Y coordinate of the top side of the unit.
|
Unit |
getTransport()
Returns the dropship, shuttle, overlord, or bunker that is this unit is loaded in to.
|
UnitType |
getType()
Returns the current type of the unit.
|
java.util.List<Unit> |
getUnitsInRadius(int radius)
Returns the set of units within the given radius of this unit
|
java.util.List<Unit> |
getUnitsInWeaponRange(WeaponType weapon)
Returns the set of units within weapon range of this unit.
|
UpgradeType |
getUpgrade()
Returns the upgrade that the unit is currently upgrading.
|
int |
getUpgradeLevel(UpgradeType upgrade)
Returns the player's current upgrade level for the given upgrade, if the unit is affected by this
upgrade.
|
double |
getVelocityX()
Returns the x component of the unit's velocity, measured in pixels per frame.
|
double |
getVelocityY()
Returns the y component of the unit's velocity, measured in pixels per frame.
|
boolean |
haltConstruction()
Orders the SCV to stop constructing the building, and the building is left in a partially complete
state until it is canceled, destroyed, or completed.
|
boolean |
hasNuke() |
boolean |
hasPath(Position target)
Returns true if the unit is able to move to the target position
|
boolean |
hasPath(Unit target)
Returns true if the unit is able to move to the target unit
|
boolean |
holdPosition()
Orders the unit to hold its position.
|
boolean |
holdPosition(boolean shiftQueueCommand) |
boolean |
isAccelerating()
Returns true if the unit is currently accelerating.
|
boolean |
isAttackFrame() |
boolean |
isAttacking() |
boolean |
isBeingConstructed()
Returns true if the unit is being constructed.
|
boolean |
isBeingGathered()
Returns true if the unit is a mineral patch or refinery that is being gathered.
|
boolean |
isBeingHealed()
Returns true if the unit is currently being healed by a Terran Medic, or repaired by a Terran SCV.
|
boolean |
isBlind()
Returns true if the unit is currently blind from a Medic's Optical Flare.
|
boolean |
isBraking()
Returns true if the unit is currently braking/slowing down.
|
boolean |
isBurrowed()
Returns true if the unit is a Zerg unit that is current burrowed.
|
boolean |
isCarryingGas()
Returns true if the unit is a worker that is carrying gas.
|
boolean |
isCarryingMinerals()
Returns true if the unit is a worker that is carrying minerals.
|
boolean |
isCloaked()
Returns true if the unit is cloaked.
|
boolean |
isCompleted()
Returns true if the unit has been completed.
|
boolean |
isConstructing()
Returns true when a unit has been issued an order to build a structure and is moving to the build
location.
|
boolean |
isDefenseMatrixed()
Returns true if the unit has a defense matrix from a Terran Science Vessel.
|
boolean |
isDetected()
Returns true if the unit is detected.
|
boolean |
isEnsnared()
Returns true if the unit has been ensnared by a Zerg Queen.
|
boolean |
isFollowing()
Returns true if the unit is following another unit.
|
boolean |
isGatheringGas()
Returns true if the unit is in one of the four states for gathering gas (MoveToGas, WaitForGas,
HarvestGas, ReturnGas).
|
boolean |
isGatheringMinerals()
Returns true if the unit is in one of the four states for gathering minerals (MoveToMinerals,
WaitForMinerals, MiningMinerals, ReturnMinerals).
|
boolean |
isHallucination()
Returns true for hallucinated units, false for normal units.
|
boolean |
isHoldingPosition()
Returns true if the unit is holding position
\see Unit::holdPosition.
|
boolean |
isIdle()
Returns true if the unit is not doing anything.
|
boolean |
isInterruptible()
Returns true if the unit can be interrupted.
|
boolean |
isInvincible()
Returns true if the unit is invincible.
|
boolean |
isInWeaponRange(Unit target)
Returns true if the unit can attack a specified target from its current position.
|
boolean |
isIrradiated()
Returns true if the unit is being irradiated by a Terran Science Vessel.
|
boolean |
isLifted()
Returns true if the unit is a Terran building that is currently lifted off the ground.
|
boolean |
isLoaded()
Return true if the unit is loaded into a Terran Bunker, Terran Dropship, Protoss Shuttle, or Zerg
Overlord.
|
boolean |
isLockedDown()
Returns true if the unit is locked down by a Terran Ghost.
|
boolean |
isMaelstrommed()
Returns true if the unit is being maelstrommed.
|
boolean |
isMorphing()
Returns true if the unit is a zerg unit that is morphing.
|
boolean |
isMoving()
Returns true if the unit is moving.
|
boolean |
isParasited()
Returns true if the unit has been parasited by some other player.
|
boolean |
isPatrolling()
Returns true if the unit is patrolling between two positions.
|
boolean |
isPlagued()
Returns true if the unit has been plagued by a Zerg Defiler.
|
boolean |
isRepairing()
Returns true if the unit is a Terran SCV that is repairing or moving to repair another unit.
|
boolean |
isResearching()
Returns true if the unit is a building that is researching tech.
|
boolean |
isSelected()
Returns true if the unit has been selected by the user via the starcraft GUI.
|
boolean |
isSieged()
Returns true if the unit is a Terran Siege Tank that is currently in Siege mode.
|
boolean |
isStartingAttack()
Returns true if the unit is starting to attack.
|
boolean |
isStasised()
Returns true if the unit has been stasised by a Protoss Arbiter.
|
boolean |
isStimmed()
Returns true if the unit is currently stimmed.
|
boolean |
isStuck()
Returns true if the unit is being pushed off of another unit
|
boolean |
issueCommand(UnitCommand command)
Issues the give unit command, or returns false if there is an error
|
boolean |
isTraining()
Returns true if the unit is training units (i.e. a Barracks training Marines).
|
boolean |
isUnderAttack()
Returns true if the unit was recently attacked.
|
boolean |
isUnderDarkSwarm()
Returns true if the unit is under a Dark Swarm.
|
boolean |
isUnderDisruptionWeb()
Returns true if the unit is under a Disruption Web.
|
boolean |
isUnderStorm()
Returns true if the unit is under a Protoss Psionic Storm.
|
boolean |
isUnpowered()
Returns true if the unit is a Protoss building that is unpowered because no pylons are in range.
|
boolean |
isUpgrading()
Returns true if the unit is a building that is upgrading.
|
boolean |
isVisible()
Returns true if the unit is visible.
|
boolean |
isVisible(Player player) |
boolean |
land(TilePosition target)
Orders the unit to land.
|
boolean |
lift()
Orders the unit to lift.
|
boolean |
load(Unit target)
Orders the unit to load the target unit.
|
boolean |
load(Unit target,
boolean shiftQueueCommand) |
boolean |
morph(UnitType type)
Orders the unit to morph into the specified unit type.
|
boolean |
move(Position target)
Orders the unit to move from its current position to the specified position.
|
boolean |
move(Position target,
boolean shiftQueueCommand) |
boolean |
patrol(Position target)
Orders the unit to patrol between its current position and the specified position.
|
boolean |
patrol(Position target,
boolean shiftQueueCommand) |
boolean |
placeCOP(TilePosition target)
Moves a Flag Beacon to the target location.
|
boolean |
repair(Unit target)
Orders the unit to repair the specified unit.
|
boolean |
repair(Unit target,
boolean shiftQueueCommand) |
boolean |
research(TechType tech)
Orders the unit to research the given tech type.
|
boolean |
returnCargo()
Orders the unit to return its cargo to a nearby resource depot such as a Command Center.
|
boolean |
returnCargo(boolean shiftQueueCommand) |
boolean |
rightClick(Position target)
Works like the right click in the GUI.
|
boolean |
rightClick(Position target,
boolean shiftQueueCommand) |
boolean |
rightClick(Unit target)
Works like the right click in the GUI.
|
boolean |
rightClick(Unit target,
boolean shiftQueueCommand) |
boolean |
setRallyPoint(Position target)
Orders the unit to set its rally position to the specified position.
|
boolean |
setRallyPoint(Unit target)
Orders the unit to set its rally unit to the specified unit.
|
boolean |
siege()
Orders the unit to siege.
|
boolean |
stop()
Orders the unit to stop.
|
boolean |
stop(boolean shiftQueueCommand) |
boolean |
train(UnitType type)
Orders this unit to add the specified unit type to the training queue.
|
boolean |
unburrow()
Orders the burrowed unit to unburrow.
|
boolean |
unload(Unit target)
Orders the unit to unload the target unit.
|
boolean |
unloadAll()
Orders the unit to unload all loaded units at the unit's current position.
|
boolean |
unloadAll(boolean shiftQueueCommand) |
boolean |
unloadAll(Position target)
Orders the unit to unload all loaded units at the specified location.
|
boolean |
unloadAll(Position target,
boolean shiftQueueCommand) |
boolean |
unsiege()
Orders the unit to unsiege.
|
boolean |
upgrade(UpgradeType upgrade)
Orders the unit to upgrade the given upgrade type.
|
boolean |
useTech(TechType tech)
Orders the unit to use a tech not requiring a target (ie Stim Pack).
|
boolean |
useTech(TechType tech,
Position target)
Orders the unit to use a tech requiring a position target (ie Dark Swarm).
|
boolean |
useTech(TechType tech,
Unit target)
Orders the unit to use a tech requiring a unit target (ie Irradiate).
|
public int getID()
public int getReplayID()
public Player getPlayer()
public UnitType getType()
public Position getPosition()
public TilePosition getTilePosition()
public double getAngle()
public double getVelocityX()
public double getVelocityY()
public Region getRegion()
public int getLeft()
public int getTop()
public int getRight()
public int getBottom()
public int getHitPoints()
public int getShields()
public int getEnergy()
public int getResources()
public int getResourceGroup()
public int getDistance(Unit target)
public int getDistance(Position target)
public boolean hasPath(Unit target)
public boolean hasPath(Position target)
public int getLastCommandFrame()
public Player getLastAttackingPlayer()
public int getUpgradeLevel(UpgradeType upgrade)
public UnitType getInitialType()
public Position getInitialPosition()
public TilePosition getInitialTilePosition()
public int getInitialHitPoints()
public int getInitialResources()
public int getKillCount()
public int getAcidSporeCount()
public int getInterceptorCount()
public int getScarabCount()
public int getSpiderMineCount()
public int getGroundWeaponCooldown()
public int getAirWeaponCooldown()
public int getSpellCooldown()
public int getDefenseMatrixPoints()
public int getDefenseMatrixTimer()
public int getEnsnareTimer()
public int getIrradiateTimer()
public int getLockdownTimer()
public int getMaelstromTimer()
public int getOrderTimer()
public int getPlagueTimer()
public int getRemoveTimer()
public int getStasisTimer()
public int getStimTimer()
public UnitType getBuildType()
public TechType getTech()
public UpgradeType getUpgrade()
public int getRemainingBuildTime()
public int getRemainingTrainTime()
public int getRemainingResearchTime()
public int getRemainingUpgradeTime()
public Unit getBuildUnit()
public Unit getTarget()
public Position getTargetPosition()
public Order getOrder()
public Order getSecondaryOrder()
public Unit getOrderTarget()
public Position getOrderTargetPosition()
public Position getRallyPosition()
public Unit getRallyUnit()
public Unit getAddon()
public Unit getNydusExit()
public Unit getPowerUp()
public Unit getTransport()
public java.util.List<Unit> getLoadedUnits()
public Unit getCarrier()
public java.util.List<Unit> getInterceptors()
public Unit getHatchery()
public java.util.List<Unit> getLarva()
public java.util.List<Unit> getUnitsInRadius(int radius)
public java.util.List<Unit> getUnitsInWeaponRange(WeaponType weapon)
public boolean exists()
public boolean hasNuke()
public boolean isAccelerating()
public boolean isAttacking()
public boolean isAttackFrame()
public boolean isBeingConstructed()
public boolean isBeingGathered()
public boolean isBeingHealed()
public boolean isBlind()
public boolean isBraking()
public boolean isBurrowed()
public boolean isCarryingGas()
public boolean isCarryingMinerals()
public boolean isCloaked()
public boolean isCompleted()
public boolean isConstructing()
public boolean isDefenseMatrixed()
public boolean isDetected()
public boolean isEnsnared()
public boolean isFollowing()
public boolean isGatheringGas()
public boolean isGatheringMinerals()
public boolean isHallucination()
public boolean isHoldingPosition()
public boolean isIdle()
public boolean isInterruptible()
public boolean isInvincible()
public boolean isInWeaponRange(Unit target)
public boolean isIrradiated()
public boolean isLifted()
public boolean isLoaded()
public boolean isLockedDown()
public boolean isMaelstrommed()
public boolean isMorphing()
public boolean isMoving()
public boolean isParasited()
public boolean isPatrolling()
public boolean isPlagued()
public boolean isRepairing()
public boolean isResearching()
public boolean isSelected()
public boolean isSieged()
public boolean isStartingAttack()
public boolean isStasised()
public boolean isStimmed()
public boolean isStuck()
public boolean isTraining()
public boolean isUnderAttack()
public boolean isUnderDarkSwarm()
public boolean isUnderDisruptionWeb()
public boolean isUnderStorm()
public boolean isUnpowered()
public boolean isUpgrading()
public boolean isVisible()
public boolean isVisible(Player player)
public boolean canIssueCommand(UnitCommand command)
public boolean issueCommand(UnitCommand command)
public boolean attack(Position target)
public boolean attack(Position target, boolean shiftQueueCommand)
public boolean attack(Unit target)
public boolean attack(Unit target, boolean shiftQueueCommand)
public boolean build(TilePosition target, UnitType type)
public boolean buildAddon(UnitType type)
public boolean train(UnitType type)
public boolean morph(UnitType type)
public boolean research(TechType tech)
public boolean upgrade(UpgradeType upgrade)
public boolean setRallyPoint(Position target)
public boolean setRallyPoint(Unit target)
public boolean move(Position target)
public boolean move(Position target, boolean shiftQueueCommand)
public boolean patrol(Position target)
public boolean patrol(Position target, boolean shiftQueueCommand)
public boolean holdPosition()
public boolean holdPosition(boolean shiftQueueCommand)
public boolean stop()
public boolean stop(boolean shiftQueueCommand)
public boolean follow(Unit target)
public boolean follow(Unit target, boolean shiftQueueCommand)
public boolean gather(Unit target)
public boolean gather(Unit target, boolean shiftQueueCommand)
public boolean returnCargo()
public boolean returnCargo(boolean shiftQueueCommand)
public boolean repair(Unit target)
public boolean repair(Unit target, boolean shiftQueueCommand)
public boolean burrow()
public boolean unburrow()
public boolean cloak()
public boolean decloak()
public boolean siege()
public boolean unsiege()
public boolean lift()
public boolean land(TilePosition target)
public boolean load(Unit target)
public boolean load(Unit target, boolean shiftQueueCommand)
public boolean unload(Unit target)
public boolean unloadAll()
public boolean unloadAll(boolean shiftQueueCommand)
public boolean unloadAll(Position target)
public boolean unloadAll(Position target, boolean shiftQueueCommand)
public boolean rightClick(Position target)
public boolean rightClick(Position target, boolean shiftQueueCommand)
public boolean rightClick(Unit target)
public boolean rightClick(Unit target, boolean shiftQueueCommand)
public boolean haltConstruction()
public boolean cancelConstruction()
public boolean cancelAddon()
public boolean cancelTrain()
public boolean cancelTrain(int slot)
public boolean cancelMorph()
public boolean cancelResearch()
public boolean cancelUpgrade()
public boolean useTech(TechType tech)
public boolean useTech(TechType tech, Position target)
public boolean useTech(TechType tech, Unit target)
public boolean placeCOP(TilePosition target)