Package megamek.common.rules
Class RulesMovement
java.lang.Object
megamek.common.rules.RulesMovement
- Direct Known Subclasses:
CoreRulesMovement,TWRulesMovement
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleancannotRunInWater(EntityMovementMode movementMode, boolean amphibious) Can a unit use run / flank MP in water.booleancheckMPZeroCauseImmobile(int walkMP) Does 0 MP cause immobile?abstract booleancumulativeLegDamage(boolean b) Do we add leg damage together, or do hips override.abstract booleandominoEffectMovementCriteria(int direction, Entity entity, MovePath stepForward, MovePath stepBackwards, Entity violation) What are the criteria to allow for domino effect changesabstract booleanenableBackwardsElevationChange(boolean toBackwardsElevation, Entity entity) Can you move backwards up elevation?abstract CoordsgetAccidentalFallDisplacement(Game game, int entityId, Coords src, int direction, int range) How should we displace a unit that had another fall on it accidentally? If null is returned, no valid displacement could be foundabstract intgetAccidentalFallElevation(int fallElevation, int hitHeight) Do we change the accidental fall elevation?abstract intgetDFAElevation(Game game, int attackerId, int targetId, MoveStep step) When performing a DFA, and we move closer to the target, what elevation is the attacker at?abstract booleanThis returns if a domino displacement should cost MPabstract intgetMekRunMP(int badLegs, int walkMP, int runMP, boolean isQuad) What is our Running MP?abstract intWhat is the MP cost of moving into a water hex that is fully submerged.abstract booleanisDominoMoveLegal(int direction, Entity entity, MovePath movePath, boolean forwards) This is a helper for dominoEffectMovementCriteria.abstract booleanisMoveIntoWaterDangerous(EntityMovementType movementType, EntityMovementMode movementMode) Is running into water considered dangerous.abstract booleanreduceMaxElevation(Mek mek) Can it change more than 1 level when missing a leg?abstract booleanCan units skid?
-
Constructor Details
-
RulesMovement
public RulesMovement()
-
-
Method Details
-
skidEnabled
public abstract boolean skidEnabled()Can units skid?- Returns:
- true if skidding is enabled
-
cannotRunInWater
Can a unit use run / flank MP in water.- Parameters:
movementMode- the movement mode of the unitamphibious- true if the unit is amphibious- Returns:
- true if the unit cannot run in water
-
getUnderwaterMPCost
public abstract int getUnderwaterMPCost()What is the MP cost of moving into a water hex that is fully submerged.- Returns:
- the MP cost for underwater movement
-
enableBackwardsElevationChange
Can you move backwards up elevation?- Parameters:
toBackwardsElevation- true if moving backwards up elevationentity- the entity attempting to move- Returns:
- true if backwards elevation change is allowed
-
cumulativeLegDamage
public abstract boolean cumulativeLegDamage(boolean b) Do we add leg damage together, or do hips override.- Parameters:
b- true if using cumulative leg damage- Returns:
- true if leg damage is cumulative
-
checkMPZeroCauseImmobile
public boolean checkMPZeroCauseImmobile(int walkMP) Does 0 MP cause immobile?- Parameters:
walkMP- the walking movement points- Returns:
- true if 0 MP causes immobile status
-
getMekRunMP
public abstract int getMekRunMP(int badLegs, int walkMP, int runMP, boolean isQuad) What is our Running MP?- Parameters:
badLegs- the number of damaged legswalkMP- the walking movement pointsrunMP- the running movement pointsisQuad- is the unit a quad- Returns:
- the effective running movement points
-
reduceMaxElevation
Can it change more than 1 level when missing a leg?- Parameters:
mek- the MEK to check- Returns:
- true if maximum elevation can be reduced by more than 1 level
-
isMoveIntoWaterDangerous
public abstract boolean isMoveIntoWaterDangerous(EntityMovementType movementType, EntityMovementMode movementMode) Is running into water considered dangerous.- Parameters:
movementType- the type of movementmovementMode- the movement mode of the unit- Returns:
- true if moving into water is dangerous
-
dominoEffectMovementCriteria
public abstract boolean dominoEffectMovementCriteria(int direction, Entity entity, MovePath stepForward, MovePath stepBackwards, Entity violation) What are the criteria to allow for domino effect changes- Parameters:
direction- The direction the violation is coming fromentity- the entity causing the domino effectstepForward- potential step forwardsstepBackwards- potential step backwardsviolation- entity being displaced- Returns:
- True if it can possibly step out of the way
-
getDominoDisplacementCostsMP
public abstract boolean getDominoDisplacementCostsMP()This returns if a domino displacement should cost MP- Returns:
- true if there is a cost, false if no cost
-
isDominoMoveLegal
public abstract boolean isDominoMoveLegal(int direction, Entity entity, MovePath movePath, boolean forwards) This is a helper for dominoEffectMovementCriteria. It returns true if you can move in that direction- Parameters:
direction- direction of source of dominoentity- entity being displacedmovePath- the movePath of the stepforwards- is it forwards or backwards- Returns:
-
getAccidentalFallElevation
public abstract int getAccidentalFallElevation(int fallElevation, int hitHeight) Do we change the accidental fall elevation?- Parameters:
fallElevation- height of the fallhitHeight- height of the unit hit- Returns:
- the modified height for damage
-
getAccidentalFallDisplacement
@Nullable public abstract Coords getAccidentalFallDisplacement(Game game, int entityId, Coords src, int direction, int range) How should we displace a unit that had another fall on it accidentally? If null is returned, no valid displacement could be found- Parameters:
game- the gameentityId- the entity being displacedsrc- the source hexdirection- the direction that it is coming fromrange- how far to displace (used for Dropships)- Returns:
- the destination Coords.
-
getDFAElevation
When performing a DFA, and we move closer to the target, what elevation is the attacker at?- Parameters:
game- the game objectattackerId- entityId of the attackertargetId- entityId of the defenderstep- the movement step as accepted.- Returns:
- int, the elevation above the underlying terrain the attacker should be at
-