Record Class EMPEffectResult

java.lang.Object
java.lang.Record
megamek.common.equipment.EMPEffectResult
Record Components:
effect - The effect type: MMConstants.EMP_EFFECT_NONE, MMConstants.EMP_EFFECT_INTERFERENCE, or MMConstants.EMP_EFFECT_SHUTDOWN
durationTurns - Number of turns the effect lasts (1D6)
rollValue - The 2D6 roll value for the effects table
modifier - Modifier applied to the roll (+2 for drones)

public record EMPEffectResult(int effect, int durationTurns, int rollValue, int modifier) extends Record
Represents the result of an EMP mine effect roll for a unit.

Based on Tactical Operations: Advanced Rules (Experimental).

  • Constructor Details

    • EMPEffectResult

      public EMPEffectResult(int effect, int durationTurns, int rollValue, int modifier)
      Creates an instance of a EMPEffectResult record class.
      Parameters:
      effect - the value for the effect record component
      durationTurns - the value for the durationTurns record component
      rollValue - the value for the rollValue record component
      modifier - the value for the modifier record component
  • Method Details

    • noEffect

      public static EMPEffectResult noEffect(int rollValue, int modifier)
      Creates an EMPEffectResult indicating no effect.
      Parameters:
      rollValue - The roll value that resulted in no effect
      modifier - The modifier that was applied
      Returns:
      An EMPEffectResult with no effect
    • interference

      public static EMPEffectResult interference(int durationTurns, int rollValue, int modifier)
      Creates an EMPEffectResult indicating interference effect.
      Parameters:
      durationTurns - Number of turns the interference lasts
      rollValue - The roll value that resulted in interference
      modifier - The modifier that was applied
      Returns:
      An EMPEffectResult with interference effect
    • shutdown

      public static EMPEffectResult shutdown(int durationTurns, int rollValue, int modifier)
      Creates an EMPEffectResult indicating shutdown effect.
      Parameters:
      durationTurns - Number of turns the shutdown lasts
      rollValue - The roll value that resulted in shutdown
      modifier - The modifier that was applied
      Returns:
      An EMPEffectResult with shutdown effect
    • isNoEffect

      public boolean isNoEffect()
      Returns:
      true if this result indicates no effect
    • isInterference

      public boolean isInterference()
      Returns:
      true if this result indicates interference effect
    • isShutdown

      public boolean isShutdown()
      Returns:
      true if this result indicates shutdown effect
    • 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.
    • effect

      public int effect()
      Returns the value of the effect record component.
      Returns:
      the value of the effect record component
    • durationTurns

      public int durationTurns()
      Returns the value of the durationTurns record component.
      Returns:
      the value of the durationTurns record component
    • rollValue

      public int rollValue()
      Returns the value of the rollValue record component.
      Returns:
      the value of the rollValue record component
    • modifier

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