Class RulesMovement

java.lang.Object
megamek.common.rules.RulesMovement
Direct Known Subclasses:
CoreRulesMovement, TWRulesMovement

public abstract class RulesMovement extends Object
  • Constructor Details

    • RulesMovement

      public RulesMovement()
  • Method Details

    • skidEnabled

      public abstract boolean skidEnabled()
      Can units skid?
      Returns:
      true if skidding is enabled
    • cannotRunInWater

      public abstract boolean cannotRunInWater(EntityMovementMode movementMode, boolean amphibious)
      Can a unit use run / flank MP in water.
      Parameters:
      movementMode - the movement mode of the unit
      amphibious - 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

      public abstract boolean enableBackwardsElevationChange(boolean toBackwardsElevation, Entity entity)
      Can you move backwards up elevation?
      Parameters:
      toBackwardsElevation - true if moving backwards up elevation
      entity - 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 legs
      walkMP - the walking movement points
      runMP - the running movement points
      isQuad - is the unit a quad
      Returns:
      the effective running movement points
    • reduceMaxElevation

      public abstract boolean reduceMaxElevation(Mek mek)
      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 movement
      movementMode - 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 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
    • 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 domino
      entity - entity being displaced
      movePath - the movePath of the step
      forwards - 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 fall
      hitHeight - 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 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 abstract 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?
      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