Package megamek.common.rules.core
Class CoreRulesMovement
java.lang.Object
megamek.common.rules.RulesMovement
megamek.common.rules.core.CoreRulesMovement
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancannotRunInWater(EntityMovementMode movementMode, boolean amphibious) Can a unit use run / flank MP in water.booleancumulativeLegDamage(boolean bTOLegDamage) Do we add leg damage together, or do hips override.booleandominoEffectMovementCriteria(int direction, Entity entity, MovePath stepForward, MovePath stepBackwards, Entity violation) What are the criteria to allow for domino effect changesbooleanenableBackwardsElevationChange(boolean toBackwardsElevation, Entity entity) Can you move backwards up elevation?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 foundintgetAccidentalFallElevation(int fallElevation, int hitHeight) Do we change the accidental fall elevation?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?booleanThis returns if a domino displacement should cost MPintgetMekRunMP(int badLegs, int walkMP, int runMP, boolean isQuad) What is our Running MP?intWhat is the MP cost of moving into a water hex that is fully submerged.booleanisDominoMoveLegal(int direction, Entity entity, MovePath step, boolean forwards) This is a helper for dominoEffectMovementCriteria.booleanisMoveIntoWaterDangerous(EntityMovementType movementType, EntityMovementMode movementMode) Is running into water considered dangerous.booleanreduceMaxElevation(Mek mek) Can it change more than 1 level when missing a leg?intreduceMovementWithShields(int reduceMPbyShield, int baseMP) Core rules max mp reduction by shield is to 1 movement.booleanCan units skid?Methods inherited from class megamek.common.rules.RulesMovement
checkMPZeroCauseImmobile
-
Constructor Details
-
CoreRulesMovement
public CoreRulesMovement()
-
-
Method Details
-
skidEnabled
public boolean skidEnabled()Can units skid? No skidding in Core Rules- Specified by:
skidEnabledin classRulesMovement- Returns:
- true if skidding is enabled
-
cannotRunInWater
Can a unit use run / flank MP in water. Can you run / flank in water? Core p.51- Specified by:
cannotRunInWaterin classRulesMovement- Parameters:
movementMode- the movement mode of the unitamphibious- true if the unit is amphibious- Returns:
- true if the unit cannot run in water
-
getMekRunMP
public int getMekRunMP(int badLegs, int walkMP, int runMP, boolean isQuad) What is our Running MP? Even with a destroyed leg, we can run. Core p.90- Specified by:
getMekRunMPin classRulesMovement- 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
-
getUnderwaterMPCost
public int getUnderwaterMPCost()What is the MP cost of moving into a water hex that is fully submerged. Fully underwater hexes cost 2MP. Core p.51- Specified by:
getUnderwaterMPCostin classRulesMovement- Returns:
- the MP cost for underwater movement
-
enableBackwardsElevationChange
Can you move backwards up elevation? Backwards elevation changes are enabled. Core p.46- Specified by:
enableBackwardsElevationChangein classRulesMovement- Parameters:
toBackwardsElevation- true if moving backwards up elevationentity- the entity attempting to move- Returns:
- true if backwards elevation change is allowed
-
cumulativeLegDamage
public boolean cumulativeLegDamage(boolean bTOLegDamage) Do we add leg damage together, or do hips override. Do we add leg damage together, yes. Core p.98- Specified by:
cumulativeLegDamagein classRulesMovement- Parameters:
bTOLegDamage- true if using cumulative leg damage- Returns:
- true if leg damage is cumulative
-
reduceMaxElevation
Can it change more than 1 level when missing a leg? meks can only change 1 elevation level when leg destroyed. Core p.90, p.238- Specified by:
reduceMaxElevationin classRulesMovement- Parameters:
mek- the MEK to check- Returns:
- true if maximum elevation can be reduced by more than 1 level
-
isMoveIntoWaterDangerous
public boolean isMoveIntoWaterDangerous(EntityMovementType movementType, EntityMovementMode movementMode) Is running into water considered dangerous. Moving into water only triggers danger when running and you can run in water. Core p.45- Specified by:
isMoveIntoWaterDangerousin classRulesMovement- Parameters:
movementType- the type of movementmovementMode- the movement mode of the unit- Returns:
- true if moving into water is dangerous
-
dominoEffectMovementCriteria
public boolean dominoEffectMovementCriteria(int direction, Entity entity, MovePath stepForward, MovePath stepBackwards, Entity violation) What are the criteria to allow for domino effect changes Core rules p.114- Specified by:
dominoEffectMovementCriteriain classRulesMovement- 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
-
isDominoMoveLegal
This is a helper for dominoEffectMovementCriteria. It returns true if you can move in that direction Core rules p.114- Specified by:
isDominoMoveLegalin classRulesMovement- Parameters:
direction- direction of source of dominoentity- entity being displacedstep- the movePath of the stepforwards- is it forwards or backwards- Returns:
-
getDominoDisplacementCostsMP
public boolean getDominoDisplacementCostsMP()This returns if a domino displacement should cost MP No MP cost for domino displacement. Core p.114- Specified by:
getDominoDisplacementCostsMPin classRulesMovement- Returns:
- true if there is a cost, false if no cost
-
getAccidentalFallElevation
public int getAccidentalFallElevation(int fallElevation, int hitHeight) Do we change the accidental fall elevation? Height is minus the height of the unit landed on, Core rules p.116- Specified by:
getAccidentalFallElevationin classRulesMovement- Parameters:
fallElevation- height of the fallhitHeight- height of the unit hit- Returns:
- the modified height for damage
-
getAccidentalFallDisplacement
@Nullable public 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 Clear hexes first, then randomly choose. Core p.116, 114- Specified by:
getAccidentalFallDisplacementin classRulesMovement- 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? Returns the higher of the current hex the attacker is in, or the defender hex Core p.79- Specified by:
getDFAElevationin classRulesMovement- 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
-
reduceMovementWithShields
public int reduceMovementWithShields(int reduceMPbyShield, int baseMP) Core rules max mp reduction by shield is to 1 movement.- Overrides:
reduceMovementWithShieldsin classRulesMovement- Parameters:
reduceMPbyShield- what the shield reduction isbaseMP- what the original walk mp was- Returns:
- the reduction amount.
-