Enum Class FacilityTrait

java.lang.Object
java.lang.Enum<FacilityTrait>
mekhq.campaign.digitalGM.stratCon.facility.FacilityTrait
All Implemented Interfaces:
Serializable, Comparable<FacilityTrait>, Constable

public enum FacilityTrait extends Enum<FacilityTrait>
Something particular about one facility, rolled when it is placed, so that two facilities of the same type need not play the same. The player sees a facility's traits once they have detailed intel on it.

A garrison trait describes the troops holding the facility, so it is lost when the facility changes sides. A site trait describes the place itself and stays with it.

Since:
0.51.01
  • Enum Constant Details

    • UNDERMANNED

      public static final FacilityTrait UNDERMANNED
      One garrison step fewer than its tier allows. Never rolled on an Outpost, which would be left empty.
    • VETERAN_GARRISON

      public static final FacilityTrait VETERAN_GARRISON
      Held by veterans: fights at an enemy facility face better-skilled troops; an employer's facility defends itself better when you stay away from a counterattack.
    • POOR_MORALE

      public static final FacilityTrait POOR_MORALE
      Its troops would rather not be there: an enemy facility under siege surrenders one garrison step sooner; an employer's facility defends itself worse when you stay away from a counterattack.
    • HARDENED

      public static final FacilityTrait HARDENED
      Built to take punishment: an attacker who wins short of capturing it does no damage, and sabotage only one step.
    • WELL_STOCKED

      public static final FacilityTrait WELL_STOCKED
      Full stores: a won raid on an enemy one brings in extra Employer Support, and one your side holds provides extra Employer Support each month.
    • EXPERIMENTAL_WEAPONS

      public static final FacilityTrait EXPERIMENTAL_WEAPONS
      Prototype gear: fights at an enemy facility face better-equipped troops, and capturing it brings in Employer Support once, as the gear is traded to your employer.
  • Field Details

    • WELL_STOCKED_RAID_SUPPORT

      public static final int WELL_STOCKED_RAID_SUPPORT
      Employer Support a won raid on a well-stocked enemy facility brings in.
      Since:
      0.51.01
      See Also:
    • WELL_STOCKED_MONTHLY_SUPPORT

      public static final int WELL_STOCKED_MONTHLY_SUPPORT
      Extra Employer Support a well-stocked facility your side holds provides each month.
      Since:
      0.51.01
      See Also:
    • EXPERIMENTAL_WEAPONS_CAPTURE_SUPPORT

      public static final int EXPERIMENTAL_WEAPONS_CAPTURE_SUPPORT
      Employer Support capturing a facility with experimental weapons brings in.
      Since:
      0.51.01
      See Also:
    • OFF_SCREEN_DEFENSE_MODIFIER

      public static final int OFF_SCREEN_DEFENSE_MODIFIER
      The off-screen defence modifier for a veteran (or, negated, a poor-morale) garrison.
      Since:
      0.51.01
      See Also:
    • MAXIMUM_TRAITS

      public static final int MAXIMUM_TRAITS
      The most traits a facility is given.
      Since:
      0.51.01
      See Also:
  • Method Details

    • values

      public static FacilityTrait[] 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 FacilityTrait 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
    • isGarrisonTrait

      public boolean isGarrisonTrait()
      Returns:
      true if the trait describes the facility's troops, and so is lost when it changes sides
      Since:
      0.51.01
    • isAllowedFor

      public boolean isAllowedFor(StratConFacility.FacilityTier tier)
      Parameters:
      tier - a facility's tier
      Returns:
      true if a facility of that tier can be given this trait
      Since:
      0.51.01
    • getConflictingTrait

      @Nullable public FacilityTrait getConflictingTrait()
      Returns:
      the trait that cannot sit alongside this one, or null if any may
      Since:
      0.51.01
    • getTraitCount

      public static int getTraitCount(int roll)
      Parameters:
      roll - a 2d6 roll
      Returns:
      how many traits a newly placed facility gets: none on 6 or less, one on 7 to 9, two on 10 or more
      Since:
      0.51.01
    • assignRandomTraits

      public static void assignRandomTraits(StratConFacility facility)
      Rolls how many traits a newly placed facility gets and picks them (see getTraitCount(int) and pickTraits(mekhq.campaign.digitalGM.stratCon.facility.StratConFacility.FacilityTier, int, java.util.function.IntUnaryOperator)), giving them to the facility. Call it once the facility's tier is set; its garrison is trimmed to what the traits allow.
      Parameters:
      facility - the facility just placed
      Since:
      0.51.01
    • pickTraits

      public static List<FacilityTrait> pickTraits(StratConFacility.FacilityTier tier, int count, IntUnaryOperator randomizer)
      Picks traits for a newly placed facility, skipping any its tier does not allow and any that conflict with one already picked.
      Parameters:
      tier - the facility's tier
      count - how many traits to pick (see getTraitCount(int))
      randomizer - gives a random index below its argument
      Returns:
      the traits, in the order picked
      Since:
      0.51.01
    • pickTraits

      public static List<FacilityTrait> pickTraits(StratConFacility.FacilityTier tier, int count, IntUnaryOperator randomizer, Set<FacilityTrait> excluded)
      As pickTraits(FacilityTier, int, IntUnaryOperator), but never picking any of the excluded traits.
      Parameters:
      tier - the facility's tier
      count - how many traits to pick (see getTraitCount(int))
      randomizer - gives a random index below its argument
      excluded - traits that may not be picked
      Returns:
      the traits, in the order picked
      Since:
      0.51.01