com.springrts.ai.oo
Class Unit

java.lang.Object
  extended by com.springrts.ai.oo.Unit
All Implemented Interfaces:
Comparable<Unit>

public class Unit
extends Object
implements Comparable<Unit>


Method Summary
 int compareTo(Unit other)
           
 boolean equals(Object otherObject)
           
 int getAiHint()
          Indicates the units main function.
 int getAllyTeam()
           
 int getBuildingFacing()
          Returns the unit's build facing (0-3)
 List<CurrentCommand> getCurrentCommands()
           
 float getCurrentFuel()
           
 UnitDef getDef()
          Returns the unit's unitdef struct from which you can read all the statistics of the unit, do NOT try to change any values in it.
 float getExperience()
          How experienced the unit is (0.0f-1.0f)
 int getGroup()
          Returns the group a unit belongs to, -1 if none
 float getHealth()
          The unit's current health
 int getLastUserOrderFrame()
          Number of the last frame this unit received an order from a player.
 int getLineage()
          The unit's origin lies in this team.
 float getMaxHealth()
          The unit's max health
 float getMaxRange()
          The furthest any weapon of the unit can fire
 float getMaxSpeed()
          The unit's max speed
 List<ModParam> getModParams()
          This is a set of parameters that is initialized in CreateUnitRulesParams() and may change during the game.
 AIFloat3 getPos()
           
 float getPower()
          Indicate the relative power of the unit, used for experience calulations etc.
 float getResourceMake(Resource c_resourceId)
           
 float getResourceUse(Resource c_resourceId)
           
 float getSpeed()
           
 int getStockpile()
           
 int getStockpileQueued()
           
 SupportedCommand getSupportedCommand()
           
 int getTeam()
           
 int getUnitId()
           
 int hashCode()
           
 boolean isActivated()
           
 boolean isBeingBuilt()
          Returns true if the unit is currently being built
 boolean isCloaked()
           
 boolean isNeutral()
           
 boolean isParalyzed()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getUnitId

public int getUnitId()

compareTo

public int compareTo(Unit other)
Specified by:
compareTo in interface Comparable<Unit>

equals

public boolean equals(Object otherObject)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

getDef

public UnitDef getDef()
Returns the unit's unitdef struct from which you can read all the statistics of the unit, do NOT try to change any values in it.


getTeam

public int getTeam()

getAllyTeam

public int getAllyTeam()

getLineage

public int getLineage()
The unit's origin lies in this team. example: It was created by a factory that was created by a builder from a factory built by a commander of this team. It does not matter at all, to which team the commander/builder/factories were shared. Only capturing can break the chain.


getAiHint

public int getAiHint()
Indicates the units main function. This can be used as help for (skirmish) AIs. example: A unit can shoot, build and transport other units. To human players, it is obvious that transportation is the units main function, as it can transport a lot of units, but has only weak build- and fire-power. Instead of letting the AI developers write complex algorithms to find out the same, mod developers can set this value.

Returns:
0: ??? 1: ??? 2: ??? ...

getStockpile

public int getStockpile()

getStockpileQueued

public int getStockpileQueued()

getCurrentFuel

public float getCurrentFuel()

getMaxSpeed

public float getMaxSpeed()
The unit's max speed


getMaxRange

public float getMaxRange()
The furthest any weapon of the unit can fire


getMaxHealth

public float getMaxHealth()
The unit's max health


getExperience

public float getExperience()
How experienced the unit is (0.0f-1.0f)


getGroup

public int getGroup()
Returns the group a unit belongs to, -1 if none


getHealth

public float getHealth()
The unit's current health


getSpeed

public float getSpeed()

getPower

public float getPower()
Indicate the relative power of the unit, used for experience calulations etc. This is sort of the measure of the units overall power.


getResourceUse

public float getResourceUse(Resource c_resourceId)

getResourceMake

public float getResourceMake(Resource c_resourceId)

getPos

public AIFloat3 getPos()

isActivated

public boolean isActivated()

isBeingBuilt

public boolean isBeingBuilt()
Returns true if the unit is currently being built


isCloaked

public boolean isCloaked()

isParalyzed

public boolean isParalyzed()

isNeutral

public boolean isNeutral()

getBuildingFacing

public int getBuildingFacing()
Returns the unit's build facing (0-3)


getLastUserOrderFrame

public int getLastUserOrderFrame()
Number of the last frame this unit received an order from a player.


getModParams

public List<ModParam> getModParams()
This is a set of parameters that is initialized in CreateUnitRulesParams() and may change during the game. Each parameter is uniquely identified only by its id (which is the index in the vector). Parameters may or may not have a name.


getCurrentCommands

public List<CurrentCommand> getCurrentCommands()

getSupportedCommand

public SupportedCommand getSupportedCommand()