Package megamek.common
Class EMPEffectFormatter
java.lang.Object
megamek.common.EMPEffectFormatter
Shared utility class for formatting EMP-type effect names for display.
Used by both TSEMP weapons and EMP mines to provide consistent visual feedback for Interference, Shutdown, and No Effect results.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatEffect(int effect) Formats an effect constant into an HTML-styled string for report display.static StringformatRoll(int rollValue) Deprecated, for removal: This API element is subject to removal in a future version.static StringformatRoll(int rollValue, int modifier, String modifierDescription) Formats a roll result with optional modifier for report display.static StringgetEffectName(int effect) Deprecated, for removal: This API element is subject to removal in a future version.
-
Method Details
-
formatEffect
Formats an effect constant into an HTML-styled string for report display.Formatting:
- Shutdown: Red bold text
- Interference: Bold text
- No Effect: Plain text
Note: EMP_EFFECT_* and TSEMP_EFFECT_* constants have identical values, so this method works for both EMP mines and TSEMP weapons.
- Parameters:
effect- The effect constant (MMConstants.EMP_EFFECT_* or TSEMP_EFFECT_*)- Returns:
- HTML-formatted effect string for use in reports
-
getEffectName
Deprecated, for removal: This API element is subject to removal in a future version.Gets the plain text effect name without HTML formatting.- Parameters:
effect- The effect constant (MMConstants.EMP_EFFECT_* or TSEMP_EFFECT_*)- Returns:
- Plain text effect name
-
formatRoll
Formats a roll result with optional modifier for report display.Examples:
- No modifier: "8"
- With modifier: "8 (+2)"
- Parameters:
rollValue- The dice roll resultmodifier- The modifier applied (0 for no modifier)modifierDescription- Optional description for the modifier (e.g., "drone", "weight")- Returns:
- Formatted roll string
-
formatRoll
Deprecated, for removal: This API element is subject to removal in a future version.Formats a roll result without modifier.- Parameters:
rollValue- The dice roll result- Returns:
- Formatted roll string
-