Record Class SupportEnvelope

java.lang.Object
java.lang.Record
megamek.client.bot.princess.SupportEnvelope
Record Components:
peakRange - the range at which the unit's expected damage peaks - its optimum weapon range
effectiveRange - the furthest range at which it still lands at least half its peak damage

public record SupportEnvelope(int peakRange, int effectiveRange) extends Record
How far a unit can usefully reach, in hexes: the single definition of "supporting range" for the Mutual Support doctrine.

Both halves of the doctrine ask the same question of a unit and must get the same answer. Deployment uses it to decide how far apart a force may form up (MutualSupportDeployment); movement uses it to decide when a unit has drifted out of support and when it is covering a friend (MutualSupportPathRanker). Two definitions would let a force deploy into a formation its own movement code then judges to be broken.

Both figures come from DamageProfile, the same expected-damage model behind the lobby's unit analysis, so a unit's supporting range is whatever its actual weapons say it is rather than a guess from its class or role.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final SupportEnvelope
    A unit with nothing to shoot supports nobody at any distance.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SupportEnvelope(int peakRange, int effectiveRange)
    Creates an instance of a SupportEnvelope record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the effectiveRange record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    of(Entity entity)
    Computes a unit's supporting range from its weapons and its own pilot's gunnery.
    int
    Returns the value of the peakRange record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • WEAPONLESS

      public static final SupportEnvelope WEAPONLESS
      A unit with nothing to shoot supports nobody at any distance.
  • Constructor Details

    • SupportEnvelope

      public SupportEnvelope(int peakRange, int effectiveRange)
      Creates an instance of a SupportEnvelope record class.
      Parameters:
      peakRange - the value for the peakRange record component
      effectiveRange - the value for the effectiveRange record component
  • Method Details

    • of

      public static SupportEnvelope of(Entity entity)
      Computes a unit's supporting range from its weapons and its own pilot's gunnery.

      Callers evaluating many units in a turn should cache the result; this walks the unit's whole weapon list.

      Parameters:
      entity - the unit to measure
      Returns:
      its engagement envelope, or WEAPONLESS if it has no weapons
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • peakRange

      public int peakRange()
      Returns the value of the peakRange record component.
      Returns:
      the value of the peakRange record component
    • effectiveRange

      public int effectiveRange()
      Returns the value of the effectiveRange record component.
      Returns:
      the value of the effectiveRange record component