Record Class MoraleCheckAction
java.lang.Object
java.lang.Record
megamek.common.autoResolve.acar.action.MoraleCheckAction
- All Implemented Interfaces:
EntityAction
,Action
-
Constructor Summary
ConstructorsConstructorDescriptionMoraleCheckAction
(int formationId) Creates an instance of aMoraleCheckAction
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.int
Returns the value of theformationId
record component.int
getHandler
(SimulationManager gameManager) final int
hashCode()
Returns a hash code value for this object.boolean
isDataValid
(SimulationContext context) Validates the data of this action.toString()
Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface megamek.common.actions.EntityAction
toAccessibilityDescription, toSummaryString
-
Constructor Details
-
MoraleCheckAction
public MoraleCheckAction(int formationId) Creates an instance of aMoraleCheckAction
record class.- Parameters:
formationId
- the value for theformationId
record component
-
-
Method Details
-
getEntityId
public int getEntityId()- Specified by:
getEntityId
in interfaceEntityAction
- Returns:
- The ID of the acting game unit. Note that when an entity is destroyed, it may no longer be available from
Game.getEntity(int)
but rather only fromGame.getOutOfGameEntity(int)
orGame.getEntityFromAllSources(int)
. As this can happen in the middle of resolving complicated situations in the GameManager, this is a potential cause for bugs.
Note that this is not restricted toEntity
; it can be used for allInGameObject
s that are handled in the game.
-
getHandler
- Specified by:
getHandler
in interfaceAction
- Returns:
- A handler that will process this action as an extension of the SBFGameManager
-
isDataValid
Description copied from interface:Action
Validates the data of this action. Validation should not check game rule details, only if the action can be handled without running into missing or false data (NullPointerExceptions). Errors should be logged. The action will typically be ignored and removed if validation fails.- Specified by:
isDataValid
in interfaceAction
- Parameters:
context
- The simulation context- Returns:
- true when this action is valid, false otherwise
-
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 '=='. -
formationId
public int formationId()Returns the value of theformationId
record component.- Returns:
- the value of the
formationId
record component
-