Class StratConFacilityOperations

java.lang.Object
mekhq.campaign.digitalGM.stratCon.facility.StratConFacilityOperations

public final class StratConFacilityOperations extends Object
The rules for the orders a player gives deployed formations at facilities (see FacilityOperation), and for what the player does with a facility they capture (see FacilityCaptureChoice). All of it applies only with the Facility Operations campaign option; without it, deploying onto an enemy facility starts an assault, as it always has.

Every order costs support points, paid when it is given. Raid and Assault start a scenario on the facility at once. Sabotage is rolled at once, and only a caught saboteur fights. Fortify and Reinforce take effect at once. Recon and Build take time: the formation stays deployed until the order completes, and the order is stored on the sector until then. A siege is stored the same way, but has no set end (see StratConFacilitySiege).

Since:
0.51.01
  • Field Details

    • SABOTAGE_CAUGHT_MODIFIER

      public static final String SABOTAGE_CAUGHT_MODIFIER
      The extra enemy force caught saboteurs face.
      See Also:
  • Method Details

    • isEnabled

      public static boolean isEnabled(Campaign campaign)
      Parameters:
      campaign - the current campaign
      Returns:
      true if players give facility orders, rather than deploying onto a facility to assault it
      Since:
      0.51.01
    • getSupportPointCost

      public static int getSupportPointCost(@Nullable StratConCampaignState campaignState, FacilityOperation operation)
      Parameters:
      campaignState - the contract's StratCon campaign state, or null for the base cost
      operation - an order
      Returns:
      what the order costs in support points right now: for a Build, the base cost plus one for each facility your side has built and still holds, or is building
      Since:
      0.51.01
    • countBuiltFacilities

      public static int countBuiltFacilities(StratConCampaignState campaignState)
      Parameters:
      campaignState - the contract's StratCon campaign state
      Returns:
      how many facilities your side has built and still holds, plus those being built, across the contract
      Since:
      0.51.01
    • getSupportPointCost

      public static int getSupportPointCost(FacilityOperation operation)
      Parameters:
      operation - an order
      Returns:
      what the order costs in support points before anything raises it (see getSupportPointCost(StratConCampaignState, FacilityOperation))
      Since:
      0.51.01
    • getObjectiveModifierId

      public static String getObjectiveModifierId(FacilityOperation operation)
      Parameters:
      operation - an order that can lead to a fight on a facility
      Returns:
      the ID of the scenario modifier holding that fight's objective; an assault's for an order that never fights
      Since:
      0.51.01
    • getOperationsFor

      public static List<FacilityOperation> getOperationsFor(StratConTrackState track, StratConCoords coords)
      Parameters:
      track - a sector
      coords - a hex in it
      Returns:
      the orders that make sense on that hex, whether or not they can be given right now: the enemy facility orders on an enemy facility, Fortify and Reinforce on the player's side's facility, and Build on a hex with nothing on it, along with Interdict Supply if it carries a road
      Since:
      0.51.01
    • getKnownFacility

      @Nullable public static StratConFacility getKnownFacility(StratConTrackState track, StratConCoords coords)
      Parameters:
      track - a sector
      coords - a hex in it
      Returns:
      the facility on the hex if the player knows it is there (see isKnownToPlayer(mekhq.campaign.digitalGM.stratCon.StratConTrackState, mekhq.campaign.digitalGM.stratCon.facility.StratConFacility)), or null if there is none or the player can't see it. An enemy facility the player hasn't found is treated as absent, so orders can't be used to find it.
      Since:
      0.51.01
    • isKnownToPlayer

      public static boolean isKnownToPlayer(StratConTrackState track, StratConFacility facility)
      The one test of whether the player knows a facility is there, used alike by the map, the facility window, the Facilities overview and the orders: their side holds it, they have located it, or the whole sector is revealed (by a facility that reveals it, or by the GM).
      Parameters:
      track - the facility's sector
      facility - the facility
      Returns:
      true if the player knows the facility is there
      Since:
      0.51.01
    • getUnavailableReasonKey

      @Nullable public static String getUnavailableReasonKey(Campaign campaign, AbstractContract contract, StratConTrackState track, StratConCoords coords, FacilityOperation operation)
      Checks whether an order can be given on a hex at all, leaving aside which formation would carry it out.
      Parameters:
      campaign - the current campaign
      contract - the contract whose map holds the sector
      track - the sector
      coords - the hex the order acts on
      operation - the order
      Returns:
      the resource key of the reason it cannot be given, or null if it can
      Since:
      0.51.01
    • getEligibleFormationIds

      public static List<Integer> getEligibleFormationIds(Campaign campaign, StratConTrackState track, StratConCoords coords, FacilityOperation operation)
      Parameters:
      campaign - the current campaign
      track - the sector
      coords - the hex the order acts on
      operation - the order
      Returns:
      the IDs of the formations that could carry out the order, in ID order: those deployed on the hex, or next to it for an order that allows that, that are neither in a scenario nor carrying out another order
      Since:
      0.51.01
    • getBuildableDefinitions

      public static List<StratConFacilityDefinition> getBuildableDefinitions()
      Returns:
      the facility definitions a Build order can raise: those of a field-built type (see BUILDABLE_TYPES) with a profile for the player's side
      Since:
      0.51.01
    • issueOrder

      public static boolean issueOrder(Campaign campaign, AbstractContract contract, StratConTrackState track, StratConCoords coords, int formationId, FacilityOperation operation, @Nullable StratConFacilityDefinition buildDefinition)
      Gives an order, paying its support points. An order that cannot be given, or whose scenario could not be generated, changes nothing and costs nothing.
      Parameters:
      campaign - the current campaign
      contract - the contract whose map holds the sector
      track - the sector
      coords - the hex the order acts on
      formationId - the ID of the formation carrying it out
      operation - the order
      buildDefinition - for FacilityOperation.BUILD, what to build; otherwise ignored
      Returns:
      true if the order was given
      Since:
      0.51.01
    • processOrders

      public static void processOrders(StratConTrackState track, Campaign campaign)
      Moves the sector's timed orders on by a day. An order is abandoned if its formation has left, or, for a build, if anything else has turned up on the hex; the support points it cost are not returned. An order due today completes.
      Parameters:
      track - the sector
      campaign - the current campaign
      Since:
      0.51.01
    • payBuiltFacilityUpkeep

      public static void payBuiltFacilityUpkeep(StratConTrackState track, Campaign campaign)
      Charges the month's upkeep for each facility the player's side has built in a sector (see BUILT_FACILITY_UPKEEP). A facility the player cannot pay for falls into disrepair: its condition drops one step. Both are reported.
      Parameters:
      track - the sector
      campaign - the current campaign
      Since:
      0.51.01
    • askCaptureChoice

      public static FacilityCaptureChoice askCaptureChoice(Campaign campaign, StratConFacility facility)
      Asks the player what to do with a facility they have just captured. Without a GUI to ask through, they hold it.
      Parameters:
      campaign - the current campaign
      facility - the captured facility
      Returns:
      the player's choice
      Since:
      0.51.01
    • askCaptureChoice

      public static FacilityCaptureChoice askCaptureChoice(Campaign campaign, StratConFacility facility, boolean canRaze)
      Parameters:
      campaign - the current campaign
      facility - the captured facility
      canRaze - whether Raze may be offered
      Returns:
      the player's choice
      Since:
      0.51.01
    • canRaze

      public static boolean canRaze(StratConTrackState track, StratConCoords coords)
      Parameters:
      track - a sector
      coords - a facility's hex
      Returns:
      false if a strategic objective on the hex needs the facility to still stand - one the player must control - so razing it would fail the objective for good
      Since:
      0.51.01
    • resolveCapture

      public static void resolveCapture(Campaign campaign, AbstractContract contract, StratConTrackState track, StratConCoords coords, FacilityCaptureChoice choice)
      Carries out the player's choice for a facility they have just captured, which is now Allied.
      Parameters:
      campaign - the current campaign
      contract - the contract whose map holds the sector
      track - the sector
      coords - the facility's hex
      choice - the player's choice
      Since:
      0.51.01
    • resolveRaidLoot

      public static void resolveRaidLoot(Campaign campaign, AbstractContract contract, StratConFacility facility)
      Settles what a won raid brings in beyond the damage it did: extra Employer Support from a well-stocked facility.
      Parameters:
      campaign - the current campaign
      contract - the contract whose map holds the facility
      facility - the raided facility
      Since:
      0.51.01