Class PerformResupply
java.lang.Object
mekhq.campaign.mission.resupplyAndCaches.PerformResupply
The
PerformResupply
class handles the execution and management of resupply operations within MekHQ campaigns.
It covers various aspects of resupply, including generating convoy contents, distributing supplies, resolving convoy
interceptions, and facilitating player interaction through dialogs tied to specific resupply scenarios.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
loadPlayerConvoys
(Resupply resupply) Loads and organizes player convoys for a resupply operation.static void
makeDelivery
(Resupply resupply, List<Part> contents) Facilitates the delivery of resupply contents to the campaign's resources.static void
makeSmugglerDelivery
(Resupply resupply) Facilitates the delivery of supplies through smugglers, incorporating chances for smuggler swindling.static void
performResupply
(Resupply resupply, AtBContract contract) Initiates the resupply process for a specified campaign and active contract.static void
performResupply
(Resupply resupply, AtBContract contract, int dropCount) Executes the resupply process for a specified campaign, contract, and supply drop count.static void
processConvoy
(Resupply resupply, List<Part> convoyContents, Force playerConvoy) Processes convoy interactions, resolving outcomes based on player decisions, convoy details, and interception chances.
-
Field Details
-
RESUPPLY_LOOT_BOX_NAME
- See Also:
-
-
Constructor Details
-
PerformResupply
public PerformResupply()
-
-
Method Details
-
performResupply
Initiates the resupply process for a specified campaign and active contract.This method provides a simplified entry point to the resupply workflow, using a default value of 1 for the supply drop count. It delegates to the overloaded method
performResupply(Resupply, AtBContract, int)
for the main execution of the resupply process, encompassing supply generation, convoy interaction, and delivery confirmation.This entry point is typically used when the exact number of supply drops is not specified or defaults to a single drop per invocation.
- Parameters:
resupply
- theResupply
instance containing information about the resupply operation, such as the supplies to be delivered, convoy setup, and context-specific rules.contract
- theAtBContract
representing the current contract, which provides the operational context for the resupply, including permissions and restrictions.
-
performResupply
Executes the resupply process for a specified campaign, contract, and supply drop count. This method coordinates supply allocation, convoy interaction, potential for interception, and player confirmation dialogs, ensuring the resupply process adheres to the campaign's context and player decisions.Functionality includes:
- Early-exit handling for invalid cargo tonnage or drop count.
- Displaying dialogs to involve the player in choosing convoys or resupply focus.
- Randomized content generation for armor, ammo, and parts.
- Dialog-based confirmation for resupply delivery and associated costs.
- Parameters:
resupply
- theResupply
instance that defines the campaign's resupply operation, including cargo, player and NPC convoys, and mission-related data.contract
- theAtBContract
representing the context of the current contract, determining aspects such as independent resupply permissions and guerrilla warfare rules.dropCount
- the number of supply drops planned for this resupply operation. If zero, the method exits early.
-
makeDelivery
Facilitates the delivery of resupply contents to the campaign's resources.This method categorizes parts like ammunition, armor, and general equipment, placing them in the warehouse.
-
makeSmugglerDelivery
Facilitates the delivery of supplies through smugglers, incorporating chances for smuggler swindling.Key behaviors:
- Calculates the chance of being swindled based on the contract's morale level.
- If swindled, invokes a dialog to inform the player; otherwise, schedules delivery of supplies.
- Parameters:
resupply
- theResupply
instance defining the resupply context.
-
loadPlayerConvoys
Loads and organizes player convoys for a resupply operation. It calculates available convoy capacities, sorts convoys and contents, and assigns parts to convoys based on capacity.- Parameters:
resupply
- theResupply
instance containing convoy and mission-specific data.
-
processConvoy
public static void processConvoy(Resupply resupply, List<Part> convoyContents, @Nullable Force playerConvoy) Processes convoy interactions, resolving outcomes based on player decisions, convoy details, and interception chances. This includes factors such as convoy weight and morale influence.Handles logic for:
- Calculating interception chances based on convoy weight and mission context.
- Generating roleplay events for player convoys.
- Triggering convoys and interception scenarios.
-