Package megamek.common.compute.damage
Record Class PreExistingDamageResult
java.lang.Object
java.lang.Record
megamek.common.compute.damage.PreExistingDamageResult
- Record Components:
armor- remaining front armor by locationrearArmor- remaining rear armor by location (only meaningful where the unit has rear armor)internal- remaining internal structure by location (unused for fighters)structuralIntegrity- remaining structural integrity (fighters only; 0 for other units)critAssignments- the critical hits rolled, one entry per hit
public record PreExistingDamageResult(int[] armor, int[] rearArmor, int[] internal, int structuralIntegrity, List<CritAssignment> critAssignments)
extends Record
The outcome of one pre-existing damage simulation (First Succession War, p.144). All values are absolute remaining
values (not deltas), indexed by unit location, ready to be written into the unit editor dialog's controls.
Locations the unit does not use keep the value they had when the simulation started. For fighters, per-location
internal structure is unused and structuralIntegrity carries the remaining SI instead.
This record is transient dialog data and is never serialized or stored in game state, so it needs no
SerializationHelper converter.
-
Constructor Summary
ConstructorsConstructorDescriptionPreExistingDamageResult(int[] armor, int[] rearArmor, int[] internal, int structuralIntegrity, List<CritAssignment> critAssignments) Creates an instance of aPreExistingDamageResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionint[]armor()Returns the value of thearmorrecord component.Returns the value of thecritAssignmentsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.int[]internal()Returns the value of theinternalrecord component.int[]Returns the value of therearArmorrecord component.intReturns the value of thestructuralIntegrityrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PreExistingDamageResult
public PreExistingDamageResult(int[] armor, int[] rearArmor, int[] internal, int structuralIntegrity, List<CritAssignment> critAssignments) Creates an instance of aPreExistingDamageResultrecord class.- Parameters:
armor- the value for thearmorrecord componentrearArmor- the value for therearArmorrecord componentinternal- the value for theinternalrecord componentstructuralIntegrity- the value for thestructuralIntegrityrecord componentcritAssignments- the value for thecritAssignmentsrecord component
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
armor
public int[] armor()Returns the value of thearmorrecord component.- Returns:
- the value of the
armorrecord component
-
rearArmor
public int[] rearArmor()Returns the value of therearArmorrecord component.- Returns:
- the value of the
rearArmorrecord component
-
internal
public int[] internal()Returns the value of theinternalrecord component.- Returns:
- the value of the
internalrecord component
-
structuralIntegrity
public int structuralIntegrity()Returns the value of thestructuralIntegrityrecord component.- Returns:
- the value of the
structuralIntegrityrecord component
-
critAssignments
Returns the value of thecritAssignmentsrecord component.- Returns:
- the value of the
critAssignmentsrecord component
-