Class CoreRulesMovement

java.lang.Object
megamek.common.rules.RulesMovement
megamek.common.rules.core.CoreRulesMovement

public class CoreRulesMovement extends RulesMovement
  • Constructor Details

    • CoreRulesMovement

      public CoreRulesMovement()
  • Method Details

    • skidEnabled

      public boolean skidEnabled()
      Can units skid? No skidding in Core Rules
      Specified by:
      skidEnabled in class RulesMovement
      Returns:
      true if skidding is enabled
    • cannotRunInWater

      public boolean cannotRunInWater(EntityMovementMode movementMode, boolean amphibious)
      Can a unit use run / flank MP in water. Can you run / flank in water? Core p.51
      Specified by:
      cannotRunInWater in class RulesMovement
      Parameters:
      movementMode - the movement mode of the unit
      amphibious - 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:
      getMekRunMP in class RulesMovement
      Parameters:
      badLegs - the number of damaged legs
      walkMP - the walking movement points
      runMP - the running movement points
      isQuad - 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:
      getUnderwaterMPCost in class RulesMovement
      Returns:
      the MP cost for underwater movement
    • enableBackwardsElevationChange

      public boolean enableBackwardsElevationChange(boolean toBackwardsElevation, Entity entity)
      Can you move backwards up elevation? Backwards elevation changes are enabled. Core p.46
      Specified by:
      enableBackwardsElevationChange in class RulesMovement
      Parameters:
      toBackwardsElevation - true if moving backwards up elevation
      entity - 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:
      cumulativeLegDamage in class RulesMovement
      Parameters:
      bTOLegDamage - true if using cumulative leg damage
      Returns:
      true if leg damage is cumulative
    • reduceMaxElevation

      public boolean reduceMaxElevation(Mek mek)
      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:
      reduceMaxElevation in class RulesMovement
      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:
      isMoveIntoWaterDangerous in class RulesMovement
      Parameters:
      movementType - the type of movement
      movementMode - 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:
      dominoEffectMovementCriteria in class RulesMovement
      Parameters:
      direction - The direction the violation is coming from
      entity - the entity causing the domino effect
      stepForward - potential step forwards
      stepBackwards - potential step backwards
      violation - entity being displaced
      Returns:
      True if it can possibly step out of the way
    • isDominoMoveLegal

      public boolean isDominoMoveLegal(int direction, Entity entity, MovePath step, boolean forwards)
      This is a helper for dominoEffectMovementCriteria. It returns true if you can move in that direction Core rules p.114
      Specified by:
      isDominoMoveLegal in class RulesMovement
      Parameters:
      direction - direction of source of domino
      entity - entity being displaced
      step - the movePath of the step
      forwards - 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:
      getDominoDisplacementCostsMP in class RulesMovement
      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:
      getAccidentalFallElevation in class RulesMovement
      Parameters:
      fallElevation - height of the fall
      hitHeight - 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:
      getAccidentalFallDisplacement in class RulesMovement
      Parameters:
      game - the game
      entityId - the entity being displaced
      src - the source hex
      direction - the direction that it is coming from
      range - how far to displace (used for Dropships)
      Returns:
      the destination Coords.
    • getDFAElevation

      public int getDFAElevation(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? Returns the higher of the current hex the attacker is in, or the defender hex Core p.79
      Specified by:
      getDFAElevation in class RulesMovement
      Parameters:
      game - the game object
      attackerId - entityId of the attacker
      targetId - entityId of the defender
      step - 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:
      reduceMovementWithShields in class RulesMovement
      Parameters:
      reduceMPbyShield - what the shield reduction is
      baseMP - what the original walk mp was
      Returns:
      the reduction amount.