Class EMPEffectFormatter

java.lang.Object
megamek.common.EMPEffectFormatter

public final class EMPEffectFormatter extends Object
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 Type
    Method
    Description
    static String
    formatEffect(int effect)
    Formats an effect constant into an HTML-styled string for report display.
    static String
    formatRoll(int rollValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    static String
    formatRoll(int rollValue, int modifier, String modifierDescription)
    Formats a roll result with optional modifier for report display.
    static String
    getEffectName(int effect)
    Deprecated, for removal: This API element is subject to removal in a future version.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • formatEffect

      public static String formatEffect(int effect)
      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(since="0.51.0", forRemoval=true) public static String getEffectName(int effect)
      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

      public static String formatRoll(int rollValue, int modifier, String modifierDescription)
      Formats a roll result with optional modifier for report display.

      Examples:

      • No modifier: "8"
      • With modifier: "8 (+2)"
      Parameters:
      rollValue - The dice roll result
      modifier - The modifier applied (0 for no modifier)
      modifierDescription - Optional description for the modifier (e.g., "drone", "weight")
      Returns:
      Formatted roll string
    • formatRoll

      @Deprecated(since="0.51.0", forRemoval=true) public static String formatRoll(int rollValue)
      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