Package megamek.common.alphaStrike
Class AlphaStrikeElement
java.lang.Object
megamek.common.alphaStrike.AlphaStrikeElement
- All Implemented Interfaces:
Serializable,ASCardDisplayable,ASSpecialAbilityCollector,InGameObject,CombatRole,ForceAssignable,BattleForceSUAFormatter,BTObject,Deployable
public class AlphaStrikeElement
extends Object
implements Serializable, ASCardDisplayable, ASSpecialAbilityCollector, BattleForceSUAFormatter, ForceAssignable, 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 Summary
FieldsModifier and TypeFieldDescriptionstatic final int[]static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated, for removal: This API element is subject to removal in a future version.formatSUA(BattleForceSUA sua, String delimiter, ASSpecialAbilityCollector collection) Returns the formatted SUA string for the given sua.doubleintintintintReturns the round that this unit/object is to be deployed on the board or offboard.Returns a fluff image for this unit or object to be shown e.g.intReturns a String representation of the force hierarchy this entity belongs to.intintdoubleDeprecated, for removal: This API element is subject to removal in a future version.intgetId()Returns this InGameObject's id.intgetModel()intgetMovement(String mode) Returns a formatted String for the standard movement capability of this AS element, e.g.Returns all movement modes available to this unit.intgetMulId()getName()intgetOV()intReturns the unique id of this InGameObject's owning player.intintintgetRole()intgetSize()intgetSkill()getSpecialsDisplayString(String delimiter, BattleForceSUAFormatter element) Returns a formatted SUA string suitable for gameplay display such as on an AS Card.intintReturns the current (remaining) battle strength of this unit or object.doublegetSUA(BattleForceSUA sua) intintgetTMM()booleanbooleanhasMulId()booleanbooleanhasSUA(BattleForceSUA sua) Returns true when the element, turret or arc has the given Special Unit Ability.booleanReturns true when this unit/object is deployed, i.e.voidsetArc(ASArcs arc, ASArcSummary arcSummary) Sets the AS element's special ability collection to the given one, if it is not null.voidsetBasePointValue(int basePointValue) Sets the AS element's Base Point Value (PV) (no pilot skill).voidsetChassis(String newChassis) Sets the AS element's chassis to the given value, such as "Atlas".voidsetConversionReport(CalculationReport newReport) Sets the AS element's conversion report to the given report, if it is not null.voidsetCurrentArmor(int newArmor) Sets the AS element's current Armor (A).voidsetCurrentStructure(int newStructure) Sets the AS element's current Structure (S).voidsetDeployed(boolean deployed) Sets this element's deployment status to the given statusvoidsetDeployRound(int deployRound) Returns the game round that this element is to be deployed in.voidsetFluff(EntityFluff newFluff) voidsetForceId(int newId) Sets the unique id of the force this ForceAssignable belongs to.voidsetForceString(String newForceString) Sets the force string, seeForceAssignable.getForceString().voidsetFullArmor(int newArmor) Sets the AS element's full (=undamaged) Armor (A).voidsetFullStructure(int newStructure) Sets the AS element's full (=undamaged) Structure (S).voidsetId(int newId) Sets this InGameObject's id.voidSets the AS element's model to the given value, such as "AS7-D".voidsetMovement(Map<String, Integer> newMovement) Sets the AS element's movement (MV).voidsetMulId(int mulId) Sets this AS element's MUL ID to the given mulId.voidSets the AS element's display name.voidsetOverheat(int newOV) Sets the AS element's extra Overheat Damage capability (OV) (not the current heat buildup).voidsetOwnerId(int newOwnerId) Sets the unique id of this InGameObject's owning player.voidsetPointValue(int newPointValue) Sets the AS element's Point Value (PV).voidsetPrimaryMovementMode(String movementMode) Sets the AS element's Battle Armor Squad Size.voidvoidSets the AS element's battlefield role (ROLE).voidsetSize(int newSize) Sets the AS element's size (SZ).voidsetSkill(int newSkill) Sets the AS element's Pilot Skill (SKILL).voidsetSpecialAbilities(ASSpecialAbilityCollection newAbilities) Sets the AS element's special ability collection to the given one, if it is not null.voidsetSquadSize(int newSquadSize) Sets the AS element's Battle Armor Squad Size.voidsetStandardDamage(ASDamageVector newDamage) Sets the AS element's standard damage (SML or SMLE, but not arc damage).voidsetThreshold(int newThreshold) Sets the AS element's Threshold (TH).voidsetTMM(int newTMM) Sets the AS element's Target Movement Modifier (TMM).voidsetType(ASUnitType newType) Sets the AS element's type (TP), e.g.booleanshowSUA(BattleForceSUA sua) Returns true when this object wants to have the given SUA displayed among its special abilities.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface megamek.common.alphaStrike.ASCardDisplayable
generalName, hasAirMovement, hasGroundMovement, hasMovementMode, hasOV, hasWaterMovement, isAero, isAerospaceFighter, isAerospaceSV, isBattleArmor, isBattleMek, isCombatVehicle, isConventionalFighter, isConventionalInfantry, isDropShip, isFighter, isFixedWingSupport, isIndustrialMek, isJumpCapable, isJumpShip, isLargeAerospace, isMek, isProtoMek, isQuadMek, isSmallCraft, isSpaceStation, isSpheroid, isSubmarine, isSupportVehicle, isTripodMek, isType, isWarShip, specificName, usesArcs, usesCapitalWeapons, usesOV, usesSML, usesSMLE, usesThreshold, usesTMMMethods inherited from interface megamek.common.alphaStrike.ASSpecialAbilityCollector
getAC, getBIM, getCAP, getCAR, getCT, getFLK, getFUEL, getHT, getIATM, getIF, getIT, getJMPS, getLAM, getLRM, getMHQ, getMSL, getREAR, getSCAP, getSpecialsDisplayString, getSRM, getStdDamage, getSUBS, getTOR, getTUR, hasAnySUAOfMethods inherited from interface megamek.common.units.BTObject
getIcon, hasAerodyneSpheroidDistinction, isAerodyne, isAerospace, isBattlefieldSupportAsset, isCarryableObject, isGround, isHandheldWeapon, isInfantry, isObjectiveMarker, isSingleUnit, isUnitGroup, isVehicleMethods inherited from interface megamek.common.interfaces.CombatRole
hasRoleMethods inherited from interface megamek.common.units.Deployable
getBoardId, getFleeZone, hasFleeZoneMethods inherited from interface megamek.common.interfaces.ForceAssignable
partOfForceMethods inherited from interface megamek.common.game.InGameObject
countForStrengthSum, hasOwner
-
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
- Specified by:
getChassisin interfaceASCardDisplayable- Returns:
- The AS element's chassis, such as "Atlas".
-
getFullChassis
- Specified by:
getFullChassisin interfaceASCardDisplayable
-
getModel
- Specified by:
getModelin interfaceASCardDisplayable- Returns:
- The AS element's model, such as "AS7-D".
-
getRole
- Specified by:
getRolein interfaceCombatRole- Returns:
- The battlefield role (UnitRole) of this combat unit.
-
getName
- Returns:
- The AS element's display name, including duplicate markers such as "#2".
-
getSize
public int getSize()- Specified by:
getSizein interfaceASCardDisplayable- Returns:
- The AS element's size (SZ).
-
getTMM
public int getTMM()- Specified by:
getTMMin interfaceASCardDisplayable- Returns:
- The AS element's Target Movement Modifier (TMM).
-
getQuirks
- Returns:
- The TW quirks of this AS element (currently not converted to AS quirks).
-
getSkill
public int getSkill()- Specified by:
getSkillin interfaceASCardDisplayable- Returns:
- The AS element's Pilot Skill (SKILL). Unless another skill has been set, this is 4.
-
getASUnitType
- Specified by:
getASUnitTypein interfaceASCardDisplayable- Returns:
- The AS element's type (TP), e.g. BM or CV.
-
getOV
public int getOV()- Specified by:
getOVin interfaceASCardDisplayable- Returns:
- The AS element's extra Overheat Damage capability (OV) (not the current heat buildup).
-
getPointValue
public int getPointValue()- Specified by:
getPointValuein interfaceASCardDisplayable- 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:
getFullArmorin interfaceASCardDisplayable- Returns:
- The AS element's full (=undamaged) Armor (A).
-
getCurrentArmor
public int getCurrentArmor()- Specified by:
getCurrentArmorin interfaceASCardDisplayable- Returns:
- The AS element's current Armor (A).
-
getArmorPercentage
public double getArmorPercentage() -
getStructurePercentage
public double getStructurePercentage() -
getHealthPercentage
Deprecated, for removal: This API element is subject to removal in a future version. -
getThreshold
public int getThreshold()- Specified by:
getThresholdin interfaceASCardDisplayable- Returns:
- The AS element's armor threshold (TH), if it uses threshold.
-
getFullStructure
public int getFullStructure()- Specified by:
getFullStructurein interfaceASCardDisplayable- Returns:
- The AS element's full (=undamaged) Structure (S).
-
getCurrentStructure
public int getCurrentStructure()- Specified by:
getCurrentStructurein interfaceASCardDisplayable- Returns:
- The AS element's current Structure (S).
-
getMovement
- Specified by:
getMovementin interfaceASCardDisplayable- Returns:
- The AS element's entire movement capability (MV).
-
getMovement
- 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:
getSquadSizein interfaceASCardDisplayable- Returns:
- The squad size (typically 4, 5 or 6), if this AS element is a BA.
-
getFrontArc
- Specified by:
getFrontArcin interfaceASCardDisplayable- Returns:
- The AS element's front arc. Returns an empty arc for elements that don't use arcs.
-
getLeftArc
- Specified by:
getLeftArcin interfaceASCardDisplayable- Returns:
- The AS element's left arc. Returns an empty arc for elements that don't use arcs.
-
getRightArc
- Specified by:
getRightArcin interfaceASCardDisplayable- Returns:
- The AS element's right arc. Returns an empty arc for elements that don't use arcs.
-
getRearArc
- Specified by:
getRearArcin interfaceASCardDisplayable- Returns:
- The AS element's rear arc. Returns an empty arc for elements that don't use arcs.
-
getStandardDamage
- Specified by:
getStandardDamagein interfaceASCardDisplayable- 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:
getMulIdin interfaceASCardDisplayable- Returns:
- This AS element's MUL ID if it has one, -1 otherwise.
-
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
- Specified by:
getSpecialAbilitiesin interfaceASCardDisplayable- Returns:
- The element's central special abilities (not those in arcs).
-
getArc
- Returns:
- The ASSpecialAbilityCollection object holding the damage and specials info for the given arc.
-
setQuirks
-
hasQuirk
- Returns:
- True if this element has the given quirk.
-
setChassis
Sets the AS element's chassis to the given value, such as "Atlas". -
setModel
Sets the AS element's model to the given value, such as "AS7-D". -
setRole
Sets the AS element's battlefield role (ROLE). -
setName
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
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
Sets the AS element's movement (MV). -
setStandardDamage
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
Sets the AS element's Battle Armor Squad Size. Does not check if this actually is a BA. -
setConversionReport
Sets the AS element's conversion report to the given report, if it is not null. -
setSpecialAbilities
Sets the AS element's special ability collection to the given one, if it is not null. -
setArc
Sets the AS element's special ability collection to the given one, if it is not null. -
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
Description copied from interface:ASSpecialAbilityCollectorReturns 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:
hasSUAin interfaceASSpecialAbilityCollector- Parameters:
sua- The Special Unit Ability to check- Returns:
- True when the given Special Unit Ability is present
-
getSUA
- Specified by:
getSUAin interfaceASSpecialAbilityCollector- 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
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
Description copied from interface:ASSpecialAbilityCollectorReturns a formatted SUA string suitable for gameplay display such as on an AS Card. The given delimiter is inserted between SUAs.- Specified by:
getSpecialsDisplayStringin interfaceASSpecialAbilityCollector- 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
- Specified by:
getPrimaryMovementModein interfaceASCardDisplayable- Returns:
- The primary (= first) movement type String, such as "" for some ground units or "s" for submarines.
-
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:InGameObjectReturns 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:
getIdin interfaceInGameObject- Returns:
- The game-unique id of this InGameObject (Entity, AlphaStrikeElement etc.)
-
setId
public void setId(int newId) Description copied from interface:InGameObjectSets 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:
setIdin interfaceInGameObject- Parameters:
newId- The game-unique id of this InGameObject (Entity, AlphaStrikeElement etc.)
-
getForceString
Description copied from interface:ForceAssignableReturns 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:
getForceStringin interfaceForceAssignable- Returns:
- The string representation of this ForceAssignable's force
-
setForceString
Description copied from interface:ForceAssignableSets the force string, seeForceAssignable.getForceString().- Specified by:
setForceStringin interfaceForceAssignable- Parameters:
newForceString- The new force string
-
getForceId
public int getForceId()- Specified by:
getForceIdin interfaceForceAssignable- Returns:
- The unique id of the force this ForceAssignable belongs to.
-
setForceId
public void setForceId(int newId) Description copied from interface:ForceAssignableSets the unique id of the force this ForceAssignable belongs to.- Specified by:
setForceIdin interfaceForceAssignable- Parameters:
newId- the id of the new force to assign this ForceAssignable to.
-
getOwnerId
public int getOwnerId()Description copied from interface:InGameObjectReturns the unique id of this InGameObject's owning player. This id may be Player.NONE.- Specified by:
getOwnerIdin interfaceInGameObject- Returns:
- The player id of the owner of this InGameObject.
-
setOwnerId
public void setOwnerId(int newOwnerId) Description copied from interface:InGameObjectSets the unique id of this InGameObject's owning player. This id may be Player.NONE.- Specified by:
setOwnerIdin interfaceInGameObject- Parameters:
newOwnerId- The player id of the owner of this InGameObject.
-
getStrength
public int getStrength()Description copied from interface:InGameObjectReturns 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:
getStrengthin interfaceInGameObject- Returns:
- The current battle strength (BV/PV)
-
isDeployed
public boolean isDeployed()Description copied from interface:DeployableReturns 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:
isDeployedin interfaceDeployable
-
getDeployRound
public int getDeployRound()Description copied from interface:DeployableReturns the round that this unit/object is to be deployed on the board or offboard.- Specified by:
getDeployRoundin interfaceDeployable
-
showSUA
Description copied from interface:BattleForceSUAFormatterReturns 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:
showSUAin interfaceBattleForceSUAFormatter- Returns:
- True when this object wants to have the given sua displayed among its special abilities.
-
formatSUA
Description copied from interface:BattleForceSUAFormatterReturns 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:
formatSUAin interfaceBattleForceSUAFormatter- Parameters:
sua- The Special Unit Ability to processdelimiter- 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
Description copied from interface:BTObjectReturns 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:
getFluffImagein interfaceBTObject- Returns:
- A fluff image for this object/unit if it contains one as part of the object/unit
-
setFluff
-
toString
-
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
-