Class SBFUnit

java.lang.Object
megamek.common.strategicBattleSystems.SBFUnit
All Implemented Interfaces:
Serializable, ASSpecialAbilityCollector, BattleForceSUAFormatter

public class SBFUnit extends Object implements ASSpecialAbilityCollector, BattleForceSUAFormatter, Serializable
Represents an SBF Unit (Ground SBF Unit or Aerospace Flight) which contains between 1 and 6 AlphaStrike elements and is the building block of SBF Formations.
See Also:
  • Constructor Details

    • SBFUnit

      public SBFUnit()
  • 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)
    • getMovement

      public int getMovement()
    • setMovement

      public void setMovement(int movement)
    • getTrspMovement

      public int getTrspMovement()
    • setTrspMovement

      public void setTrspMovement(int trspMovement)
    • getTrspMovementCode

      public String getTrspMovementCode()
    • getTrspMovementMode

      public SBFMovementMode getTrspMovementMode()
    • setTrspMovementMode

      public void setTrspMovementMode(SBFMovementMode mode)
    • getMovementCode

      public String getMovementCode()
    • getMovementMode

      public SBFMovementMode getMovementMode()
    • setMovementMode

      public void setMovementMode(SBFMovementMode mode)
    • getJumpMove

      public int getJumpMove()
    • setJumpMove

      public void setJumpMove(int jumpMove)
    • getSkill

      public int getSkill()
    • setSkill

      public void setSkill(int skill)
    • getPointValue

      public int getPointValue()
    • setPointValue

      public void setPointValue(int pointValue)
    • getArmor

      public int getArmor()
    • setArmor

      public void setArmor(int armor)
      Sets the full (undamaged) armor of this SBF Unit. Also sets the current armor to the same value.
      Parameters:
      armor - The full undamaged armor of this Unit
    • getCurrentArmor

      public int getCurrentArmor()
      Returns:
      The current armor of this Unit, which is any value between the full (undamaged) armor and 0.
    • getDamage

      public ASDamageVector getDamage()
    • getCurrentDamage

      public ASDamageVector getCurrentDamage()
    • setDamage

      public void setDamage(ASDamageVector damage)
    • setElements

      public void setElements(List<AlphaStrikeElement> elements)
    • getElements

      public List<AlphaStrikeElement> getElements()
    • getSpecialAbilities

      public ASSpecialAbilityCollection getSpecialAbilities()
    • isType

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

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

      public boolean isAerospace()
      Returns true if this SBF Unit represents an aerospace Unit.
    • isGround

      public boolean isGround()
      Returns true if this SBF Unit represents a ground Unit.
    • 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
    • showSUA

      public boolean showSUA(BattleForceSUA sua)
      Description copied from interface: BattleForceSUAFormatter
      Returns true when this object wants to have the given SUA displayed among its special abilities. This method defaults to returning true and must be overridden when some SUAs are not too displayed.
      Specified by:
      showSUA in interface BattleForceSUAFormatter
      Returns:
      True when this object wants to have the given sua displayed among its special abilities.
    • 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".
    • toString

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

      public void addTargetingCrit()
    • addDamageCrit

      public void addDamageCrit()
    • addMovementCrit

      @Deprecated(since="0.51.0", forRemoval=true) public void addMovementCrit()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getDamageCrits

      public int getDamageCrits()
    • getTargetingCrits

      public int getTargetingCrits()
    • getMpCrits

      public int getMpCrits()
    • getBaseGunnery

      @Deprecated(since="0.51.0", forRemoval=true) public int getBaseGunnery()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      The base roll value for firing on targets. Equals the skill, modified by targeting crits.
    • setCurrentArmor

      public void setCurrentArmor(int currentArmor)
    • hasArmorDamage

      public boolean hasArmorDamage()