Interface Fortifiable

All Known Implementing Classes:
BipedMek, GunEmplacement, LandAirMek, LargeSupportTank, Mek, MekWithArms, QuadMek, QuadVee, SuperHeavyTank, SupportTank, SupportVTOL, Tank, TripodMek, VTOL

public interface Fortifiable
Shared vehicle-style fieldworks behaviour for units that build a fortified hex over several turns with a bulldozer, backhoe or equivalent (Vehicles and Fieldworks, TO:AUE p.153, Corrected Sixth Printing). A unit progresses through DUG_IN_FORTIFYING_* stages, one per turn, and the hex is fortified once it reaches the final stage; damage taken during a turn holds the progress rather than advancing it.

An implementor supplies the small amount of per-unit state - the dug-in stage counter, the FortifyState damage tracker and its current health signature - and inherits the stage logic as default methods. Both Tank and Mek implement this so the machine lives in one place rather than being duplicated. Infantry is intentionally not a Fortifiable: it interleaves foxhole dig-in stages with fortifying and so uses a different stage encoding.

  • Field Details

    • FORTIFY_LOGGER

      static final MMLogger FORTIFY_LOGGER
    • DUG_IN_NONE

      static final int DUG_IN_NONE
      Not building a fortification.
      See Also:
    • DUG_IN_FORTIFYING_FIRST

      static final int DUG_IN_FORTIFYING_FIRST
      First turn of fieldwork.
      See Also:
    • DUG_IN_FORTIFYING_LAST

      static final int DUG_IN_FORTIFYING_LAST
      Final turn of fieldwork; the hex is fortified at the end of this turn.
      See Also:
  • Method Details

    • getDugIn

      int getDugIn()
      Returns:
      the current dug-in stage (DUG_IN_NONE or one of the DUG_IN_FORTIFYING_* stages).
    • setDugIn

      void setDugIn(int stage)
      Parameters:
      stage - the dug-in stage to set
    • getFortifyState

      FortifyState getFortifyState()
      Returns:
      the per-unit fortification damage tracker.
    • currentFortifyHealthSignature

      int currentFortifyHealthSignature()
      Returns:
      the health signature used to detect damage between fortifying turns: total armor plus internal structure. Any loss between turns lowers this and marks the turn as interrupted.
    • getShortName

      String getShortName()
      Returns:
      the unit's short name, for diagnostic logging.
    • beginFortify

      default void beginFortify()
      Begins the multi-turn fieldwork that raises a fortified hex (TO:AUE p.153, Corrected Sixth Printing). Seeds the damage baseline used to detect an interrupting attack that extends the effort.
    • isFortifying

      default boolean isFortifying()
      Returns:
      true if this unit is partway through building a fortified hex.
    • getFortifyStage

      default int getFortifyStage()
      Returns:
      the current fortification stage (1..getFortifyTotalStages()), or 0 when not fortifying.
    • getFortifyTotalStages

      default int getFortifyTotalStages()
      Returns:
      the number of turns of work a fortified hex takes to complete.
    • isFortifyExtendedThisRound

      default boolean isFortifyExtendedThisRound()
      Returns:
      true if this unit's fortification effort was set back by damage this round. TO:AUE p.153, Corrected Sixth Printing.
    • isFortifyOnFinalStage

      default boolean isFortifyOnFinalStage()
      Returns:
      true if this unit is on the final turn of fieldwork (the hex is fortified at end of turn).
    • cancelFortify

      default void cancelFortify()
      Stops any in-progress fieldwork and clears the damage baseline.
    • advanceFortifyRound

      default void advanceFortifyRound()
      Advances one round of fieldwork, called from newRound: damage taken during the turn holds the progress counter for a turn (TO:AUE p.153, Corrected Sixth Printing); otherwise the stage advances and rolls back to DUG_IN_NONE once it passes the final stage (completion is recognized separately during END-phase resolution).