Enum Class UnitRole

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

public enum UnitRole extends Enum<UnitRole>
Unit roles as defined by Alpha Strike Companion, used in formation building rules in ASC and Campaign Operations
  • Enum Constant Details

    • UNDETERMINED

      public static final UnitRole UNDETERMINED
      This is the default role; given to units where the role definition is missing.
    • NONE

      public static final UnitRole NONE
      Shows that this unit intentionally has no combat role.
    • AMBUSHER

      public static final UnitRole AMBUSHER
      Ground unit roles
    • BRAWLER

      public static final UnitRole BRAWLER
    • JUGGERNAUT

      public static final UnitRole JUGGERNAUT
    • MISSILE_BOAT

      public static final UnitRole MISSILE_BOAT
    • SCOUT

      public static final UnitRole SCOUT
    • SKIRMISHER

      public static final UnitRole SKIRMISHER
    • SNIPER

      public static final UnitRole SNIPER
    • STRIKER

      public static final UnitRole STRIKER
    • ATTACK_FIGHTER

      public static final UnitRole ATTACK_FIGHTER
      Aerospace unit roles
    • DOGFIGHTER

      public static final UnitRole DOGFIGHTER
    • FAST_DOGFIGHTER

      public static final UnitRole FAST_DOGFIGHTER
    • FIRE_SUPPORT

      public static final UnitRole FIRE_SUPPORT
    • INTERCEPTOR

      public static final UnitRole INTERCEPTOR
    • TRANSPORT

      public static final UnitRole TRANSPORT
  • Method Details

    • values

      public static UnitRole[] 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 UnitRole 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
    • isAvailableTo

      public boolean isAvailableTo(BTObject unit)
      Parameters:
      unit - The unit to check.
      Returns:
      True when the given unit may use this role. Used in MML.
    • isAnyOf

      public boolean isAnyOf(UnitRole role, UnitRole... otherRoles)
      Checks if this role is the same as the given role or any of the other
      Parameters:
      role - Role to check against.
      otherRoles - The other roles to check against.
      Returns:
      True when this role is the same as any of the given roles.
    • hasRole

      public boolean hasRole()
      Returns:
      True when this role is not UNDETERMINED. (Returns true for NONE.)
    • parseRole

      public static UnitRole parseRole(String role)
      Parses the given string into the UnitRole if possible and returns it. If it can't parse the string, logs an error and returns UNDETERMINED. Does not return null.
      Returns:
      The UnitRole given as a string or UNDETERMINED.
    • qualifiesForRole

      @Deprecated(since="0.51.0", forRemoval=true) public boolean qualifiesForRole(Entity entity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Applies the criteria from Alpha Strike Companion to determine whether a unit qualifies for a particular role. As the canon unit roles do not themselves adhere strictly to the guidelines, there is some allowance for fuzziness in applying the criteria by computing a score. Stats outside the given ranges lower the score, and special abilities that are useful for a role raise the score. This method calculates AlphaStrike statistics for the Entity as the first step in the calculation.
      Parameters:
      entity - The unit to be checked for role qualification
      Returns:
      Boolean value indicating whether the unit meets the qualifications for this role.
    • qualifiesForRole

      @Deprecated(since="0.51.0", forRemoval=true) public boolean qualifiesForRole(Entity entity, double tolerance)
      Deprecated, for removal: This API element is subject to removal in a future version.

      Applies the criteria from Alpha Strike Companion to determine whether a unit qualifies for a particular role. As the canon unit roles do not themselves adhere strictly to the guidelines, there is some allowance for fuzziness in applying the criteria by computing a score. Stats outside the given ranges lower the score, and special abilities that are useful for a role raise the score.

      This method calculates AlphaStrike statistics for the Entity as the first step in the calculation.

      Parameters:
      entity - The unit to be checked for role qualification
      tolerance - A measure of how strictly to apply the qualifications. A value of zero is more or less by the book, while values below 0 are more liberal and above 0 are stricter.
      Returns:
      Boolean value indicating whether the unit meets the qualifications for this role.
    • qualifiesForRole

      @Deprecated(since="0.51.0", forRemoval=true) public boolean qualifiesForRole(AlphaStrikeElement unit)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Applies the criteria from Alpha Strike Companion to determine whether a unit qualifies for a particular role. As the canon unit roles do not themselves adhere strictly to the guidelines, there is some allowance for fuzziness in applying the criteria by computing a score. Stats outside the given ranges lower the score, and special abilities that are useful for a role raise the score.
      Parameters:
      unit - The unit to be checked for role qualification
      Returns:
      Boolean value indicating whether the unit meets the qualifications for this role.
    • qualifiesForRole

      public boolean qualifiesForRole(AlphaStrikeElement unit, double tolerance)
      Applies the criteria from Alpha Strike Companion to determine whether a unit qualifies for a particular role. As the canon unit roles do not themselves adhere strictly to the guidelines, there is some allowance for fuzziness in applying the criteria by computing a score. Stats outside the given ranges lower the score, and special abilities that are useful for a role raise the score.
      Parameters:
      unit - The unit to be checked for role qualification
      tolerance - A measure of how strictly to apply the qualifications. A value of zero is more or less by the book, while values < 0 are more liberal and > 0 are stricter.
      Returns:
      Boolean value indicating whether the unit meets the qualifications for this role.
    • toString

      public String toString()
      Overrides:
      toString in class Enum<UnitRole>