Package megamek.common.equipment
Class BridgeLayerState
java.lang.Object
megamek.common.equipment.BridgeLayerState
- All Implemented Interfaces:
Serializable
Mutable per-mount state for a Bridge-Layer (AVLB)
MiscMounted, holding the carried folding bridge's current
Construction Factor and the deploy lifecycle. Kept in its own holder (referenced by a single field on
MiscMounted) so the large MiscMounted/Entity classes are not bloated with bridgelayer
fields.
Lifecycle: a bridgelayer starts carried (the folding bridge occupies the unit, absorbs attacks to its location, and blocks weapon fire there). The controlling player may declare a deploy; the unit must then remain stationary and the bridge is placed on the board in the following End Phase, after which the mount is deployed (spent). Construction Factors per TechManual Bridge-Layer table.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDedicated log4j2 logger name for all Bridge-Layer (AVLB) diagnostics.static final intCarried bridge Construction Factor for the Heavy Bridge-Layer (TechManual Bridge-Layer table).static final intCarried bridge Construction Factor for the Light Bridge-Layer (TechManual Bridge-Layer table).static final intCarried bridge Construction Factor for the Medium Bridge-Layer (TechManual Bridge-Layer table). -
Constructor Summary
ConstructorsConstructorDescriptionBridgeLayerState(MiscType type) Creates the carried-bridge state for a bridgelayer mount, initializing the current CF from the equipment variant. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears any pending deploy declaration (cancellation or after placement).intintintstatic intstatic booleanisBridgeLayer(MiscType type) booleanbooleanbooleanvoidsetCurrentCF(int constructionFactor) Sets the carried bridge's current Construction Factor, clamped to a minimum of 0.voidsetDeployed(boolean deployed) voidsetDeployMechanismDisabled(boolean disabled) voidstartDeploy(Coords target, int exits, int declaredTurn) Records a pending deploy declaration.static intterrainBridgeType(MiscType type)
-
Field Details
-
DIAGNOSTIC_LOGGER_NAME
Dedicated log4j2 logger name for all Bridge-Layer (AVLB) diagnostics. AVLB code logs gate/eligibility reasons and state transitions through this name (tagged[AVLB]) so the whole feature flow can be enabled and grepped from megamek.log without turning on debug for the large host classes (Entity, MoveStep). Enable it inmmconf/log4j2.xml.- See Also:
-
LIGHT_BRIDGE_LAYER_CF
public static final int LIGHT_BRIDGE_LAYER_CFCarried bridge Construction Factor for the Light Bridge-Layer (TechManual Bridge-Layer table).- See Also:
-
MEDIUM_BRIDGE_LAYER_CF
public static final int MEDIUM_BRIDGE_LAYER_CFCarried bridge Construction Factor for the Medium Bridge-Layer (TechManual Bridge-Layer table).- See Also:
-
HEAVY_BRIDGE_LAYER_CF
public static final int HEAVY_BRIDGE_LAYER_CFCarried bridge Construction Factor for the Heavy Bridge-Layer (TechManual Bridge-Layer table).- See Also:
-
-
Constructor Details
-
BridgeLayerState
Creates the carried-bridge state for a bridgelayer mount, initializing the current CF from the equipment variant.- Parameters:
type- the bridgelayerMiscType(must be a bridgelayer; seeisBridgeLayer(MiscType))
-
-
Method Details
-
isBridgeLayer
- Parameters:
type- an equipment type, possiblynull- Returns:
trueif the type is any of the Light/Medium/Heavy Bridge-Layer variants
-
initialCF
- Parameters:
type- a bridgelayer equipment type- Returns:
- the starting carried-bridge Construction Factor for the variant, or 0 if not a bridgelayer
-
terrainBridgeType
- Parameters:
type- a bridgelayer equipment type- Returns:
- the board bridge terrain type level placed when this variant deploys (Light = 1, Medium = 2, Heavy = 3). The deployed bridge's displayed type name is taken from this level, so each variant maps to its matching level; bridge images are selected by the exits bitmask, not the type level, so any level renders.
-
getCurrentCF
public int getCurrentCF()- Returns:
- the carried bridge's current Construction Factor; reduced as attacks are absorbed, and the bridge is destroyed when it reaches 0
-
setCurrentCF
public void setCurrentCF(int constructionFactor) Sets the carried bridge's current Construction Factor, clamped to a minimum of 0.- Parameters:
constructionFactor- the new Construction Factor
-
isDeployed
public boolean isDeployed()- Returns:
trueonce the folding bridge has been placed on the board and the mount is spent
-
setDeployed
public void setDeployed(boolean deployed) - Parameters:
deployed- whether the folding bridge has been placed on the board
-
isDeployMechanismDisabled
public boolean isDeployMechanismDisabled()- Returns:
trueif a critical hit has disabled the deploy mechanism; the bridge can no longer be deployed
-
setDeployMechanismDisabled
public void setDeployMechanismDisabled(boolean disabled) - Parameters:
disabled- whether a critical hit has disabled the deploy mechanism
-
isDeployPending
public boolean isDeployPending()- Returns:
truewhile a deploy has been declared and is awaiting placement in a later End Phase
-
getDeployTarget
- Returns:
- the hex the bridge will be placed in, or
nullwhen no deploy is pending
-
getDeployExits
public int getDeployExits()- Returns:
- the exits bitmask of the two hexsides the placed bridge will connect
-
getDeployDeclaredTurn
public int getDeployDeclaredTurn()- Returns:
- the game round in which the deploy was declared, or -1 if none is pending
-
startDeploy
Records a pending deploy declaration.- Parameters:
target- the hex the bridge will be placed in (directly in front of the unit)exits- the exits bitmask of the two hexsides the bridge will connectdeclaredTurn- the current game round in which the deploy was declared
-
clearPendingDeploy
public void clearPendingDeploy()Clears any pending deploy declaration (cancellation or after placement).
-