Class TWRulesMovement

java.lang.Object
megamek.common.rules.RulesMovement
megamek.common.rules.totalwarfare.TWRulesMovement

public class TWRulesMovement extends RulesMovement
  • Constructor Details

    • TWRulesMovement

      public TWRulesMovement()
  • Method Details

    • skidEnabled

      public boolean skidEnabled()
      Units can skid
      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. Vehicles and 'Meks cannot
      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
    • getUnderwaterMPCost

      public int getUnderwaterMPCost()
      What is the MP cost of moving into a water hex that is fully submerged. The cost is 3MP
      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 only if tacops rule
      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, no unless TO.
      Specified by:
      cumulativeLegDamage in class RulesMovement
      Parameters:
      bTOLegDamage - true if TO leg damage is enabled
      Returns:
      true if leg damage is cumulative
    • checkMPZeroCauseImmobile

      public boolean checkMPZeroCauseImmobile(int walkMP)
      Does 0 MP cause immobile? Only unconscious, shut down, or leg destruction causes immobile
      Overrides:
      checkMPZeroCauseImmobile in class RulesMovement
      Parameters:
      walkMP - the walking movement points
      Returns:
      true if 0 MP causes immobile status
    • getMekRunMP

      public int getMekRunMP(int badLegs, int walkMP, int runMP, boolean isQuad)
      What is our Running MP? Lost a leg? No running
      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
    • isMoveIntoWaterDangerous

      public boolean isMoveIntoWaterDangerous(EntityMovementType movementType, EntityMovementMode movementMode)
      Moving into water always triggers PSR danger
      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
    • reduceMaxElevation

      public boolean reduceMaxElevation(Mek mek)
      Can it change more than 1 level when missing a leg? TW doesn't care
      Specified by:
      reduceMaxElevation in class RulesMovement
      Parameters:
      mek - the Mek to check
      Returns:
      true if maximum elevation can be reduced
    • dominoEffectMovementCriteria

      public boolean dominoEffectMovementCriteria(int direction, Entity entity, MovePath stepForward, MovePath stepBackwards, Entity violation)
      What are the criteria to allow for domino effect changes BMM p 56
      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
    • getDominoDisplacementCostsMP

      public boolean getDominoDisplacementCostsMP()
      Domino displacement costs MP, so return true
      Specified by:
      getDominoDisplacementCostsMP in class RulesMovement
      Returns:
      false if there is no cost, true if there is
    • isDominoMoveLegal

      public 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 Dominos
      Specified by:
      isDominoMoveLegal in class RulesMovement
      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 int getAccidentalFallElevation(int fallElevation, int hitHeight)
      Do we change the accidental fall elevation? No.
      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? Use a distribution and find the first valid hex we can displace into
      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?
      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