Skip to content

Commit

Permalink
Enable pre-deployed forces seeding in StratCon missions
Browse files Browse the repository at this point in the history
Made `seedPreDeployedForces` method public to allow seeding of pre-deployed forces in StratCon tracks. Also added logic to handle pre-deployment for garrison and pirate hunting contract types.
  • Loading branch information
IllianiCBT committed Nov 21, 2024
1 parent 11ba6b5 commit 74aa6d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions MekHQ/src/mekhq/campaign/mission/AtBContract.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
import static megamek.common.enums.SkillLevel.parseFromString;
import static mekhq.campaign.mission.AtBDynamicScenarioFactory.getEntity;
import static mekhq.campaign.mission.BotForceRandomizer.UNIT_WEIGHT_UNSPECIFIED;
import static mekhq.campaign.stratcon.StratconContractInitializer.seedPreDeployedForces;
import static mekhq.campaign.universe.Factions.getFactionLogo;
import static mekhq.campaign.universe.fameAndInfamy.BatchallFactions.BATCHALL_FACTIONS;
import static mekhq.gui.dialog.HireBulkPersonnelDialog.overrideSkills;
Expand Down Expand Up @@ -434,6 +435,12 @@ public void checkMorale(Campaign campaign, LocalDate today) {
routEnd = null;

updateEnemy(campaign, today); // mix it up a little

if (campaign.getCampaignOptions().isUseStratCon()) {
for (StratconTrackState track : getStratconCampaignState().getTracks()) {
seedPreDeployedForces(this, campaign, track);
}
}
} else {
setMoraleLevel(AtBMoraleLevel.ROUTED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public static void initializeCampaignState(AtBContract contract, Campaign campai
* @return a boolean where {@code true} means forces were not deployed due to being garrison
* type or pirate hunting and {@code false} implies forces have been deployed successfully.
*/
private static boolean seedPreDeployedForces(AtBContract contract, Campaign campaign, StratconTrackState track) {
public static boolean seedPreDeployedForces(AtBContract contract, Campaign campaign, StratconTrackState track) {
AtBContractType contractType = contract.getContractType();

// If the contract is a garrison type, we don't want to generate what will appear to be
Expand All @@ -242,7 +242,9 @@ private static boolean seedPreDeployedForces(AtBContract contract, Campaign camp

int multiplier = DEFENSIVE_MULTIPLIER;

if (contractType.isRaidType() || contractType.isGuerrillaWarfare()) {
if (contractType.isGarrisonType() || contractType.isPirateHunting()) {
multiplier = (int) (DEFENSIVE_MULTIPLIER * 1.5);
} else if (contractType.isRaidType() || contractType.isGuerrillaWarfare()) {
multiplier = OFFENSIVE_MULTIPLIER;
} else if (contract.getContractType().isPlanetaryAssault()) {
multiplier = OFFENSIVE_MULTIPLIER / 2;
Expand Down

0 comments on commit 74aa6d4

Please sign in to comment.