Package megamek.client.bot.princess
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 rangeeffectiveRange- the furthest range at which it still lands at least half its peak damage
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
FieldsModifier and TypeFieldDescriptionstatic final SupportEnvelopeA unit with nothing to shoot supports nobody at any distance. -
Constructor Summary
ConstructorsConstructorDescriptionSupportEnvelope(int peakRange, int effectiveRange) Creates an instance of aSupportEnveloperecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theeffectiveRangerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static SupportEnvelopeComputes a unit's supporting range from its weapons and its own pilot's gunnery.intReturns the value of thepeakRangerecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
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 aSupportEnveloperecord class.- Parameters:
peakRange- the value for thepeakRangerecord componenteffectiveRange- the value for theeffectiveRangerecord component
-
-
Method Details
-
of
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
WEAPONLESSif it has no weapons
-
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. -
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. -
equals
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 '=='. -
peakRange
public int peakRange()Returns the value of thepeakRangerecord component.- Returns:
- the value of the
peakRangerecord component
-
effectiveRange
public int effectiveRange()Returns the value of theeffectiveRangerecord component.- Returns:
- the value of the
effectiveRangerecord component
-