DurativePlanner¶
-
public class
DurativePlanner
implements Serializable¶ An implementation of basic planning methods extended to the case of actions that take time to act.
Methods¶
calculateAttackDuration¶
calculateDepositDuration¶
calculateGatherDuration¶
-
public static int
calculateGatherDuration
(Unit u, ResourceNode target)¶ A simple calculation for determining the amount
Parameters: - u –
- target –
calculateMaxMoveDuration¶
calculateMoveDuration¶
calculateProductionDuration¶
getDirections¶
-
public MovePlan
getDirections
(Unit u, int startingx, int startingy, int endingx, int endingy, int tolerancedistance, boolean isFirstMove)¶ Uses A* to calculate the directions to arrive at the specified location. Returns a path if and only if there is a valid path. When you wish upon A* ...
Parameters: - u – The unit being moved. Necessary for calculating durative actions
- startingx –
- startingy –
- endingx –
- endingy –
- tolerancedistance – The distance at which to stop trying to seek (IE, 0 is on top of it, 1 is next to it, etc) Note that the distance should count diagonals as 1 dist
- isFirstMove – Whether this is the first move in a larger plan (and thus that the current progress toward a move should be included)
Returns: A move plan with the success, path, and final x and y coordinates.
planAttack¶
-
public LinkedList<Action>
planAttack
(Unit actor, Unit target)¶ Uses
getDirections(StateView,int,int,int,int,int,boolean)
to get directions to the specified place andplanMove(Unit,LinkedList)
to follow them. then adds an attack command.Parameters: - actor –
- target –
Returns: A series of actions that move the actor to the target and attacks the target
planAttack¶
-
public LinkedList<Action>
planAttack
(int actor, int target)¶
planBuild¶
-
public LinkedList<Action>
planBuild
(Unit actor, int targetX, int targetY, UnitTemplate template)¶ Plan a compound build action in which the unit moves to a target and then
Parameters: - actor –
- targetX –
- targetY –
- template –
planBuild¶
-
public LinkedList<Action>
planBuild
(int actor, int targetX, int targetY, int template)¶
planDeposit¶
-
public LinkedList<Action>
planDeposit
(Unit actor, Unit target)¶ Plan a compound deposit action in which the unit moves next to the target town hall and then deposits into it
Parameters: - actor –
- target –
- distance –
planDeposit¶
-
public LinkedList<Action>
planDeposit
(int actor, int target)¶
planFail¶
-
public LinkedList<Action>
planFail
(int actor)¶
planGather¶
-
public LinkedList<Action>
planGather
(Unit actor, ResourceNode target)¶ Plan a compound gather action in which the unit moves next to the target node and then gathers from it.
Parameters: - actor –
- target –
Returns: A series of actions that move the actor to the target and gathers from the target
planGather¶
-
public LinkedList<Action>
planGather
(int actor, int target)¶
planMove¶
-
public LinkedList<Action>
planMove
(Unit actor, int x, int y)¶ Uses
getDirections(int,int,int,int,int,boolean)
to get directions to the specified place andplanMove(Unit,LinkedList)
to follow them.Parameters: - actor –
- x –
- y –
planMove¶
-
public LinkedList<Action>
planMove
(int i, int x, int y)¶
planPermanentFail¶
-
public LinkedList<Action>
planPermanentFail
(int actor)¶
planProduce¶
-
public LinkedList<Action>
planProduce
(int actor, int template)¶