Class SBFFormation

java.lang.Object
megamek.common.strategicBattleSystems.SBFFormation
All Implemented Interfaces:
Serializable, ASSpecialAbilityCollector, InGameObject, ForceAssignable, BattleForceSUAFormatter, BTObject, Deployable
Direct Known Subclasses:
Formation

Represents a Strategic Battle Force Formation composed of one or more SBF Units.
See Also:
  • Field Details

  • Constructor Details

    • SBFFormation

      public SBFFormation()
  • Method Details

    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getType

      public SBFElementType getType()
    • setType

      public void setType(SBFElementType type)
    • getSize

      public int getSize()
    • setSize

      public void setSize(int size)
    • getTmm

      public int getTmm()
    • setTmm

      public void setTmm(int tmm)
    • getJumpMove

      public int getJumpMove()
    • setJumpMove

      public void setJumpMove(int jumpMove)
    • getTrspMovement

      public int getTrspMovement()
    • setTrspMovement

      public void setTrspMovement(int trspMovement)
    • getMovement

      public int getMovement()
    • setMovement

      public void setMovement(int movement)
    • getTactics

      public int getTactics()
    • setTactics

      public void setTactics(int tactics)
    • getMorale

      public int getMorale()
    • setMorale

      public void setMorale(int morale)
    • getSkill

      public int getSkill()
    • setSkill

      public void setSkill(int skill)
    • getPointValue

      public int getPointValue()
    • setPointValue

      public void setPointValue(int pointValue)
    • getSpecialAbilities

      public ASSpecialAbilityCollection getSpecialAbilities()
    • getUnits

      public List<SBFUnit> getUnits()
    • addUnit

      public void addUnit(SBFUnit newUnit)
    • setUnits

      public void setUnits(List<SBFUnit> units)
    • removeUnit

      public void removeUnit(SBFUnit unit)
    • getConversionReport

      public CalculationReport getConversionReport()
    • setConversionReport

      public void setConversionReport(CalculationReport report)
    • getMovementMode

      public SBFMovementMode getMovementMode()
    • getMovementCode

      public String getMovementCode()
    • setMovementMode

      public void setMovementMode(SBFMovementMode mode)
    • getTrspMovementMode

      public SBFMovementMode getTrspMovementMode()
    • setTrspMovementMode

      public void setTrspMovementMode(SBFMovementMode mode)
    • getTrspMovementCode

      public String getTrspMovementCode()
    • getSbfArtilleryDamage

      public static int getSbfArtilleryDamage(BattleForceSUA spa)
      Returns the Artillery Special's SBF damage (standard, not homing missile damage). Returns 0 when the given SPA is not an Artillery SPA.
    • getSbfArtilleryHomingDamage

      @Deprecated(since="0.51.0", forRemoval=true) public static int getSbfArtilleryHomingDamage(BattleForceSUA spa)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the Artillery Special's SBF damage for homing missiles. Returns 0 when the given SPA is not ARTAIS or ARTAC.
    • isUnitGroup

      public boolean isUnitGroup()
      Description copied from interface: BTObject
      Returns true when this is a group of units or elements such as a TW Squadron, BF Unit or SBF Formation even if it happens to contain only a single element at the time.
      Specified by:
      isUnitGroup in interface BTObject
      Returns:
      True when this is a group type unit
    • generalName

      public String generalName()
      Description copied from interface: BTObject
      Returns the general name or type name of this unit/object. For standard individual units, this is the chassis. For other types of units or objects this can be the full designation or a general part of the designation. Much like the chassis, this can be much more narrow than the general type of unit ("Mek").

      The general name should not be empty and not return null. Return the chassis in Entity and AlphaStrikeElement.

      Specified by:
      generalName in interface BTObject
      Returns:
      The general name / chassis
    • specificName

      public String specificName()
      Description copied from interface: BTObject
      Returns the specific name or type name of this unit/object. For standard individual units, this is the model. For other types of units or objects this can be a part of the designation, or empty.

      The specific name should not return null. Return the model in Entity and AlphaStrikeElement.

      Specified by:
      specificName in interface BTObject
      Returns:
      The specific name / model
    • isAerospace

      public boolean isAerospace()
      Returns true if this SBF Formation represents an aerospace Team.
      Specified by:
      isAerospace in interface BTObject
      Returns:
      True when this is an aerospace unit (including aerospace support vehicles) or aerospace group (SBF)
    • isType

      public boolean isType(SBFElementType tp)
      Returns true if this SBF Formation is of the given type.
    • isAnyTypeOf

      public boolean isAnyTypeOf(SBFElementType type, SBFElementType... types)
      Returns true if this SBF Formation is any of the given types.
    • hasSUA

      public boolean hasSUA(BattleForceSUA sua)
      Description copied from interface: ASSpecialAbilityCollector
      Returns true when the element, turret or arc has the given Special Unit Ability. When it has and the SUA is associated with some value, this value can be assumed to be non-empty or greater than zero. For example, if an element has MHQ, then MHQ >= 1. If it has IF, then the IF damage is at least 0*.
      Specified by:
      hasSUA in interface ASSpecialAbilityCollector
      Parameters:
      sua - The Special Unit Ability to check
      Returns:
      True when the given Special Unit Ability is present
    • getSUA

      public Object getSUA(BattleForceSUA sua)
      Specified by:
      getSUA in interface ASSpecialAbilityCollector
      Returns:
      The value associated with the given Special Unit Ability. Depending on the given sua, this value can be null or of different types. Preferably use the type-safe specific methods such as getLRM() instead of this method.
    • getSpecialsDisplayString

      public String getSpecialsDisplayString(String delimiter, BattleForceSUAFormatter element)
      Description copied from interface: ASSpecialAbilityCollector
      Returns a formatted SUA string suitable for gameplay display such as on an AS Card. The given delimiter is inserted between SUAs.
      Specified by:
      getSpecialsDisplayString in interface ASSpecialAbilityCollector
      Returns:
      A formatted Special Unit Ability string
    • formatSUA

      public String formatSUA(BattleForceSUA sua, String delimiter, ASSpecialAbilityCollector collection)
      Description copied from interface: BattleForceSUAFormatter
      Returns the formatted SUA string for the given sua. The given collection can be the specials of the AlphaStrikeElement itself, a turret or an arc of a large aerospace unit. It is required to access related SUAs such as the doors for a transport ability like MT.
      Specified by:
      formatSUA in interface BattleForceSUAFormatter
      Parameters:
      sua - The Special Unit Ability to process
      delimiter - The delimiter to insert between entries (only relevant for TUR)
      collection - The SUA collection that the given SUA is part of
      Returns:
      The complete formatted Special Unit Ability string such as "LRM1/1/-" or "CK15D2".
    • getId

      public int getId()
      Description copied from interface: InGameObject
      Returns this InGameObject's id. The id must be unique to this InGameObject within the current game. equals() must return true for two InGameObject objects with the same id.
      Specified by:
      getId in interface InGameObject
      Returns:
      The game-unique id of this InGameObject (Entity, AlphaStrikeElement etc.)
    • setId

      public void setId(int newId)
      Description copied from interface: InGameObject
      Sets this InGameObject's id. The id must be unique to this InGameObject within the current game. equals() must return true for two InGameObject objects with the same id.
      Specified by:
      setId in interface InGameObject
      Parameters:
      newId - The game-unique id of this InGameObject (Entity, AlphaStrikeElement etc.)
    • getOwnerId

      public int getOwnerId()
      Description copied from interface: InGameObject
      Returns the unique id of this InGameObject's owning player. This id may be Player.NONE.
      Specified by:
      getOwnerId in interface InGameObject
      Returns:
      The player id of the owner of this InGameObject.
    • setOwnerId

      public void setOwnerId(int newOwnerId)
      Description copied from interface: InGameObject
      Sets the unique id of this InGameObject's owning player. This id may be Player.NONE.
      Specified by:
      setOwnerId in interface InGameObject
      Parameters:
      newOwnerId - The player id of the owner of this InGameObject.
    • getStrength

      public int getStrength()
      Description copied from interface: InGameObject
      Returns the current (remaining) battle strength of this unit or object. For combat units, this is the battle value (BV) or the point value (PV).
      Specified by:
      getStrength in interface InGameObject
      Returns:
      The current battle strength (BV/PV)
    • getForceString

      public String getForceString()
      Description copied from interface: ForceAssignable
      Returns a String representation of the force hierarchy this entity belongs to. The String contains all forces from top to bottom separated by backslash with no backslash at beginning or end. Each force is followed by a unique id separated by the vertical bar. E.g.

      Regiment|1||Battalion B|11||Alpha Company|18||Battle Lance II|112

      If this is not empty, the server will attempt to reconstruct the force hierarchy when it receives this entity and will empty the string. This should be used for loading/saving MULs or transfer from other sources that don't have access to the current MM game's forces, such as MekHQ or the Force Generators. At all other times, forceId should be used instead and this should return an empty string.
      Specified by:
      getForceString in interface ForceAssignable
      Returns:
      The string representation of this ForceAssignable's force
    • setForceString

      public void setForceString(String newForceString)
      Description copied from interface: ForceAssignable
      Sets the force string, see ForceAssignable.getForceString().
      Specified by:
      setForceString in interface ForceAssignable
      Parameters:
      newForceString - The new force string
    • getForceId

      public int getForceId()
      Specified by:
      getForceId in interface ForceAssignable
      Returns:
      The unique id of the force this ForceAssignable belongs to.
    • setForceId

      public void setForceId(int newId)
      Description copied from interface: ForceAssignable
      Sets the unique id of the force this ForceAssignable belongs to.
      Specified by:
      setForceId in interface ForceAssignable
      Parameters:
      newId - the id of the new force to assign this ForceAssignable to.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isDeployed

      public boolean isDeployed()
      Description copied from interface: Deployable
      Returns true when this unit/object is deployed, i.e. it has arrived in the game and may perform actions or be targeted by actions. Usually that means it has a fixed position on a board. Offboard units also count as un-deployed as long as they cannot perform actions and as deployed when they can.
      Specified by:
      isDeployed in interface Deployable
    • getDeployRound

      public int getDeployRound()
      Description copied from interface: Deployable
      Returns the round that this unit/object is to be deployed on the board or offboard.
      Specified by:
      getDeployRound in interface Deployable
    • setDeployRound

      public void setDeployRound(int deployRound)
      Returns the game round that this formation is to be deployed in. Note that deployment technically counts as happening at the end of that round.
      Parameters:
      deployRound - The round this formation deploys in
    • setDeployed

      public void setDeployed(boolean deployed)
      Sets this element's deployment status to the given status
    • equals

      public boolean equals(Object obj)
      Two formations are equal if their ids are equal
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getPosition

      public BoardLocation getPosition()
    • setPosition

      public void setPosition(BoardLocation boardLocation)
    • isHidden

      public boolean isHidden()
    • isEligibleForPhase

      public boolean isEligibleForPhase(GamePhase phase)
    • setDone

      public void setDone(boolean done)
    • isDone

      public boolean isDone()
    • getJumpUsedThisTurn

      public int getJumpUsedThisTurn()
    • setJumpUsedThisTurn

      public void setJumpUsedThisTurn(int jumpUsedThisTurn)
    • isShaken

      public boolean isShaken()
    • isUnsteady

      public boolean isUnsteady()
    • isBroken

      public boolean isBroken()
    • isRouted

      public boolean isRouted()
    • moraleStatus

      public SBFFormation.MoraleStatus moraleStatus()
    • setMoraleStatus

      public void setMoraleStatus(SBFFormation.MoraleStatus status)