Class AlphaStrikeElement

java.lang.Object
megamek.common.alphaStrike.AlphaStrikeElement
All Implemented Interfaces:
Serializable, ASCardDisplayable, ASSpecialAbilityCollector, InGameObject, CombatRole, ForceAssignable, BattleForceSUAFormatter, BTObject, Deployable

This class represents an AlphaStrike Element which is a single unit such as a Mek with AlphaStrike values such as S, M, L damage and a single Armor and Structure value.
See Also:
  • Field Details

    • RANGE_BAND_SHORT

      public static final int RANGE_BAND_SHORT
      See Also:
    • RANGE_BAND_MEDIUM

      public static final int RANGE_BAND_MEDIUM
      See Also:
    • RANGE_BAND_LONG

      public static final int RANGE_BAND_LONG
      See Also:
    • RANGE_BAND_EXTREME

      public static final int RANGE_BAND_EXTREME
      See Also:
    • STANDARD_RANGES

      public static final int[] STANDARD_RANGES
    • CAPITAL_RANGES

      public static final int[] CAPITAL_RANGES
    • SHORT_RANGE

      public static final int SHORT_RANGE
    • MEDIUM_RANGE

      public static final int MEDIUM_RANGE
    • LONG_RANGE

      public static final int LONG_RANGE
    • EXTREME_RANGE

      public static final int EXTREME_RANGE
  • Constructor Details

    • AlphaStrikeElement

      public AlphaStrikeElement()
  • Method Details

    • getChassis

      public String getChassis()
      Specified by:
      getChassis in interface ASCardDisplayable
      Returns:
      The AS element's chassis, such as "Atlas".
    • getFullChassis

      public String getFullChassis()
      Specified by:
      getFullChassis in interface ASCardDisplayable
    • getModel

      public String getModel()
      Specified by:
      getModel in interface ASCardDisplayable
      Returns:
      The AS element's model, such as "AS7-D".
    • getRole

      public UnitRole getRole()
      Specified by:
      getRole in interface CombatRole
      Returns:
      The battlefield role (UnitRole) of this combat unit.
    • getName

      public String getName()
      Returns:
      The AS element's display name, including duplicate markers such as "#2".
    • getSize

      public int getSize()
      Specified by:
      getSize in interface ASCardDisplayable
      Returns:
      The AS element's size (SZ).
    • getTMM

      public int getTMM()
      Specified by:
      getTMM in interface ASCardDisplayable
      Returns:
      The AS element's Target Movement Modifier (TMM).
    • getQuirks

      public Quirks getQuirks()
      Returns:
      The TW quirks of this AS element (currently not converted to AS quirks).
    • getSkill

      public int getSkill()
      Specified by:
      getSkill in interface ASCardDisplayable
      Returns:
      The AS element's Pilot Skill (SKILL). Unless another skill has been set, this is 4.
    • getASUnitType

      public ASUnitType getASUnitType()
      Specified by:
      getASUnitType in interface ASCardDisplayable
      Returns:
      The AS element's type (TP), e.g. BM or CV.
    • getOV

      public int getOV()
      Specified by:
      getOV in interface ASCardDisplayable
      Returns:
      The AS element's extra Overheat Damage capability (OV) (not the current heat buildup).
    • getPointValue

      public int getPointValue()
      Specified by:
      getPointValue in interface ASCardDisplayable
      Returns:
      The AS element's Point Value (PV). This is not adjusted for damage on the element.
    • getBasePointValue

      public int getBasePointValue()
    • getFullArmor

      public int getFullArmor()
      Specified by:
      getFullArmor in interface ASCardDisplayable
      Returns:
      The AS element's full (=undamaged) Armor (A).
    • getCurrentArmor

      public int getCurrentArmor()
      Specified by:
      getCurrentArmor in interface ASCardDisplayable
      Returns:
      The AS element's current Armor (A).
    • getArmorPercentage

      public double getArmorPercentage()
    • getStructurePercentage

      public double getStructurePercentage()
    • getHealthPercentage

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

      public int getThreshold()
      Specified by:
      getThreshold in interface ASCardDisplayable
      Returns:
      The AS element's armor threshold (TH), if it uses threshold.
    • getFullStructure

      public int getFullStructure()
      Specified by:
      getFullStructure in interface ASCardDisplayable
      Returns:
      The AS element's full (=undamaged) Structure (S).
    • getCurrentStructure

      public int getCurrentStructure()
      Specified by:
      getCurrentStructure in interface ASCardDisplayable
      Returns:
      The AS element's current Structure (S).
    • getMovement

      public Map<String,Integer> getMovement()
      Specified by:
      getMovement in interface ASCardDisplayable
      Returns:
      The AS element's entire movement capability (MV).
    • getMovement

      public int getMovement(String mode)
      Returns:
      The movement value (in inches where applicable) for the given movement mode key such as "" or "j". Returns 0 when the unit does not have the given movement mode.
    • getRangeBands

      public int getRangeBands()
      Returns:
      The number of damage range bands this element uses, 3 (SML) for ground units, 4 (SMLE) for aero.
    • getSquadSize

      public int getSquadSize()
      Specified by:
      getSquadSize in interface ASCardDisplayable
      Returns:
      The squad size (typically 4, 5 or 6), if this AS element is a BA.
    • getFrontArc

      public ASArcSummary getFrontArc()
      Specified by:
      getFrontArc in interface ASCardDisplayable
      Returns:
      The AS element's front arc. Returns an empty arc for elements that don't use arcs.
    • getLeftArc

      public ASArcSummary getLeftArc()
      Specified by:
      getLeftArc in interface ASCardDisplayable
      Returns:
      The AS element's left arc. Returns an empty arc for elements that don't use arcs.
    • getRightArc

      public ASArcSummary getRightArc()
      Specified by:
      getRightArc in interface ASCardDisplayable
      Returns:
      The AS element's right arc. Returns an empty arc for elements that don't use arcs.
    • getRearArc

      public ASArcSummary getRearArc()
      Specified by:
      getRearArc in interface ASCardDisplayable
      Returns:
      The AS element's rear arc. Returns an empty arc for elements that don't use arcs.
    • getStandardDamage

      public ASDamageVector getStandardDamage()
      Specified by:
      getStandardDamage in interface ASCardDisplayable
      Returns:
      The standard damage (SML or SMLE depending on type). This will be empty for elements that use arcs.
    • getMulId

      public int getMulId()
      Specified by:
      getMulId in interface ASCardDisplayable
      Returns:
      This AS element's MUL ID if it has one, -1 otherwise.
    • getConversionReport

      public CalculationReport getConversionReport()
      Returns:
      The conversion report for this unit. Maybe a DummyCalculationReport without information.
    • hasConversionReport

      public boolean hasConversionReport()
      Returns:
      False when this element has no meaningful conversion report, true when it has.
    • getSpecialAbilities

      public ASSpecialAbilityCollection getSpecialAbilities()
      Specified by:
      getSpecialAbilities in interface ASCardDisplayable
      Returns:
      The element's central special abilities (not those in arcs).
    • getArc

      public ASSpecialAbilityCollection getArc(ASArcs arc)
      Returns:
      The ASSpecialAbilityCollection object holding the damage and specials info for the given arc.
    • setQuirks

      public void setQuirks(Quirks quirks)
    • hasQuirk

      public boolean hasQuirk(String name)
      Returns:
      True if this element has the given quirk.
    • setChassis

      public void setChassis(String newChassis)
      Sets the AS element's chassis to the given value, such as "Atlas".
    • setModel

      public void setModel(String newModel)
      Sets the AS element's model to the given value, such as "AS7-D".
    • setRole

      public void setRole(UnitRole newRole)
      Sets the AS element's battlefield role (ROLE).
    • setName

      public void setName(String newName)
      Sets the AS element's display name.
    • setSize

      public void setSize(int newSize)
      Sets the AS element's size (SZ).
    • setTMM

      public void setTMM(int newTMM)
      Sets the AS element's Target Movement Modifier (TMM).
    • setSkill

      public void setSkill(int newSkill)
      Sets the AS element's Pilot Skill (SKILL).
    • setType

      public void setType(ASUnitType newType)
      Sets the AS element's type (TP), e.g. BM or CV.
    • setOverheat

      public void setOverheat(int newOV)
      Sets the AS element's extra Overheat Damage capability (OV) (not the current heat buildup).
    • setPointValue

      public void setPointValue(int newPointValue)
      Sets the AS element's Point Value (PV).
    • setBasePointValue

      public void setBasePointValue(int basePointValue)
      Sets the AS element's Base Point Value (PV) (no pilot skill).
    • setCurrentArmor

      public void setCurrentArmor(int newArmor)
      Sets the AS element's current Armor (A).
    • setFullArmor

      public void setFullArmor(int newArmor)
      Sets the AS element's full (=undamaged) Armor (A). Also sets the current armor to the same value.
    • setThreshold

      public void setThreshold(int newThreshold)
      Sets the AS element's Threshold (TH).
    • setCurrentStructure

      public void setCurrentStructure(int newStructure)
      Sets the AS element's current Structure (S).
    • setFullStructure

      public void setFullStructure(int newStructure)
      Sets the AS element's full (=undamaged) Structure (S). Also sets the current structure to the same value.
    • setMovement

      public void setMovement(Map<String,Integer> newMovement)
      Sets the AS element's movement (MV).
    • setStandardDamage

      public void setStandardDamage(ASDamageVector newDamage)
      Sets the AS element's standard damage (SML or SMLE, but not arc damage).
    • setSquadSize

      public void setSquadSize(int newSquadSize)
      Sets the AS element's Battle Armor Squad Size. Does not check if this actually is a BA.
    • setPrimaryMovementMode

      public void setPrimaryMovementMode(String movementMode)
      Sets the AS element's Battle Armor Squad Size. Does not check if this actually is a BA.
    • setConversionReport

      public void setConversionReport(CalculationReport newReport)
      Sets the AS element's conversion report to the given report, if it is not null.
    • setSpecialAbilities

      public void setSpecialAbilities(ASSpecialAbilityCollection newAbilities)
      Sets the AS element's special ability collection to the given one, if it is not null.
    • setArc

      public void setArc(ASArcs arc, ASArcSummary arcSummary)
      Sets the AS element's special ability collection to the given one, if it is not null.
    • clearConversionReport

      @Deprecated(since="0.51.0", forRemoval=true) public void clearConversionReport()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Resets the AS element's conversion report to an empty DummyCalculationReport.
    • 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.
    • getMovementAsString

      public String getMovementAsString()
      Returns a formatted String for the standard movement capability of this AS element, e.g. 4"/6"j. This includes all movement modes of the element that are typically printed as MV on an AS card. As the only exception, this does not include the a and g movement modes of LandAirMeks, which are printed as special unit abilities.
      Returns:
      A formatted standard movement string, e.g. 4"/6"j.
    • 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
    • getJumpMove

      public int getJumpMove()
      Returns:
      This AS element's jump movement (in inches) or 0 if it has no jump movement.
    • hasMulId

      public boolean hasMulId()
      Returns:
      True if this AS element has a valid MUL ID.
    • setMulId

      public void setMulId(int mulId)
      Sets this AS element's MUL ID to the given mulId. The MUL ID should be > 0 when this AS element has a MUL entry and -1 otherwise.
    • getPrimaryMovementValue

      public int getPrimaryMovementValue()
      Returns:
      The primary movement value in inches, i.e. the type "" for ground units or "s" for submarines.
    • getPrimaryMovementMode

      public String getPrimaryMovementMode()
      Specified by:
      getPrimaryMovementMode in interface ASCardDisplayable
      Returns:
      The primary (= first) movement type String, such as "" for some ground units or "s" for submarines.
    • getMovementModes

      public Set<String> getMovementModes()
      Returns all movement modes available to this unit. For LandAirMeks, this includes one or both of aero and Wige movement modes a and g!
      Returns:
      All movement mode Strings of this AS element, such as ["", "j"].
    • 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.)
    • 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.
    • 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)
    • 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
    • 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".
    • getFluffImage

      @Nullable public Image getFluffImage()
      Description copied from interface: BTObject
      Returns a fluff image for this unit or object to be shown e.g. in the unit summary.

      Important: This method returns only a fluff image that is stored in the object itself, e.g. if it was part of the unit's file or is created by the unit itself. It does not search for fluff images in the fluff images directories. For GUI, use FluffImageHelper.getFluffImage(BTObject) instead; that method will retrieve either a unit's own fluff image or an image from the fluff images directories (if there is one).

      The default implementation returns null. For canon units, this will return null, as they do not store fluff images in the unit files.

      Specified by:
      getFluffImage in interface BTObject
      Returns:
      A fluff image for this object/unit if it contains one as part of the object/unit
    • setFluff

      public void setFluff(EntityFluff newFluff)
    • toString

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

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

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