Action¶
- 
public class 
Actionimplements Serializable, DeepEquatable¶ The primary class of issued commands. Action is immutable and it’s subtypes should be as well. Contains factory methods for easy construction of valid actions.
Author: The Condor 
Constructors¶
Action¶
- 
public 
Action(int unitId, ActionType type)¶ 
Methods¶
createCompoundAttack¶
createCompoundBuild¶
- 
public static Action 
createCompoundBuild(int unitid, int templateID, int x, int y)¶ This is a LocatedProductionAction, taking as parameters the acting unit’s ID and the ID of the template of the building that you are trying to build, as well as x and y coordinates of where to build it. When executed, it uses repeated PRIMITIVEMOVEs to reach the specified location, then does PRIMITIVEBUILD until the building is done.
Parameters: - unitid – Acting unit’s ID
 - templateID –
 - x –
 - y –
 
createCompoundDeposit¶
- 
public static Action 
createCompoundDeposit(int unitid, int targetid)¶ This is a TargetedAction, taking as parameters the acting unit’s ID and the ID of a town hall to deposit at. When executed, it does PRIMITIVEMOVEs until next to the specified town hall, then performs a PRIMITIVEDEPOSIT on it.
Parameters: - unitid – Acting unit’s ID
 - targetid –
 
createCompoundGather¶
- 
public static Action 
createCompoundGather(int unitid, int targetid)¶ This is a TargetedAction, taking as parameters the acting unit’s ID and the ID of a resource node to gather from. When executed, it does PRIMITIVEMOVEs until next to the specified node, then performs a PRIMITIVEGATHER on it.
Parameters: - unitid – Acting unit’s ID
 - targetid –
 
createCompoundMove¶
createCompoundProduction¶
- 
public static Action 
createCompoundProduction(int unitid, int templateID)¶ This is a ProductionAction, taking as parameters the acting unit’s ID and the ID of the template of the unit or upgrade that you are trying to build. When executed, it does PRIMITIVEPRODUCE until the unit or upgrade is completed.
Parameters: - unitid – Acting unit’s ID
 - templateID –
 
createFail¶
createPermanentFail¶
createPrimitiveAttack¶
createPrimitiveBuild¶
- 
public static Action 
createPrimitiveBuild(int unitid, int templateID)¶ This is a ProductionAction, taking as parameters the acting unit’s ID and the ID of the template of the building that you are trying to build. When executed, it does one turn’s work toward building that kind of building on the spot the unit is at. As all buildings take one turn to build, this is enough to complete it, making a building on the spot and moving the builder off to one side.
Parameters: - unitid – Acting unit’s ID Acting unit’s ID
 - templateID – Template ID of the building type to build
 
createPrimitiveDeposit¶
- 
public static Action 
createPrimitiveDeposit(int unitid, Direction d)¶ This is a DirectedAction, taking as parameters the acting unit’s ID and a direction to attempt to deposit in. When executed, it looks in the specified direction for a town hall, if there is a town hall that you control, it moves resources from the unit’s inventory and gives them to you.
Parameters: - unitid – Acting unit’s ID
 - d –
 
createPrimitiveGather¶
- 
public static Action 
createPrimitiveGather(int unitid, Direction d)¶ This is a DirectedAction, taking as parameters the acting unit’s ID and a direction to attempt to gather in. When executed, it looks in the specified direction for a resource node, if there is a node, it moves resources from the node into the unit’s inventory.
Parameters: - unitid – Acting unit’s ID
 - d –
 
createPrimitiveMove¶
- 
public static Action 
createPrimitiveMove(int unitid, Direction d)¶ This is a DirectedAction, taking as parameters the acting unit’s ID and a direction to attempt to move. When executed, it attempts to move in that direction, failing if another unit is already there.
Parameters: - unitid – Acting unit’s ID
 - d –
 
createPrimitiveProduction¶
- 
public static Action 
createPrimitiveProduction(int unitid, int templateID)¶ This is a ProductionAction, taking as parameters the acting unit’s ID and the ID of the template of the unit or upgrade that you are trying to build. When executed, it does one turn’s work toward the creation of the unit or upgrade specified. As all units and upgrades take one turn to make, this is enough to complete it. If it is a unit being made, the new unit is put to one side after being made.
Parameters: - unitid – Acting unit’s ID
 - templateID –
 
getType¶
- 
public ActionType 
getType()¶ Get the type of action being done
Returns: The ActionType of the action