Package megamek.common
Class TemporaryECMField
java.lang.Object
megamek.common.TemporaryECMField
- All Implemented Interfaces:
Serializable
Represents a temporary ECM field that expires after a set duration.
EMP mines create temporary ECM bubbles that last until the End Phase of the following turn per Tactical Operations: Advanced Rules (Experimental).
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTemporaryECMField(Coords position, int range, int creationRound, int expirationRound, GamePhase expirationPhase, int playerId, String source) Creates a new temporary ECM field. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaffectsHex(Coords coords) Checks if this ECM field affects the given coordinates.booleanstatic TemporaryECMFieldfromEMPMine(Coords position, int currentRound, int playerId) Creates a temporary ECM field from an EMP mine detonation.intintintintgetRange()inthashCode()booleanChecks if this ECM field has expired.Converts this temporary field to an ECMInfo object for use in ECM calculations.toString()
-
Constructor Details
-
TemporaryECMField
public TemporaryECMField(Coords position, int range, int creationRound, int expirationRound, GamePhase expirationPhase, int playerId, String source) Creates a new temporary ECM field.- Parameters:
position- The center hex of the ECM fieldrange- The range in hexes (0 = single hex)creationRound- The game round when this field was createdexpirationRound- The game round when this field expiresexpirationPhase- The phase during which this field expiresplayerId- The player who created this field (or Player.PLAYER_NONE)source- Description of the source (e.g., "EMP Mine")
-
-
Method Details
-
fromEMPMine
Creates a temporary ECM field from an EMP mine detonation.Per TO:AR, the ECM bubble lasts until the End Phase of the following turn.
- Parameters:
position- The hex where the EMP mine detonatedcurrentRound- The current game roundplayerId- The player who deployed the mine- Returns:
- A new TemporaryECMField configured for EMP mine effects
-
getPosition
- Returns:
- The center position of this ECM field
-
getRange
public int getRange()- Returns:
- The range of this ECM field in hexes (0 = single hex only)
-
getCreationRound
public int getCreationRound()- Returns:
- The round this field was created
-
getExpirationRound
public int getExpirationRound()- Returns:
- The round this field expires
-
getExpirationPhase
- Returns:
- The phase during which this field expires
-
getPlayerId
public int getPlayerId()- Returns:
- The player ID associated with this field
-
getSource
- Returns:
- Description of what created this ECM field
-
isExpired
Checks if this ECM field has expired.- Parameters:
currentRound- The current game roundcurrentPhase- The current game phase- Returns:
- true if this field has expired
-
affectsHex
Checks if this ECM field affects the given coordinates.- Parameters:
coords- The coordinates to check- Returns:
- true if this ECM field covers the given hex
-
toECMInfo
Converts this temporary field to an ECMInfo object for use in ECM calculations.EMP mine ECM is hostile to everyone (including the player who placed the mine), similar to Chaff. This is achieved by passing null as the owner.
- Returns:
- An ECMInfo representing this temporary field, hostile to all players
-
equals
-
hashCode
public int hashCode() -
toString
-