Class DirectionalTorsoMountRules

java.lang.Object
megamek.common.units.DirectionalTorsoMountRules

public final class DirectionalTorsoMountRules extends Object
Static helpers for the Directional Torso Mount quirk (BMM p.83). Keeps the server-side resolution in one focused place rather than expanding the damage manager; callers invoke a single method.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    applyMountFacing(Mek entity, int weaponNumber, int facing)
    Applies a player-declared Directional Torso Mount arc change (BMM p.83).
    rollLockFromLocationDamage(Mek mek, int location)
    Resolves the Directional Torso Mount lock check after a Mek location takes a hit (BMM p.83): if the location holds at least one weapon in a Directional Torso Mount whose arc is not already locked, rolls 2D6 and, on a result of 9 or higher, destroys the mount's rotation mechanism - locking every Directional Torso Mount weapon in that location into its current arc.
    static int
    setMountFacing(Entity entity, int location, int facing)
    Sets the facing offset of every unlocked Directional Torso Mount weapon in a single location.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • rollLockFromLocationDamage

      public static Optional<Report> rollLockFromLocationDamage(Mek mek, int location)
      Resolves the Directional Torso Mount lock check after a Mek location takes a hit (BMM p.83): if the location holds at least one weapon in a Directional Torso Mount whose arc is not already locked, rolls 2D6 and, on a result of 9 or higher, destroys the mount's rotation mechanism - locking every Directional Torso Mount weapon in that location into its current arc. The weapons remain able to fire. Other results, and locations with no (still-rotatable) directional mount, leave the mounts untouched.
      Parameters:
      mek - the Mek whose location took a hit
      location - the location that took a hit
      Returns:
      a Report for the check when the location holds a still-rotatable directional mount - describing either the destroyed/locked mount (9+) or that the mount held (under 9), so the player always sees the roll; empty when the location has no (still-rotatable) directional mount and no roll is made
    • applyMountFacing

      public static void applyMountFacing(Mek entity, int weaponNumber, int facing)
      Applies a player-declared Directional Torso Mount arc change (BMM p.83). A Directional Torso Mount is a single mount that holds every directional-mount weapon in one torso location, so the change is applied to the whole mount: the referenced weapon and every other Directional Torso Mount weapon sharing its location rotate together. The change is ignored - with a logged reason - if the weapon is not in a directional mount or the mount has been locked by damage.
      Parameters:
      entity - the acting entity
      weaponNumber - the equipment number of any weapon in the mount whose arc is being set
      facing - the mount facing offset to apply (0-5; a 2-point mount accepts only 0/front or 3/rear)
    • setMountFacing

      public static int setMountFacing(Entity entity, int location, int facing)
      Sets the facing offset of every unlocked Directional Torso Mount weapon in a single location. All weapons in a Directional Torso Mount share one facing (they occupy the same mount), so this is the shared entry point used by the client controls and the server to keep them in lockstep. A 2-point mount weapon only accepts the front (0) or rear (3) offset; a locked weapon, or one whose facing was already changed in an earlier phase this turn (once per turn, BMM p.83), is left untouched.
      Parameters:
      entity - the unit carrying the mount
      location - the torso location whose Directional Torso Mount is being rotated
      facing - the facing offset to apply (0-5)
      Returns:
      the number of weapons whose facing was updated