Enum Class BFSSpecialType

java.lang.Object
java.lang.Enum<BFSSpecialType>
megamek.common.battlefieldSupport.BFSSpecialType
All Implemented Interfaces:
Serializable, Comparable<BFSSpecialType>, Constable

public enum BFSSpecialType extends Enum<BFSSpecialType>
The registry of Battlefield Support Asset Specials that this build recognizes. Each entry records the canonical code as printed on the Asset card, whether the Special takes a parameter value, and a human-readable display name.

This registry is the single source of truth used by the editor (to offer a picker of known Specials) and by rules code (to dispatch Special behavior). Specials not present here are still valid on an Asset: they are preserved and printed, but have no defined behavior (see BFSSpecial).

  • Enum Constant Details

  • Method Details

    • values

      public static BFSSpecialType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static BFSSpecialType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • canonicalCode

      public String canonicalCode()
      Returns:
      the canonical code as printed on the Asset card (for example IF, No Turret)
    • takesValue

      public boolean takesValue()
      Returns:
      true if this Special takes a parameter value (for example IF X, Artillery (LT))
    • displayName

      public String displayName()
    • forCode

      public static Optional<BFSSpecialType> forCode(@Nullable String code)
      Looks up a known Special by its code, matching the canonical code or any alias case-insensitively and ignoring spaces, hyphens and dots.
      Parameters:
      code - the code to look up
      Returns:
      the matching registry entry, or empty if the code is not recognized