Class SBFMovePath
java.lang.Object
megamek.common.strategicBattleSystems.SBFMovePath
- All Implemented Interfaces:
Serializable,EntityAction
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStep(SBFMoveStep step) static SBFMovePathcreateMovePathDeep(SBFMovePath original) Deprecated, for removal: This API element is subject to removal in a future version.static SBFMovePathcreateMovePathShallow(SBFMovePath original) Creates a new move path that is a copy of the given original.intintReturns the number of hexes movedintintgetMpUpTo(SBFMoveStep step) Returns the number of mp used up to and including the given step.intgetSteps()booleanisEndStep(SBFMoveStep step) booleanvoidRestores the move path after serialization.voidsetJumpUsed(int jumpUsed) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface megamek.common.actions.EntityAction
toAccessibilityDescription, toSummaryString
-
Constructor Details
-
SBFMovePath
-
-
Method Details
-
createMovePathShallow
Creates a new move path that is a copy of the given original. Note that the steps are not copied, i.e. the step list is only a shallow copy!- Parameters:
original- The move path to copy- Returns:
- A new move path that is equal to the original
-
createMovePathDeep
@Deprecated(since="0.51.0", forRemoval=true) public static SBFMovePath createMovePathDeep(SBFMovePath original) Deprecated, for removal: This API element is subject to removal in a future version.Creates a new move path that is a copy of the given original. Note that the steps are copied, i.e. the step list is a deep copy. The returned move path is completely independent of the original.- Parameters:
original- The move path to copy- Returns:
- A new move path that is equal to the original
-
getEntityId
public int getEntityId()- Specified by:
getEntityIdin interfaceEntityAction- Returns:
- The ID of the acting game unit. Note that when an entity is destroyed, it may no longer be available from
Game.getEntity(int)but rather only fromGame.getOutOfGameEntity(int)orGame.getEntityFromAllSources(int). As this can happen in the middle of resolving complicated situations in the GameManager, this is a potential cause for bugs.
Note that this is not restricted toEntity; it can be used for allInGameObjects that are handled in the game.
-
getMpUsed
public int getMpUsed() -
addStep
-
getLastStep
-
getLastPosition
-
isIllegal
public boolean isIllegal() -
restore
Restores the move path after serialization. This is unnecessary unless thecompile()method is used.- Parameters:
game- The SBFGame
-
getHexesMoved
public int getHexesMoved()Returns the number of hexes moved -
toString
-
getSteps
- Returns:
- The steps of this move path as an unmodifiable list.
-
isEndStep
-
getMpUpTo
Returns the number of mp used up to and including the given step. Returns -1 if the step is not part of this move path.- Parameters:
step- The last step to include in the cost- Returns:
- The total mp up to the given step
-
setJumpUsed
public void setJumpUsed(int jumpUsed) -
getJumpUsed
public int getJumpUsed()
-