Class SBFFormation
java.lang.Object
megamek.common.strategicBattleSystems.SBFFormation
- All Implemented Interfaces:
Serializable,ASSpecialAbilityCollector,InGameObject,ForceAssignable,BattleForceSUAFormatter,BTObject,Deployable
- Direct Known Subclasses:
Formation
public class SBFFormation
extends Object
implements ASSpecialAbilityCollector, BattleForceSUAFormatter, ForceAssignable, Deployable, Serializable
Represents a Strategic Battle Force Formation composed of one or more SBF Units.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanTwo formations are equal if their ids are equalformatSUA(BattleForceSUA sua, String delimiter, ASSpecialAbilityCollector collection) Returns the formatted SUA string for the given sua.Returns the general name or type name of this unit/object.intReturns the round that this unit/object is to be deployed on the board or offboard.intReturns a String representation of the force hierarchy this entity belongs to.intgetId()Returns this InGameObject's id.intintintintgetName()intReturns the unique id of this InGameObject's owning player.intstatic intReturns the Artillery Special's SBF damage (standard, not homing missile damage).static intDeprecated, for removal: This API element is subject to removal in a future version.intgetSize()intgetSkill()getSpecialsDisplayString(String delimiter, BattleForceSUAFormatter element) Returns a formatted SUA string suitable for gameplay display such as on an AS Card.intReturns the current (remaining) battle strength of this unit or object.getSUA(BattleForceSUA sua) intintgetTmm()intgetType()getUnits()inthashCode()booleanhasSUA(BattleForceSUA sua) Returns true when the element, turret or arc has the given Special Unit Ability.booleanReturns true if this SBF Formation represents an aerospace Team.booleanisAnyTypeOf(SBFElementType type, SBFElementType... types) Returns true if this SBF Formation is any of the given types.booleanisBroken()booleanReturns true when this unit/object is deployed, i.e.booleanisDone()booleanisEligibleForPhase(GamePhase phase) booleanisHidden()booleanisRouted()booleanisShaken()booleanisType(SBFElementType tp) Returns true if this SBF Formation is of the given type.booleanReturns 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.booleanvoidremoveUnit(SBFUnit unit) voidsetConversionReport(CalculationReport report) voidsetDeployed(boolean deployed) Sets this element's deployment status to the given statusvoidsetDeployRound(int deployRound) Returns the game round that this formation is to be deployed in.voidsetDone(boolean done) voidsetForceId(int newId) Sets the unique id of the force this ForceAssignable belongs to.voidsetForceString(String newForceString) Sets the force string, seeForceAssignable.getForceString().voidsetId(int newId) Sets this InGameObject's id.voidsetJumpMove(int jumpMove) voidsetJumpUsedThisTurn(int jumpUsedThisTurn) voidsetMorale(int morale) voidvoidsetMovement(int movement) voidvoidvoidsetOwnerId(int newOwnerId) Sets the unique id of this InGameObject's owning player.voidsetPointValue(int pointValue) voidsetPosition(BoardLocation boardLocation) voidsetSize(int size) voidsetSkill(int skill) voidsetTactics(int tactics) voidsetTmm(int tmm) voidsetTrspMovement(int trspMovement) voidvoidsetType(SBFElementType type) voidReturns the specific name or type name of this unit/object.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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.strategicBattleSystems.BattleForceSUAFormatter
showSUAMethods inherited from interface megamek.common.units.BTObject
getFluffImage, getIcon, hasAerodyneSpheroidDistinction, isAero, isAerodyne, isAerospaceFighter, isAerospaceSV, isBattleArmor, isBattlefieldSupportAsset, isBattleMek, isCarryableObject, isCombatVehicle, isConventionalFighter, isConventionalInfantry, isDropShip, isFighter, isFixedWingSupport, isGround, isHandheldWeapon, isIndustrialMek, isInfantry, isJumpShip, isLargeAerospace, isMek, isObjectiveMarker, isProtoMek, isQuadMek, isSingleUnit, isSmallCraft, isSpaceStation, isSpheroid, isSupportVehicle, isTripodMek, isVehicle, isWarShipMethods 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
-
type
-
moraleStatus
-
-
Constructor Details
-
SBFFormation
public SBFFormation()
-
-
Method Details
-
getName
-
setName
-
getType
-
setType
-
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
-
getUnits
-
addUnit
-
setUnits
-
removeUnit
-
getConversionReport
-
setConversionReport
-
getMovementMode
-
getMovementCode
-
setMovementMode
-
getTrspMovementMode
-
setTrspMovementMode
-
getTrspMovementCode
-
getSbfArtilleryDamage
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:BTObjectReturns 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:
isUnitGroupin interfaceBTObject- Returns:
- True when this is a group type unit
-
generalName
Description copied from interface:BTObjectReturns 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:
generalNamein interfaceBTObject- Returns:
- The general name / chassis
-
specificName
Description copied from interface:BTObjectReturns 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:
specificNamein interfaceBTObject- Returns:
- The specific name / model
-
isAerospace
public boolean isAerospace()Returns true if this SBF Formation represents an aerospace Team.- Specified by:
isAerospacein interfaceBTObject- Returns:
- True when this is an aerospace unit (including aerospace support vehicles) or aerospace group (SBF)
-
isType
Returns true if this SBF Formation is of the given type. -
isAnyTypeOf
Returns true if this SBF Formation is any of the given types. -
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.
-
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
-
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".
-
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.)
-
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)
-
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.
-
toString
-
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
-
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
Two formations are equal if their ids are equal -
hashCode
public int hashCode() -
getPosition
-
setPosition
-
isHidden
public boolean isHidden() -
isEligibleForPhase
-
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
-
setMoraleStatus
-