Class RandomDependents

java.lang.Object
mekhq.campaign.personnel.RandomDependents

public class RandomDependents extends Object
The RandomDependents class manages the random addition and removal of dependent personnel based on the current campaign state and options.

This class processes dependents, determining if some should be removed or new dependents added, based on predefined campaign rules.

  • Constructor Details

    • RandomDependents

      public RandomDependents(Campaign campaign)
      Constructs a new RandomDependents instance.

      Initializes the dependent management process by calculating the current dependent capacity, randomly removing dependents, and potentially adding new ones.

      Parameters:
      campaign - The Campaign instance to which dependent operations are applied.
  • Method Details

    • processMonthlyRemovalAndAddition

      public void processMonthlyRemovalAndAddition()
      Processes the monthly removal and addition of dependents based on campaign options and capacity.

      This method manages both the removal and addition of dependents for the campaign within the given constraints. The process consists of two phases:

      • Random addition of new dependents, if enabled in campaign options.
      • Random removal of dependents, if enabled in campaign options.
      The count of dependents is adjusted after the removal phase, and the method ensures the total number of dependents does not exceed the allowed capacity.