|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmegamek.common.MovePath
public class MovePath
Holds movement path for an entity.
| Nested Class Summary | |
|---|---|
static class |
MovePath.Key
|
protected static class |
MovePath.MovePathComparator
|
static class |
MovePath.MoveStepType
|
| Field Summary | |
|---|---|
static int |
DEFAULT_PATHFINDER_TIME_LIMIT
|
protected Entity |
entity
|
protected IGame |
game
|
protected java.util.Vector<MoveStep> |
steps
|
| Constructor Summary | |
|---|---|
MovePath(IGame game,
Entity entity)
Generates a new, empty, movement path object. |
|
| Method Summary | |
|---|---|
MovePath |
addManeuver(int manType)
|
MovePath |
addStep(MovePath.MoveStepType type)
Add a new step to the movement path. |
MovePath |
addStep(MovePath.MoveStepType type,
boolean noCost)
|
MovePath |
addStep(MovePath.MoveStepType type,
boolean noCost,
boolean isManeuver)
|
MovePath |
addStep(MovePath.MoveStepType type,
int mineToLay)
|
MovePath |
addStep(MovePath.MoveStepType type,
int recover,
int mineToLay)
|
MovePath |
addStep(MovePath.MoveStepType type,
Minefield mf)
|
MovePath |
addStep(MovePath.MoveStepType type,
Targetable target)
Add a new step to the movement path with the given target. |
MovePath |
addStep(MovePath.MoveStepType type,
java.util.TreeMap<java.lang.Integer,java.util.Vector<java.lang.Integer>> targets)
|
protected MovePath |
addStep(MoveStep step)
Initializes a step as part of this movement path. |
boolean |
canShift()
|
void |
clear()
|
void |
clipToPossible()
Removes impossible steps. |
MovePath |
clone()
Clones this path, will contain a new clone of the steps so that the clone is independent from the original. |
void |
compile(IGame g,
Entity en)
|
boolean |
contains(MovePath.MoveStepType type)
Check for any of the specified type of step in the path |
void |
findPathTo(Coords dest,
MovePath.MoveStepType type)
Extend the current path to the destination Coords. |
static int |
getAdjustedFacing(int facing,
MovePath.MoveStepType movement)
Returns the adjusted facing, given the start facing. |
static MovePath.MoveStepType |
getDirection(int facing,
int destFacing)
Returns the direction (either MovePath.MoveStepType.TURN_LEFT or MoveStepType.TURN_RIGHT) that the destination facing lies in. |
Entity |
getEntity()
|
int |
getFinalAltitude()
get final altitude |
boolean |
getFinalClimbMode()
Returns whether or not a unit would be in climb mode after all the steps |
Coords |
getFinalCoords()
Returns the final coordinates if a mech were to perform all the steps in this path. |
int |
getFinalElevation()
get final elevation relative to the hex. |
int |
getFinalFacing()
Returns the final facing if a mech were to perform all the steps in this path. |
boolean |
getFinalHullDown()
Returns whether or not a unit would end up prone after all of the steps |
int |
getFinalNDown()
|
boolean |
getFinalProne()
Returns whether or not a unit would end up prone after all of the steps |
int[] |
getFinalVectors()
Returns the final vector for advanced movement |
int |
getFinalVelocity()
|
int |
getHexesMoved()
Returns the logical number of hexes moved the path (does not count turns, etc). |
MovePath.Key |
getKey()
|
MoveStep |
getLastStep()
|
EntityMovementType |
getLastStepMovementType()
|
int |
getMpUsed()
Returns the number of MPs used in the path |
java.util.List<MovePath> |
getNextMoves(boolean backward,
boolean forward)
Returns a list of possible moves that result in a facing/position/(jumping|prone) change, special steps (mine clearing and such) must be handled elsewhere. |
Coords |
getSecondFinalPosition(Coords startPos)
|
MoveStep |
getSecondLastStep()
|
MoveStep |
getStep(int index)
|
java.util.Enumeration<MoveStep> |
getSteps()
|
boolean |
hasActiveMASC()
Check for MASC use |
boolean |
isCareful()
|
boolean |
isFlying()
Returns if the entity is flying at the last step of this movepath. |
boolean |
isJumping()
Returns true if the entity is jumping or if it's a flying lam. |
boolean |
isMoveLegal()
|
static MovePath.MoveStepType |
lateralShiftForTurn(MovePath.MoveStepType turn,
MovePath.MoveStepType direction)
Returns the lateral shift that corresponds to the turn direction |
int |
length()
Returns the number of steps in this movement |
void |
printAllSteps()
|
void |
removeLastStep()
|
void |
rotatePathfinder(int destFacing,
boolean isManeuver)
Rotate from the current facing to the destination facing. |
void |
setCareful(boolean b)
|
java.lang.String |
toString()
|
(package private) static MovePath.MoveStepType |
turnForLateralShift(MovePath.MoveStepType shift)
Returns the turn direction that corresponds to the lateral shift |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Vector<MoveStep> steps
protected transient IGame game
protected transient Entity entity
public static final int DEFAULT_PATHFINDER_TIME_LIMIT
| Constructor Detail |
|---|
public MovePath(IGame game,
Entity entity)
| Method Detail |
|---|
public Entity getEntity()
public MovePath.Key getKey()
public java.lang.String toString()
toString in class java.lang.Objectpublic int length()
public MovePath addStep(MovePath.MoveStepType type)
type - the type of movement.
public MovePath addStep(MovePath.MoveStepType type,
Targetable target)
type - the type of movement.target - the Targetable object that is the target of this
step. For example, the enemy being charged.
public MovePath addStep(MovePath.MoveStepType type,
int mineToLay)
public MovePath addStep(MovePath.MoveStepType type,
int recover,
int mineToLay)
public MovePath addStep(MovePath.MoveStepType type,
java.util.TreeMap<java.lang.Integer,java.util.Vector<java.lang.Integer>> targets)
public MovePath addStep(MovePath.MoveStepType type,
boolean noCost)
public MovePath addStep(MovePath.MoveStepType type,
boolean noCost,
boolean isManeuver)
public MovePath addStep(MovePath.MoveStepType type,
Minefield mf)
public MovePath addManeuver(int manType)
public boolean canShift()
protected MovePath addStep(MoveStep step)
step -
public void compile(IGame g,
Entity en)
public void removeLastStep()
public void clear()
public java.util.Enumeration<MoveStep> getSteps()
public MoveStep getStep(int index)
public boolean contains(MovePath.MoveStepType type)
public boolean hasActiveMASC()
public Coords getFinalCoords()
public int getFinalFacing()
public boolean getFinalProne()
public boolean getFinalHullDown()
public boolean getFinalClimbMode()
public int getFinalElevation()
public int getFinalAltitude()
public int getFinalVelocity()
public int getFinalNDown()
public int[] getFinalVectors()
public EntityMovementType getLastStepMovementType()
public MoveStep getLastStep()
public MoveStep getSecondLastStep()
public void printAllSteps()
public void clipToPossible()
public static MovePath.MoveStepType lateralShiftForTurn(MovePath.MoveStepType turn,
MovePath.MoveStepType direction)
static MovePath.MoveStepType turnForLateralShift(MovePath.MoveStepType shift)
public static MovePath.MoveStepType getDirection(int facing,
int destFacing)
public static int getAdjustedFacing(int facing,
MovePath.MoveStepType movement)
public int getMpUsed()
public int getHexesMoved()
public boolean isJumping()
public boolean isFlying()
LandAirMechs, for all other types it will return false.
public void findPathTo(Coords dest,
MovePath.MoveStepType type)
Coords.
dest - the destination Coords of the move.type - the type of movment step required.public boolean isMoveLegal()
public java.util.List<MovePath> getNextMoves(boolean backward,
boolean forward)
public MovePath clone()
clone in class java.lang.Object
public void rotatePathfinder(int destFacing,
boolean isManeuver)
public Coords getSecondFinalPosition(Coords startPos)
public boolean isCareful()
public void setCareful(boolean b)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||