Interface ActionHandler

All Superinterfaces:
SimulationManagerHelper
All Known Implementing Classes:
AbstractActionHandler, MoraleCheckActionHandler, MoveActionHandler, MoveToCoverActionHandler, RecoveringNerveActionHandler, StandardUnitAttackHandler, WithdrawActionHandler

public interface ActionHandler extends SimulationManagerHelper
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    void
    Executes the action Here I use "orElseThrow" in most optionals inside the implementations because those optionals were already checked before in the Action#isDataValid(Object) call, and if any of them that should not be empty is empty then it is checked first in the action itself.
     
    default void
    Handles the action, e.g.
    default boolean
     
    boolean
    If it returns true, it must be removed from the list of active handlers (handling this action is finished entirely).
    void
     

    Methods inherited from interface megamek.common.autoResolve.acar.manager.SimulationManagerHelper

    game, simulationManager
  • Method Details

    • cares

      boolean cares()
      Returns:
      True when this handler should be called at the present state of the SBFGame (e.g. the phase). In that case, handle() should be called.
    • handle

      default void handle()
      Handles the action, e.g. attack with everything that's necessary, such as adding a report and sending changes to the Clients. When the handler has finished handling the action and is no longer needed, it must call setFinished() to mark itself as a candidate for removal.
    • isActionValid

      default boolean isActionValid()
    • setFinished

      void setFinished()
    • execute

      void execute()
      Executes the action Here I use "orElseThrow" in most optionals inside the implementations because those optionals were already checked before in the Action#isDataValid(Object) call, and if any of them that should not be empty is empty then it is checked first in the action itself.
    • isFinished

      boolean isFinished()
      If it returns true, it must be removed from the list of active handlers (handling this action is finished entirely). If it returns false, it must remain.
      Returns:
      False when this handler must remain active after doing its present handling, true otherwise
    • getAction

      Action getAction()
      Returns:
      The EntityAction that this handler is executing.