Record Class MoraleCheckAction

java.lang.Object
java.lang.Record
megamek.common.autoResolve.acar.action.MoraleCheckAction
All Implemented Interfaces:
EntityAction, Action

public record MoraleCheckAction(int formationId) extends Record implements Action
  • Constructor Details

    • MoraleCheckAction

      public MoraleCheckAction(int formationId)
      Creates an instance of a MoraleCheckAction record class.
      Parameters:
      formationId - the value for the formationId record component
  • Method Details

    • getEntityId

      public int getEntityId()
      Specified by:
      getEntityId in interface EntityAction
      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 from Game.getOutOfGameEntity(int) or Game.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 to Entity; it can be used for all InGameObjects that are handled in the game.
    • getHandler

      public ActionHandler getHandler(SimulationManager gameManager)
      Specified by:
      getHandler in interface Action
      Returns:
      A handler that will process this action as an extension of the SBFGameManager
    • isDataValid

      public boolean isDataValid(SimulationContext context)
      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 interface Action
      Parameters:
      context - The simulation context
      Returns:
      true when this action is valid, false otherwise
    • toString

      public 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.
    • formationId

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