Package megamek.common.units
Enum Class UnitRole
- All Implemented Interfaces:
Serializable,Comparable<UnitRole>,Constable
Unit roles as defined by Alpha Strike Companion, used in formation building rules in ASC and Campaign Operations
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionGround unit rolesAerospace unit rolesShows that this unit intentionally has no combat role.This is the default role; given to units where the role definition is missing. -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasRole()booleanChecks if this role is the same as the given role or any of the otherbooleanisAvailableTo(BTObject unit) static UnitRoleParses the given string into the UnitRole if possible and returns it.booleanDeprecated, for removal: This API element is subject to removal in a future version.booleanqualifiesForRole(AlphaStrikeElement unit, double tolerance) Applies the criteria from Alpha Strike Companion to determine whether a unit qualifies for a particular role.booleanqualifiesForRole(Entity entity) Deprecated, for removal: This API element is subject to removal in a future version.booleanqualifiesForRole(Entity entity, double tolerance) Deprecated, for removal: This API element is subject to removal in a future version.toString()static UnitRoleReturns the enum constant of this class with the specified name.static UnitRole[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UNDETERMINED
This is the default role; given to units where the role definition is missing. -
NONE
Shows that this unit intentionally has no combat role. -
AMBUSHER
Ground unit roles -
BRAWLER
-
JUGGERNAUT
-
MISSILE_BOAT
-
SCOUT
-
SKIRMISHER
-
SNIPER
-
STRIKER
-
ATTACK_FIGHTER
Aerospace unit roles -
DOGFIGHTER
-
FAST_DOGFIGHTER
-
FIRE_SUPPORT
-
INTERCEPTOR
-
TRANSPORT
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
isAvailableTo
- Parameters:
unit- The unit to check.- Returns:
- True when the given unit may use this role. Used in MML.
-
isAnyOf
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
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, 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 qualificationtolerance- 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
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 qualificationtolerance- 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
-