Class CollapseWarning

java.lang.Object
megamek.client.ui.clientGUI.boardview.CollapseWarning

public final class CollapseWarning extends Object
Construction Factor Warning Logic. Handles events, help methods and logic related to CF Warning in a way that can be unit tested and encapsulated from BoardView and ClientGUI and other actors.
  • Method Details

    • handleActionPerformed

      public static void handleActionPerformed()
    • isCFWarningPhase

      public static boolean isCFWarningPhase(GamePhase gp)
    • shouldShow

      public static boolean shouldShow(GamePhase gp, boolean isEnabled)
    • findCFWarningsMovement

      public static List<BoardLocation> findCFWarningsMovement(Game game, Entity entity)
    • findCFWarningsMovement

      public static List<Coords> findCFWarningsMovement(Game game, Entity entity, Board board)
      For the provided entity, find all hexes within movement range with buildings that would collapse if entered or landed upon. This is used by the MovementDisplay class.
      Parameters:
      game - Game provided by the phase display class
      entity - Entity currently selected in the movement phase.
      board - Board board object with building data.
      Returns:
      returns a list of Coords that where warning flags should be placed.
    • entityTypeIsInWhiteList

      public static boolean entityTypeIsInWhiteList(Entity entity)
    • findCFWarningsDeployment

      public static List<BoardLocation> findCFWarningsDeployment(Game game, Entity entity)
    • findCFWarningsDeployment

      public static List<Coords> findCFWarningsDeployment(Game game, Entity entity, Board board)
      Looks for all building locations in a legal deploy zone that would collapse if the currently selected entity would deploy there. This is used by DeploymentDisplay to render a warning sprite on danger hexes.
      Parameters:
      game - Game provided by the phase display class
      entity - Entity currently selected in the movement phase.
      board - Board board object with building data.
      Returns:
      returns a list of Coords that where warning flags should be placed.
    • calculateTotalTonnage

      public static double calculateTotalTonnage(Game g, Entity selected, Coords c)
    • isEntityPartOfWeight

      protected static boolean isEntityPartOfWeight(Entity selected, Entity inHex)