Class AttackPhaseDisplay

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, BoardViewListener, KeyBindReceiver, GameListener, IPreferenceChangeListener, Distractable
Direct Known Subclasses:
FiringDisplay, InfantryVsInfantryCombatDisplay, PhysicalDisplay, PreEndDeclarationsDisplay, TargetingPhaseDisplay

public abstract class AttackPhaseDisplay extends ActionPhaseDisplay
See Also:
  • Field Details

  • Constructor Details

    • AttackPhaseDisplay

      protected AttackPhaseDisplay(ClientGUI cg)
  • Method Details

    • getDoneButtonLabel

      protected abstract String getDoneButtonLabel()
      called by updateDonePanel to populate the label text of the Done button. Usually wraps a call to Messages.getString(...Fire) but can be extended to add more details.
      Returns:
      text for label
    • getSkipTurnButtonLabel

      protected abstract String getSkipTurnButtonLabel()
      called by updateDonePanel to populate the label text of the NoAction button. Usually wraps a call to Messages.getString(...Skip) but can be extended to add more details.
      Returns:
      text for label
    • updateDonePanel

      protected void updateDonePanel()
      Description copied from class: ActionPhaseDisplay
      called to reset, show, hide and relabel the Done panel buttons. Override to change button labels and states, being sure to call ActionPhaseDisplay.updateDonePanelButtons(String, String, boolean, List) to set the button labels and states
      Specified by:
      updateDonePanel in class ActionPhaseDisplay
    • removeAttack

      protected void removeAttack(EntityAction o)
    • removeAllAttacks

      protected void removeAllAttacks()
      removes all elements from the local temporary attack list
    • addAttack

      protected void addAttack(int index, EntityAction entityAction)
      add an attack at the given index to the local temporary attack list
    • addAttack

      protected void addAttack(EntityAction entityAction)
      add an attack to the end of the local temporary attack list
    • clearAttacks

      protected void clearAttacks()
      Clears the pending attack queue and resets any declared facing. The default is a no-op; displays that hold a pending attack list override this so flipDirectionalMount() can rebuild the queue.
    • refreshTargetAfterMountChange

      protected void refreshTargetAfterMountChange()
      Recomputes the to-hit / target information after a mount-facing change. The default is a no-op; attack displays override this to refresh their target panel (they cannot share a single updateTarget() because its visibility differs across the display family).
    • setFlipMountEnabled

      protected void setFlipMountEnabled(boolean enabled)
      Enables or disables the Flip Mount button. The default is a no-op; displays that provide the button override this to toggle their own button and menu item.
      Parameters:
      enabled - whether the Flip Mount button should be enabled
    • setRotateTurretEnabled

      protected void setRotateTurretEnabled(boolean enabled)
      Enables or disables the Rotate Turret button. The default is a no-op; displays that provide the button override this to toggle their own button and menu item.
      Parameters:
      enabled - whether the Rotate Turret button should be enabled
    • setRotateRearTurretEnabled

      protected void setRotateRearTurretEnabled(boolean enabled)
      Enables or disables the second Rotate Turret button (the rear turret of a dual-turret vehicle). The default is a no-op; displays that provide the button override this to toggle their own button and menu item.
      Parameters:
      enabled - whether the rear-turret rotate button should be enabled
    • setRotateTurretLabel

      protected void setRotateTurretLabel(boolean dualTurretTank)
      Relabels the Rotate Turret button for the selected unit: on a dual-turret vehicle it reads "Rotate Fr. Turret" (the second button covers the rear turret); on every other unit it reads the plain "Rotate Turret". The default is a no-op; displays that provide the button override this.
      Parameters:
      dualTurretTank - true when the selected unit is a dual-turret vehicle
    • flipDirectionalMount

      public void flipDirectionalMount()
      Flips the selected weapon's 2-point Directional Torso Mount between the front and rear arc (BMM p.83). A Directional Torso Mount is a single mount holding every directional-mount weapon in one torso location, so the whole mount flips together. The facing is queued as a DirectionalMountFacingAction (applied by the server when the turn is committed) rather than sent immediately, so it composes with a torso twist or arms flip declared in the same turn and can still be cleared.
    • pendingDirectionalMountFacings

      protected List<DirectionalMountFacingAction> pendingDirectionalMountFacings(int excludedLocation)
      Collects the pending Directional Torso Mount facing actions (BMM p.83) so they can be re-added after a clearAttacks() that is only meant to rebuild the weapon attacks (a torso twist or another mount flip). The mount arc is a persistent, separately-declared state, not a weapon attack, so it must survive the clear.
      Parameters:
      excludedLocation - a location to omit because the caller re-declares it itself, or NO_EXCLUDED_LOCATION to keep all
      Returns:
      the pending mount facing actions to preserve
    • updateFlipMount

      protected void updateFlipMount()
      Enables the flip-mount button only when the selected weapon is in a 2-point Directional Torso Mount whose arc can still be changed - i.e. it is a directional mount, is not a 360-degree turret (which has no front/rear to flip), has not been locked by damage, and has not already changed facing in an earlier phase this turn (once per turn, like a torso twist). Logs the decision for any directional-mount unit to aid playtesting.
    • rotateSelectedMount

      public void rotateSelectedMount()
      Opens the facing dialog for the selected weapon's rotatable mount - a Mek shoulder/head/quad turret, a vehicle dual turret, or a Directional Torso Mount (issues #1040, #6518) - so turrets can be aimed with an action button, not only the right-click menu.
    • rotateRearTurret

      public void rotateRearTurret()
      Opens the facing dialog for a dual-turret vehicle's rear (main) turret - the "Rotate Rr. Turret" button. The rear turret follows the unit's secondary facing, so the rotation is declared as a turret twist.
    • declareSecondaryFacing

      protected void declareSecondaryFacing(int facing)
      Declares a change of the unit's secondary facing (a torso/turret twist) to the given facing, as if the player had used the Twist control. The default is a no-op; attack displays override this with their twist-declaration path (which clears pending attacks like any twist). Used by rotateSelectedMount() for vehicle main turrets, whose rotation is a turret twist.
      Parameters:
      facing - the absolute facing (0-5) to twist to
    • updateRotateTurret

      protected void updateRotateTurret()
      Enables the rotate-turret buttons. Vehicle turrets rotate as a whole (independent of the selected weapon): a dual-turret vehicle gets both buttons - front turret on the first, rear turret on the second - while a single-turret vehicle gets only the first, for its main turret. On Meks the first button follows the selected weapon's rotatable mount (a Mek turret or a 360-degree Directional Torso Mount) as long as its facing can still be changed.