Package megamek.client.ratgenerator
Enum Class MissionRole
- All Implemented Interfaces:
Serializable,Comparable<MissionRole>,Constable
Used to adjust availability to conform to a particular mission role.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Method Summary
Modifier and TypeMethodDescriptionstatic DoubleadjustAvailabilityByRole(double avRating, Collection<MissionRole> desiredRoles, ModelRecord mRec, int year, int strictness) Adjusts the provided availability rating based on desired roles, the roles the provided unit has, and other factors such as unit type, movement speed, and weapon types.booleanfitsUnitType(int unitType) Identifies if a role applies to a given unit typestatic MissionRoleConvert role from string to enum.toString()static MissionRoleReturns the enum constant of this class with the specified name.static MissionRole[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
RECON
-
RAIDER
-
INCENDIARY
-
EW_SUPPORT
-
ARTILLERY
-
MISSILE_ARTILLERY
-
APC
-
TRAINING
-
COMMAND
-
CARGO
-
SUPPORT
-
CIVILIAN
-
FIRE_SUPPORT
-
SR_FIRE_SUPPORT
-
URBAN
-
SPOTTER
-
ANTI_AIRCRAFT
-
ANTI_INFANTRY
-
INF_SUPPORT
-
CAVALRY
-
SPECOPS
-
ENGINEER
-
MINESWEEPER
-
MINELAYER
-
BOMBER
-
ESCORT
-
INTERCEPTOR
-
GROUND_SUPPORT
-
ASSAULT
-
MEK_CARRIER
-
ASF_CARRIER
-
VEE_CARRIER
-
INFANTRY_CARRIER
-
BA_CARRIER
-
TROOP_CARRIER
-
TUG
-
POCKET_WARSHIP
-
PROTOMEK_CARRIER
-
CORVETTE
-
DESTROYER
-
FRIGATE
-
CRUISER
-
BATTLESHIP
-
OMNI
-
MECHANIZED_BA
-
MAG_CLAMP
-
MARINE
-
MOUNTAINEER
-
XCT
-
PARATROOPER
-
ANTI_MEK
-
FIELD_GUN
-
MIXED_ARTILLERY
-
GENERATOR
-
CONTROL
-
-
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
-
fitsUnitType
public boolean fitsUnitType(int unitType) Identifies if a role applies to a given unit type- Parameters:
unitType- type of unit to check- Returns:
trueif role applies to the provided unit type
-
adjustAvailabilityByRole
public static Double adjustAvailabilityByRole(double avRating, Collection<MissionRole> desiredRoles, ModelRecord mRec, int year, int strictness) Adjusts the provided availability rating based on desired roles, the roles the provided unit has, and other factors such as unit type, movement speed, and weapon types.- Parameters:
avRating- Availability rating as positive number, typically 0-10desiredRoles- Roles that are desired or mandatory, use null for general usemRec- ModelRecord of specific unit to checkyear- Year to test instrictness- Zero or higher, larger values are more restrictive- Returns:
- Modified avRating, higher if better suited for a specific role, lower if less suited, or null if unit is not compatible
-
parseRole
Convert role from string to enum. Underscores (_) are treated as spaces, all characters are forced to lower case for comparisons.- Parameters:
role- role name- Returns:
- Null if an unrecognized role string is provided
-
toString
- Overrides:
toStringin classEnum<MissionRole>
-