Class AtBContract

Direct Known Subclasses:
AtBContract.AtBContractRef

@Deprecated(since="0.51.01", forRemoval=false) public class AtBContract extends Contract
Deprecated.
Contract class for use with Against the Bot rules
  • Field Details

    • parentContract

      protected AtBContract parentContract
      Deprecated.
    • extensionLength

      protected int extensionLength
      Deprecated.
    • playerMinorBreaches

      protected int playerMinorBreaches
      Deprecated.
    • employerMinorBreaches

      protected int employerMinorBreaches
      Deprecated.
    • contractScoreArbitraryModifier

      protected int contractScoreArbitraryModifier
      Deprecated.
    • moraleMod

      protected int moraleMod
      Deprecated.
    • priorLogisticsFailure

      protected boolean priorLogisticsFailure
      Deprecated.
    • specialEventScenarioDate

      protected LocalDate specialEventScenarioDate
      Deprecated.
      If the date is non-null, there will be a special scenario or big battle on that date, but the scenario is not generated until the other battle rolls for the week.
    • specialEventScenarioType

      protected int specialEventScenarioType
      Deprecated.
    • battleTypeMod

      protected int battleTypeMod
      Deprecated.
    • nextWeekBattleTypeMod

      protected int nextWeekBattleTypeMod
      Deprecated.
  • Constructor Details

    • AtBContract

      protected AtBContract()
      Deprecated.
    • AtBContract

      public AtBContract(String name)
      Deprecated.
    • AtBContract

      public AtBContract(Contract contract, Campaign campaign)
      Deprecated.
  • Method Details

    • initContractDetails

      public void initContractDetails(Campaign campaign)
      Deprecated.
    • calculateLength

      public void calculateLength(boolean variable)
      Deprecated.
    • checkMorale

      public void checkMorale(Campaign campaign, LocalDate today)
      Deprecated.
      Checks and updates the morale which depends on various conditions such as the rout end date, skill levels, victories, defeats, etc. This method also updates the enemy status based on the morale level.
      Parameters:
      today - The current date in the context.
    • updateEnemy

      public void updateEnemy(Campaign campaign, LocalDate today, @Nullable String enemyCode)
      Deprecated.
      Updates the enemy faction and enemy bot name for this contract.
      Parameters:
      campaign - The current campaign.
      today - The current LocalDate object.
      enemyCode - Nullable the code for the new faction, if null an appropriate random faction will be used
    • getRepairLocation

      public int getRepairLocation()
      Deprecated.
      Determines the repair location for the contract based on the contract type.

      The returned repair location corresponds to the type of operation:

      Overrides:
      getRepairLocation in class AbstractMissionTransition
      Returns:
      the repair location constant based on the contract type
    • getBestRepairLocation

      public static int getBestRepairLocation(List<AtBContract> activeContracts)
      Deprecated.
      Determines the best available repair location from a list of active contracts.

      This method evaluates all active contracts and returns the highest quality repair facility available. Repair locations are ranked numerically, with higher values representing better facilities. If no active contracts exist, a basic facility is assumed to be available.

      Parameters:
      activeContracts - the list of active contracts to evaluate for repair facilities
      Returns:
      the numeric value of the best available repair location; returns Unit.SITE_FACILITY_BASIC if no contracts are active
    • getContractScore

      public int getContractScore(boolean isUseMaplessMode)
      Deprecated.
      Calculates the overall contract score based on scenario outcomes and modifiers.

      For StratCon campaigns, this returns the current victory points from the campaign state.

      For standard contracts, this aggregates scores from all completed scenarios and applies any arbitrary modifiers that have been set for this contract.

      Parameters:
      isUseMaplessMode - true if mapless mode is enabled in StratCon
      Returns:
      the total contract score, including victory points or scenario scores plus modifiers
    • getCurrentSupportPoints

      public int getCurrentSupportPoints()
      Deprecated.
      Returns:
      the total available support points, or 0 if StratCon is not enabled for this contract
      Since:
      0.50.10
    • getContractScoreArbitraryModifier

      public int getContractScoreArbitraryModifier()
      Deprecated.
    • doBonusRoll

      public boolean doBonusRoll(Campaign campaign, boolean isPostScenario)
      Deprecated.
      Performs a bonus roll to determine and execute a random campaign bonus. The roll is simulated using 1d6, and the outcome triggers different bonus effects based on the roll value. The effects may involve recruiting dependents, adding new units, or other benefits as determined by the campaign options and roll outcome.
      Parameters:
      campaign - the current Campaign instance.
      isPostScenario - a boolean indicating if this roll occurs post-scenario (used to determine specific behaviors for roll = 3).
      Returns:
      true if specific post-scenario behavior is triggered (roll = 3), otherwise false.
      Throws:
      IllegalStateException - if an unexpected roll value is encountered.
    • isSubcontract

      public boolean isSubcontract()
      Deprecated.
    • getParentContract

      public AtBContract getParentContract()
      Deprecated.
    • setParentContract

      public void setParentContract(AtBContract parent)
      Deprecated.
    • isMercSubcontract

      public boolean isMercSubcontract()
      Deprecated.
    • setMercSubcontract

      public void setMercSubcontract(boolean sub)
      Deprecated.
    • checkEvents

      public void checkEvents(Campaign campaign)
      Deprecated.
    • getRandomDayOfMonth

      public LocalDate getRandomDayOfMonth(LocalDate today)
      Deprecated.
    • contractExtended

      public boolean contractExtended(Campaign campaign)
      Deprecated.
    • getMonthlyPayOut

      public Money getMonthlyPayOut()
      Deprecated.
      Overrides:
      getMonthlyPayOut in class AbstractMissionTransition
    • writeToXMLBegin

      protected int writeToXMLBegin(Campaign campaign, PrintWriter printWriter, int indent)
      Deprecated.
      Description copied from class: AbstractMissionTransition
      Writes all AbstractMissionTransition fields to XML. Subclasses that have their own private fields must override this, call super.writeToXMLBegin(...), append only their private tags, and return the resulting indent.
      Overrides:
      writeToXMLBegin in class Contract
    • loadFieldsFromXmlNode

      public void loadFieldsFromXmlNode(Campaign campaign, megamek.Version version, Node node) throws ParseException
      Deprecated.
      Description copied from class: AbstractMissionTransition
      Parses all AbstractMissionTransition fields from child nodes of the mission XML element. Subclasses with private fields must override this, call super.loadFieldsFromXmlNode(...), then handle only their own nodes.
      Overrides:
      loadFieldsFromXmlNode in class Contract
      Throws:
      ParseException
    • restore

      public void restore(Campaign c)
      Deprecated.
      Restores any references to other contracts.
      Parameters:
      c - The Campaign which holds this contract.
    • getEmployerName

      public String getEmployerName(int year)
      Deprecated.
      Overrides:
      getEmployerName in class AbstractMissionTransition
    • addPlayerMinorBreach

      public void addPlayerMinorBreach()
      Deprecated.
    • addPlayerMinorBreaches

      public void addPlayerMinorBreaches(int num)
      Deprecated.
    • setContractScoreArbitraryModifier

      public void setContractScoreArbitraryModifier(int newModifier)
      Deprecated.
    • getBattleTypeMod

      public int getBattleTypeMod()
      Deprecated.
    • acceptContract

      public void acceptContract(Campaign campaign)
      Deprecated.
      Description copied from class: AbstractMissionTransition
      Calculations to be performed once the contract has been accepted.
      Overrides:
      acceptContract in class AbstractMissionTransition
    • clanTechSalvageOverride

      public void clanTechSalvageOverride()
      Deprecated.
      Applies a salvage override rule for Clan technology based on the contract timeline and faction involvement. This method checks the factions of both the enemy and employer and determines if a salvage exchange should be forced based on whether the battle occurs before the Battle of Tukayyid.

      This rule was implemented to better match canon employer behavior during this period.

    • getRequiredVictoryPoints

      public int getRequiredVictoryPoints()
      Deprecated.
      Calculates the number of required Victory Points (VP) needed to achieve overall success for this StratCon contract.

      The calculation is based on several averaged campaign parameters:

      • Base requirement — Required number of combat teams multiplied by the contract length.
      • Scenario odds — The mean scenario-odds percentage across all StratCon tracks, converted to a probability.
      • Turning point chance — A scaling factor based on command rights: INTEGRATED contracts assume a 100% chance, while all others use a one-third chance.

      The final result estimates the expected number of Turning Points the player must win for overall contract success. If the player loses a handful of Turning Points, they should still be able to win the contract by being proactive in the Area of Operations.

      Returns:
      the required number of Victory Points, rounded up to the nearest integer
      Since:
      0.50.10