Class ContractSupportPayments

java.lang.Object
mekhq.campaign.mission.contract.contractSpecialRules.ContractSupportPayments

public final class ContractSupportPayments extends Object
Renders the ongoing support an employer owes the player during a contract: the straight-support share of repair and maintenance costs, and battle loss compensation for units lost beyond repair.

Both are paid as they are earned for an ordinary contract. Under the #NO_IN_CONTRACT_SUPPORT special rule they are instead withheld onto the contract (see AbstractContract.changeWithheldSupportPayments(Money)) and settled as a single lump sum when the contract ends through renderWithheldSupport(Campaign, AbstractContract).

Straight support is a per-contract term but repairs and maintenance are campaign-wide costs, so the share is drawn from the active contract offering the most generous support (see getStraightSupportContract(Campaign)). Battle loss compensation, by contrast, is settled against the specific contract whose scenario cost the unit.

Both payouts are doubled for a contract carrying the ChaosObjectiveSpecialRules.DOUBLE_SUPPORT_PAYOUTS special rule. The doubling is applied before the withhold check, so a contract that also carries ChaosObjectiveSpecialRules.NO_IN_CONTRACT_SUPPORT withholds - and later pays out - the already-doubled amount.

Since:
0.51.01
  • Method Details

    • reimburseStraightSupport

      public static void reimburseStraightSupport(Campaign campaign, Money cost, String costDescription)
      Reimburses the straight-support share of a campaign-wide cost the player has just paid, such as a repair or a maintenance charge.

      The share is cost * the support multiplier of the active contract offering the most generous straight support, doubled when that contract carries ChaosObjectiveSpecialRules.DOUBLE_SUPPORT_PAYOUTS. When the contract carries the ChaosObjectiveSpecialRules.NO_IN_CONTRACT_SUPPORT special rule the share is withheld until the contract ends; otherwise it is credited immediately. Does nothing when the cost is not positive, no contract is active, or the support multiplier is zero.

      Parameters:
      campaign - the active campaign
      cost - the cost the player paid, whose support share is reimbursed
      costDescription - a short description of the cost, used in the ledger note (e.g. the repaired part or unit)
      Since:
      0.51.01
    • payBattlefieldLoss

      public static void payBattlefieldLoss(Campaign campaign, AbstractContract contract, Money amount, String unitName)
      Settles battle loss compensation for a unit lost beyond repair, either crediting it immediately or, under the ChaosObjectiveSpecialRules.NO_IN_CONTRACT_SUPPORT special rule, withholding it until the contract ends.

      The amount is doubled when the contract carries ChaosObjectiveSpecialRules.DOUBLE_SUPPORT_PAYOUTS. Does nothing when the resulting amount is not positive.

      Parameters:
      campaign - the active campaign
      contract - the contract whose scenario cost the unit
      amount - the battle loss compensation owed, before the DOUBLE_SUPPORT_PAYOUTS rule is applied
      unitName - the name of the lost unit, used in the ledger note and report
      Since:
      0.51.01
    • renderWithheldSupport

      public static void renderWithheldSupport(Campaign campaign, AbstractContract contract)
      Pays out, in a single lump sum, all support withheld on the contract under the ChaosObjectiveSpecialRules.NO_IN_CONTRACT_SUPPORT special rule, then clears the withheld total.

      Does nothing when nothing has been withheld, so it is safe to call for every completed contract.

      Parameters:
      campaign - the active campaign
      contract - the contract being completed
      Since:
      0.51.01
    • getStraightSupportContract

      @Nullable public static AbstractContract getStraightSupportContract(Campaign campaign)
      Parameters:
      campaign - the active campaign
      Returns:
      the active contract offering the highest straight-support multiplier, or null when no contract is active
      Since:
      0.51.01