Package megamek.common.equipment
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, orMMConstants.EMP_EFFECT_SHUTDOWNdurationTurns- Number of turns the effect lasts (1D6)rollValue- The 2D6 roll value for the effects tablemodifier- 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 Summary
ConstructorsConstructorDescriptionEMPEffectResult(int effect, int durationTurns, int rollValue, int modifier) Creates an instance of aEMPEffectResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thedurationTurnsrecord component.inteffect()Returns the value of theeffectrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static EMPEffectResultinterference(int durationTurns, int rollValue, int modifier) Creates an EMPEffectResult indicating interference effect.booleanbooleanbooleanintmodifier()Returns the value of themodifierrecord component.static EMPEffectResultnoEffect(int rollValue, int modifier) Creates an EMPEffectResult indicating no effect.intReturns the value of therollValuerecord component.static EMPEffectResultshutdown(int durationTurns, int rollValue, int modifier) Creates an EMPEffectResult indicating shutdown effect.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
EMPEffectResult
public EMPEffectResult(int effect, int durationTurns, int rollValue, int modifier) Creates an instance of aEMPEffectResultrecord class.- Parameters:
effect- the value for theeffectrecord componentdurationTurns- the value for thedurationTurnsrecord componentrollValue- the value for therollValuerecord componentmodifier- the value for themodifierrecord component
-
-
Method Details
-
noEffect
Creates an EMPEffectResult indicating no effect.- Parameters:
rollValue- The roll value that resulted in no effectmodifier- The modifier that was applied- Returns:
- An EMPEffectResult with no effect
-
interference
Creates an EMPEffectResult indicating interference effect.- Parameters:
durationTurns- Number of turns the interference lastsrollValue- The roll value that resulted in interferencemodifier- The modifier that was applied- Returns:
- An EMPEffectResult with interference effect
-
shutdown
Creates an EMPEffectResult indicating shutdown effect.- Parameters:
durationTurns- Number of turns the shutdown lastsrollValue- The roll value that resulted in shutdownmodifier- 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
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 '=='. -
effect
public int effect()Returns the value of theeffectrecord component.- Returns:
- the value of the
effectrecord component
-
durationTurns
public int durationTurns()Returns the value of thedurationTurnsrecord component.- Returns:
- the value of the
durationTurnsrecord component
-
rollValue
public int rollValue()Returns the value of therollValuerecord component.- Returns:
- the value of the
rollValuerecord component
-
modifier
public int modifier()Returns the value of themodifierrecord component.- Returns:
- the value of the
modifierrecord component
-