diff --git a/MekHQ/src/mekhq/campaign/Campaign.java b/MekHQ/src/mekhq/campaign/Campaign.java index 83a4007dce..560a80fafa 100644 --- a/MekHQ/src/mekhq/campaign/Campaign.java +++ b/MekHQ/src/mekhq/campaign/Campaign.java @@ -3833,8 +3833,8 @@ public int getDeploymentDeficit(AtBContract contract) { return 0; } - int total = -contract.getRequiredLances(); - int role = -max(1, contract.getRequiredLances() / 2); + int total = -contract.getRequiredCombatTeams(); + int role = -max(1, contract.getRequiredCombatTeams() / 2); int minimumUnitCount = (int) ((double) getStandardForceSize(faction) / 2); final CombatRole requiredLanceRole = contract.getContractType().getRequiredLanceRole(); diff --git a/MekHQ/src/mekhq/campaign/CampaignOptions.java b/MekHQ/src/mekhq/campaign/CampaignOptions.java index 7c434f1326..baf86b0420 100644 --- a/MekHQ/src/mekhq/campaign/CampaignOptions.java +++ b/MekHQ/src/mekhq/campaign/CampaignOptions.java @@ -570,7 +570,6 @@ public static String getTransitUnitName(final int unit) { private boolean useStrategy; private int baseStrategyDeployment; private int additionalStrategyDeployment; - private boolean adjustPaymentForStrategy; private final int[] atbBattleChance; private boolean generateChases; @@ -1207,7 +1206,6 @@ public CampaignOptions() { useStrategy = true; baseStrategyDeployment = 3; additionalStrategyDeployment = 1; - adjustPaymentForStrategy = false; atbBattleChance = new int[CombatRole.values().length - 1]; atbBattleChance[CombatRole.MANEUVER.ordinal()] = 40; atbBattleChance[CombatRole.FRONTLINE.ordinal()] = 20; @@ -4569,14 +4567,6 @@ public void setAdditionalStrategyDeployment(final int additionalStrategyDeployme this.additionalStrategyDeployment = additionalStrategyDeployment; } - public boolean isAdjustPaymentForStrategy() { - return adjustPaymentForStrategy; - } - - public void setAdjustPaymentForStrategy(final boolean adjustPaymentForStrategy) { - this.adjustPaymentForStrategy = adjustPaymentForStrategy; - } - public boolean isRestrictPartsByMission() { return restrictPartsByMission; } @@ -5207,7 +5197,6 @@ public void writeToXml(final PrintWriter pw, int indent) { MHQXMLUtility.writeSimpleXMLTag(pw, indent, "useStrategy", useStrategy); MHQXMLUtility.writeSimpleXMLTag(pw, indent, "baseStrategyDeployment", baseStrategyDeployment); MHQXMLUtility.writeSimpleXMLTag(pw, indent, "additionalStrategyDeployment", additionalStrategyDeployment); - MHQXMLUtility.writeSimpleXMLTag(pw, indent, "adjustPaymentForStrategy", adjustPaymentForStrategy); MHQXMLUtility.writeSimpleXMLTag(pw, indent, "restrictPartsByMission", restrictPartsByMission); MHQXMLUtility.writeSimpleXMLTag(pw, indent, "limitLanceWeight", limitLanceWeight); MHQXMLUtility.writeSimpleXMLTag(pw, indent, "limitLanceNumUnits", limitLanceNumUnits); @@ -6237,8 +6226,6 @@ public static CampaignOptions generateCampaignOptionsFromXml(Node wn, Version ve retVal.baseStrategyDeployment = Integer.parseInt(wn2.getTextContent().trim()); } else if (wn2.getNodeName().equalsIgnoreCase("additionalStrategyDeployment")) { retVal.additionalStrategyDeployment = Integer.parseInt(wn2.getTextContent().trim()); - } else if (wn2.getNodeName().equalsIgnoreCase("adjustPaymentForStrategy")) { - retVal.adjustPaymentForStrategy = Boolean.parseBoolean(wn2.getTextContent().trim()); } else if (wn2.getNodeName().equalsIgnoreCase("restrictPartsByMission")) { retVal.restrictPartsByMission = Boolean.parseBoolean(wn2.getTextContent().trim()); } else if (wn2.getNodeName().equalsIgnoreCase("limitLanceWeight")) { diff --git a/MekHQ/src/mekhq/campaign/force/CombatTeam.java b/MekHQ/src/mekhq/campaign/force/CombatTeam.java index d1dd6a608f..aca540879a 100644 --- a/MekHQ/src/mekhq/campaign/force/CombatTeam.java +++ b/MekHQ/src/mekhq/campaign/force/CombatTeam.java @@ -25,6 +25,7 @@ import megamek.common.Entity; import megamek.common.EntityWeightClass; import megamek.common.Infantry; +import megamek.common.annotations.Nullable; import megamek.logging.MMLogger; import mekhq.MekHQ; import mekhq.campaign.Campaign; @@ -745,4 +746,20 @@ private static void recalculateSubForceStrategicStatus(Campaign campaign, recalculateSubForceStrategicStatus(campaign, campaign.getCombatTeamsTable(), force); } } + + /** + * Retrieves the force associated with the given campaign using the stored force ID. + * + *

+ * This method returns a {@link Force} object corresponding to the stored {@code forceId}, + * if it exists within the specified campaign. If no matching force is found, {@code null} + * is returned. + *

+ * + * @param campaign the campaign containing the forces to search for the specified {@code forceId} + * @return the {@link Force} object associated with the {@code forceId}, or {@code null} if not found + */ + public @Nullable Force getForce(Campaign campaign) { + return campaign.getForce(forceId); + } } diff --git a/MekHQ/src/mekhq/campaign/market/contractMarket/AbstractContractMarket.java b/MekHQ/src/mekhq/campaign/market/contractMarket/AbstractContractMarket.java index 34cf7c4f4a..5247afa3a7 100644 --- a/MekHQ/src/mekhq/campaign/market/contractMarket/AbstractContractMarket.java +++ b/MekHQ/src/mekhq/campaign/market/contractMarket/AbstractContractMarket.java @@ -5,6 +5,7 @@ import megamek.common.enums.SkillLevel; import megamek.logging.MMLogger; import mekhq.campaign.Campaign; +import mekhq.campaign.CampaignOptions; import mekhq.campaign.market.enums.ContractMarketMethod; import mekhq.campaign.mission.AtBContract; import mekhq.campaign.mission.Contract; @@ -22,8 +23,6 @@ import java.io.PrintWriter; import java.util.*; -import static java.lang.Math.floor; -import static java.lang.Math.max; import static java.lang.Math.min; import static megamek.common.Compute.d6; import static megamek.common.enums.SkillLevel.REGULAR; @@ -42,6 +41,12 @@ public abstract class AbstractContractMarket { public static final int CLAUSE_TRANSPORT = 3; public static final int CLAUSE_NUM = 4; + /** + * The portion of combat teams we expect to be performing combat actions. + * This is one in 'x' where 'x' is the value set here. + */ + static final double COMBAT_FORCE_DIVIDER = 2; + protected List contracts = new ArrayList<>(); protected int lastId = 0; @@ -182,64 +187,130 @@ protected void updateReport(Campaign campaign) { } /** - * Determines the number of required lances to be deployed for a contract. For Mercenary subcontracts - * this defaults to 1; otherwise, the number is based on the number of combat units in the - * campaign. Modified by a 2d6 roll if {@code bypassVariance} is {@code false}. + * Calculates the required number of combat teams for a contract based on campaign options, + * contract details, and variance factors. * - * @param campaign the current campaign - * @param contract the relevant contract - * @param bypassVariance if {@code true} requirements will not be semi-randomized. - * @return The number of lances required to be deployed. + *

+ * This method determines the number of combat teams needed to deploy, taking into account factors such as: + *

+ * The method ensures values are clamped to maintain a minimum deployment of at least 1 combat + * team while not exceeding the maximum deployable combat teams. + * + * @param campaign the campaign containing relevant options and faction information + * @param contract the contract that specifies details such as subcontract status + * @param bypassVariance a flag indicating whether variance adjustments should be bypassed + * @return the calculated number of required combat teams, ensuring it meets game rules and constraints */ - public int calculateRequiredLances(Campaign campaign, AtBContract contract, boolean bypassVariance) { + public int calculateRequiredCombatTeams(Campaign campaign, AtBContract contract, boolean bypassVariance) { + // Return 1 combat team if the contract is a subcontract if (contract.isSubcontract()) { return 1; } - int formationSize = getStandardForceSize(campaign.getFaction()); - int availableForces = max(getEffectiveNumUnits(campaign) / formationSize, 1); - int maxDeployedLances = availableForces; + // Calculate base formation size and effective unit force + Faction faction = campaign.getFaction(); + int lanceLevelFormationSize = getStandardForceSize(faction); + + int effectiveForces = Math.max(getEffectiveNumUnits(campaign) / lanceLevelFormationSize, 1); + // Calculate maximum deployed forces based on strategy options + int maxDeployableCombatTeams = effectiveForces; if (campaign.getCampaignOptions().isUseStrategy()) { - maxDeployedLances = max(calculateMaxDeployedLances(campaign), 1); + maxDeployableCombatTeams = Math.max(calculateMaxDeployableCombatTeams(campaign), 1); } - availableForces = min(availableForces, maxDeployedLances); + // Clamp available forces to the max deployable limit + int availableForces = Math.min(effectiveForces, maxDeployableCombatTeams); - // If we're bypassing variance, we can early exit here + // If bypassing variance, apply flat reduction (reduce force by 1/3) if (bypassVariance) { - availableForces -= (int) floor((double) availableForces / 3); + return Math.max(availableForces - calculateBypassVarianceReduction(availableForces), 1); + } + + // Apply variance based on a die roll + int varianceRoll = d6(2); + double varianceFactor = calculateVarianceFactor(varianceRoll); - return max(availableForces, 1); + // Adjust available forces based on variance, ensuring minimum clamping + int adjustedForces = availableForces - (int) Math.floor((double) availableForces / varianceFactor); + + if (adjustedForces < 1) { + adjustedForces = 1; } - // Otherwise, we roll to determine the amount we divide availableForces by - int roll = d6(2); - double varianceFactor = switch (roll) { - case 2 -> 4.5; - case 3 -> 4; - case 4 -> 3.5; - case 10 -> 2.5; - case 11 -> 2; - case 12 -> 1.5; - default -> 3; - }; + // Return the clamped value, ensuring it does not exceed max-deployable forces + return Math.min(adjustedForces, maxDeployableCombatTeams); + } - availableForces -= (int) floor((double) availableForces / varianceFactor); + /** + * Calculates the variance factor based on the given roll value and a fixed formation size divisor. + * + *

+ * The variance factor is determined by applying a multiplier to the fixed formation size divisor. + * The multiplier varies based on the roll value: + *

+ * + * @param roll the roll value used to determine the multiplier + * @return the calculated variance factor as a double + */ + private double calculateVarianceFactor(int roll) { + return switch (roll) { + case 2 -> COMBAT_FORCE_DIVIDER * 0.25; + case 3 -> COMBAT_FORCE_DIVIDER * 0.5; + case 4 -> COMBAT_FORCE_DIVIDER * 0.75; + case 10 -> COMBAT_FORCE_DIVIDER * 1.25; + case 11 -> COMBAT_FORCE_DIVIDER * 1.5; + case 12 -> COMBAT_FORCE_DIVIDER * 1.75; + default -> COMBAT_FORCE_DIVIDER; // 5-9 + }; + } - return max(availableForces, 1); + /** + * Calculates the bypass variance reduction based on the available forces. + * + *

+ * The reduction is calculated by dividing the available forces by a fixed factor of 3 + * and rounding down to the nearest whole number. This value is used in scenarios where + * variance adjustments are bypassed. + *

+ * + * @param availableForces the total number of forces available + * @return the bypass variance reduction as an integer + */ + private int calculateBypassVarianceReduction(int availableForces) { + return (int) Math.floor((double) availableForces / 3); } /** - * Determine the maximum number of lances the force can deploy. The result is based on the - * commander's Strategy skill and various campaign options. - * @param campaign - * @return the maximum number of lances that can be deployed on the contract. + * Calculates the maximum number of deployable combat teams based on the given campaign's options. + * + *

+ * This method retrieves campaign options and calculates the total deployable combat teams using + * the base strategy deployment, additional strategy deployment, and the campaign's commander strategy. + *

+ * + * @param campaign the campaign object containing the necessary data to perform the calculation + * @return the total number of deployable combat teams */ - public int calculateMaxDeployedLances(Campaign campaign) { - return campaign.getCampaignOptions().getBaseStrategyDeployment() + - campaign.getCampaignOptions().getAdditionalStrategyDeployment() * - campaign.getCommanderStrategy(); + public int calculateMaxDeployableCombatTeams(Campaign campaign) { + CampaignOptions options = campaign.getCampaignOptions(); + int baseStrategyDeployment = options.getBaseStrategyDeployment(); + int additionalStrategyDeployment = options.getAdditionalStrategyDeployment(); + int commanderStrategy = campaign.getCommanderStrategy(); + + return baseStrategyDeployment + additionalStrategyDeployment * commanderStrategy; } protected SkillLevel getSkillRating(int roll) { diff --git a/MekHQ/src/mekhq/campaign/market/contractMarket/AtbMonthlyContractMarket.java b/MekHQ/src/mekhq/campaign/market/contractMarket/AtbMonthlyContractMarket.java index 9dcac0d8bf..0e8d040760 100644 --- a/MekHQ/src/mekhq/campaign/market/contractMarket/AtbMonthlyContractMarket.java +++ b/MekHQ/src/mekhq/campaign/market/contractMarket/AtbMonthlyContractMarket.java @@ -298,7 +298,7 @@ private void checkForSubcontracts(Campaign campaign, AtBContract contract, int u contract.calculateLength(campaign.getCampaignOptions().isVariableContractLength()); setContractClauses(contract, unitRatingMod, campaign); - contract.setRequiredLances(calculateRequiredLances(campaign, contract, false)); + contract.setRequiredCombatTeams(calculateRequiredCombatTeams(campaign, contract, false)); contract.setMultiplier(calculatePaymentMultiplier(campaign, contract)); contract.setPartsAvailabilityLevel(contract.getContractType().calculatePartsAvailabilityLevel()); @@ -392,7 +392,7 @@ protected AtBContract generateAtBSubcontract(Campaign campaign, } contract.setTransportComp(100); - contract.setRequiredLances(calculateRequiredLances(campaign, contract, false)); + contract.setRequiredCombatTeams(calculateRequiredCombatTeams(campaign, contract, false)); contract.setMultiplier(calculatePaymentMultiplier(campaign, contract)); contract.setPartsAvailabilityLevel(contract.getContractType().calculatePartsAvailabilityLevel()); contract.calculateContract(campaign); @@ -434,7 +434,7 @@ private void addFollowup(Campaign campaign, followup.calculateLength(campaign.getCampaignOptions().isVariableContractLength()); setContractClauses(followup, campaign.getAtBUnitRatingMod(), campaign); - contract.setRequiredLances(calculateRequiredLances(campaign, contract, false)); + contract.setRequiredCombatTeams(calculateRequiredCombatTeams(campaign, contract, false)); contract.setMultiplier(calculatePaymentMultiplier(campaign, contract)); followup.setPartsAvailabilityLevel(followup.getContractType().calculatePartsAvailabilityLevel()); @@ -484,16 +484,27 @@ public double calculatePaymentMultiplier(Campaign campaign, AtBContract contract multiplier *= 1.1; } - int baseRequiredLances = calculateRequiredLances(campaign, contract, true); - int requiredLances = contract.getRequiredLances(); + // Adjust pay based on the percentage of the players' forces required by the contract + int requiredCombatTeams = contract.getRequiredCombatTeams(); + double totalCombatTeams = campaign.getAllCombatTeams().size(); + totalCombatTeams /= COMBAT_FORCE_DIVIDER; - multiplier *= (double) requiredLances / baseRequiredLances; + if (totalCombatTeams > 0) { + multiplier *= (double) requiredCombatTeams / totalCombatTeams; + } + + // Adjust pay based on difficulty if FG3 is enabled + if (campaign.getCampaignOptions().isUseGenericBattleValue()) { + double skulls = contract.calculateContractDifficulty(campaign); + skulls -= 5; // 5 skulls (or 2.5) is equivalent to the player force, so no modifier. - int maxDeployedLances = calculateMaxDeployedLances(campaign); - if (requiredLances > maxDeployedLances && campaign.getCampaignOptions().isAdjustPaymentForStrategy()) { - multiplier *= (double) maxDeployedLances / (double) requiredLances; + if (skulls != 0) { + skulls *= 0.05; // each half-skull is a 5% pay change + multiplier *= (1 + skulls); + } } + return multiplier; } diff --git a/MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java b/MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java index 062369afa8..fbdd73ae22 100644 --- a/MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java +++ b/MekHQ/src/mekhq/campaign/market/contractMarket/CamOpsContractMarket.java @@ -204,7 +204,7 @@ private Optional generateContract(Campaign campaign, ReputationCont // Step 6: Determine the initial contract clauses setContractClauses(contract, contractTerms); // Step 7: Determine the number of required lances (Not CamOps RAW) - contract.setRequiredLances(calculateRequiredLances(campaign, contract, false)); + contract.setRequiredCombatTeams(calculateRequiredCombatTeams(campaign, contract, false)); // Step 8: Calculate the payment contract.setMultiplier(calculatePaymentMultiplier(campaign, contract)); // Step 9: Determine parts availability diff --git a/MekHQ/src/mekhq/campaign/mission/AtBContract.java b/MekHQ/src/mekhq/campaign/mission/AtBContract.java index ce6d056ee8..5c1fa59bd9 100644 --- a/MekHQ/src/mekhq/campaign/mission/AtBContract.java +++ b/MekHQ/src/mekhq/campaign/mission/AtBContract.java @@ -40,6 +40,7 @@ import mekhq.campaign.CampaignOptions; import mekhq.campaign.event.MissionChangedEvent; import mekhq.campaign.finances.Money; +import mekhq.campaign.force.CombatTeam; import mekhq.campaign.force.Force; import mekhq.campaign.market.enums.UnitMarketType; import mekhq.campaign.mission.atb.AtBScenarioFactory; @@ -78,6 +79,7 @@ import java.util.*; import static java.lang.Math.ceil; +import static java.lang.Math.floor; import static java.lang.Math.max; import static java.lang.Math.round; import static megamek.client.ratgenerator.ModelRecord.NETWORK_NONE; @@ -102,6 +104,7 @@ import static mekhq.gui.dialog.HireBulkPersonnelDialog.overrideSkills; import static mekhq.gui.dialog.HireBulkPersonnelDialog.reRollAdvantages; import static mekhq.gui.dialog.HireBulkPersonnelDialog.reRollLoyalty; +import static mekhq.utilities.EntityUtilities.getEntityFromUnitId; import static mekhq.utilities.ImageUtilities.scaleImageIconToWidth; /** @@ -151,7 +154,7 @@ public class AtBContract extends Contract { protected int extensionLength; - protected int requiredLances; + protected int requiredCombatTeams; protected AtBMoraleLevel moraleLevel; protected LocalDate routEnd; protected int partsAvailabilityLevel; @@ -414,37 +417,57 @@ public static int calculateRequiredLances(Campaign campaign) { return max(getEffectiveNumUnits(campaign) / formationSize, 1); } + /** + * Calculates the effective number of units available in the given campaign based on unit types and roles. + * + *

+ * This method iterates through all combat teams in the specified campaign, ignoring combat teams with + * the auxiliary role. For each valid combat team, it retrieves the associated force and evaluates + * all units within that force. The unit contribution to the total is determined based on its type: + *

+ * + *

+ * Units that aren’t associated with a valid combat team or can’t be fetched due to missing + * data are ignored. The final result is returned as an integer by flooring the calculated total. + *

+ * + * @param campaign the campaign containing the combat teams and units to evaluate + * @return the effective number of units as an integer + */ public static int getEffectiveNumUnits(Campaign campaign) { double numUnits = 0; - for (UUID uuid : campaign.getForces().getAllUnits(true)) { - if (null == campaign.getUnit(uuid)) { + for (CombatTeam combatTeam : campaign.getAllCombatTeams()) { + Force force = combatTeam.getForce(campaign); + + if (force == null) { continue; } - switch (campaign.getUnit(uuid).getEntity().getUnitType()) { - case MEK: - numUnits += 1; - break; - case UnitType.TANK: - case UnitType.VTOL: - case UnitType.NAVAL: - numUnits += campaign.getFaction().isClan() ? 0.5 : 1; - break; - case UnitType.CONV_FIGHTER: - case UnitType.AEROSPACEFIGHTER: - if (campaign.getCampaignOptions().isUseAero()) { - numUnits += campaign.getFaction().isClan() ? 0.5 : 1; - } - break; - case UnitType.PROTOMEK: - numUnits += 0.2; - break; - case UnitType.BATTLE_ARMOR: - case UnitType.INFANTRY: - default: - /* don't count */ + + for (UUID unitId : force.getAllUnits(true)) { + Entity entity = getEntityFromUnitId(campaign, unitId); + + if (entity == null) { + continue; + } + + numUnits += switch (entity.getUnitType()) { + case UnitType.TANK, UnitType.VTOL, UnitType.NAVAL, UnitType.CONV_FIGHTER, + UnitType.AEROSPACEFIGHTER + -> campaign.getFaction().isClan() ? 0.5 : 1; + case UnitType.PROTOMEK -> 0.2; + case UnitType.BATTLE_ARMOR, UnitType.INFANTRY -> 0; + default -> 1; // All other unit types + }; } } - return (int) numUnits; + + return (int) floor(numUnits); } public static boolean isMinorPower(final String factionCode) { @@ -1133,7 +1156,7 @@ protected int writeToXMLBegin(final PrintWriter pw, int indent) { MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enemyCamoFileName", getEnemyCamouflage().getFilename()); } MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enemyColour", getEnemyColour().name()); - MHQXMLUtility.writeSimpleXMLTag(pw, indent, "requiredLances", getRequiredLances()); + MHQXMLUtility.writeSimpleXMLTag(pw, indent, "requiredCombatTeams", getRequiredCombatTeams()); MHQXMLUtility.writeSimpleXMLTag(pw, indent, "moraleLevel", getMoraleLevel().name()); if (routEnd != null) { MHQXMLUtility.writeSimpleXMLTag(pw, indent, "routEnd", routEnd); @@ -1211,8 +1234,10 @@ public void loadFieldsFromXmlNode(Node wn) throws ParseException { getEnemyCamouflage().setFilename(wn2.getTextContent().trim()); } else if (wn2.getTextContent().equalsIgnoreCase("enemyColour")) { setEnemyColour(PlayerColour.parseFromString(wn2.getTextContent().trim())); - } else if (wn2.getNodeName().equalsIgnoreCase("requiredLances")) { - requiredLances = Integer.parseInt(wn2.getTextContent()); + // <50.03 compatibility handler + } else if (wn2.getNodeName().equalsIgnoreCase("requiredLances") + || wn2.getNodeName().equalsIgnoreCase("requiredCombatTeams")) { + requiredCombatTeams = Integer.parseInt(wn2.getTextContent()); } else if (wn2.getNodeName().equalsIgnoreCase("moraleLevel")) { setMoraleLevel(AtBMoraleLevel.parseFromString(wn2.getTextContent().trim())); } else if (wn2.getNodeName().equalsIgnoreCase("routEnd")) { @@ -1435,12 +1460,12 @@ public void setEnemyColour(PlayerColour enemyColour) { this.enemyColour = Objects.requireNonNull(enemyColour); } - public int getRequiredLances() { - return requiredLances; + public int getRequiredCombatTeams() { + return requiredCombatTeams; } - public void setRequiredLances(int required) { - requiredLances = required; + public void setRequiredCombatTeams(int required) { + requiredCombatTeams = required; } public int getPartsAvailabilityLevel() { @@ -1605,7 +1630,7 @@ public AtBContract(Contract c, Campaign campaign) { enemyCode = "REB"; } - requiredLances = calculateRequiredLances(campaign); + requiredCombatTeams = calculateRequiredLances(campaign); setPartsAvailabilityLevel(getContractType().calculatePartsAvailabilityLevel()); diff --git a/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/Resupply.java b/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/Resupply.java index 14adb1e019..561634fe0b 100644 --- a/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/Resupply.java +++ b/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/Resupply.java @@ -394,7 +394,7 @@ static int calculateTargetCargoTonnage(Campaign campaign, AtBContract contract) // Next, we determine the tonnage cap. This is the maximum tonnage the employer is willing to support. final int INDIVIDUAL_TONNAGE_ALLOWANCE = 80; // This is how many tons the employer will budget per unit final int formationSize = getStandardForceSize(campaign.getFaction()); - final int tonnageCap = contract.getRequiredLances() * formationSize * INDIVIDUAL_TONNAGE_ALLOWANCE; + final int tonnageCap = contract.getRequiredCombatTeams() * formationSize * INDIVIDUAL_TONNAGE_ALLOWANCE; // Then we determine the size of each individual 'drop'. This uses the lowest of // unitTonnage and tonnageCap and divides that by 100 diff --git a/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/StarLeagueCache.java b/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/StarLeagueCache.java index ead77fe370..370298bd0b 100644 --- a/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/StarLeagueCache.java +++ b/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/StarLeagueCache.java @@ -127,7 +127,7 @@ public boolean didGenerationFail() { private void processUnits() { int intactUnitCount = 0; - for (int lance = 0; lance < contract.getRequiredLances(); lance++) { + for (int lance = 0; lance < contract.getRequiredCombatTeams(); lance++) { // This will generate a number between 1 and 4 with an average roll of 3 intactUnitCount += Compute.randomInt(3) + Compute.randomInt(3); } diff --git a/MekHQ/src/mekhq/campaign/stratcon/StratconContractInitializer.java b/MekHQ/src/mekhq/campaign/stratcon/StratconContractInitializer.java index aa7435e082..232ef47265 100644 --- a/MekHQ/src/mekhq/campaign/stratcon/StratconContractInitializer.java +++ b/MekHQ/src/mekhq/campaign/stratcon/StratconContractInitializer.java @@ -75,7 +75,7 @@ public static void initializeCampaignState(AtBContract contract, Campaign campai // scenarios // when objective is allied/hostile facility, place those facilities - int maximumTrackIndex = Math.max(0, contract.getRequiredLances() / NUM_LANCES_PER_TRACK); + int maximumTrackIndex = Math.max(0, contract.getRequiredCombatTeams() / NUM_LANCES_PER_TRACK); int planetaryTemperature = campaign.getLocation().getPlanet().getTemperature(campaign.getLocalDate()); for (int x = 0; x < maximumTrackIndex; x++) { @@ -93,7 +93,7 @@ public static void initializeCampaignState(AtBContract contract, Campaign campai // a campaign will have X tracks going at a time, where // X = # required lances / 3, rounded up. The last track will have fewer // required lances. - int oddLanceCount = contract.getRequiredLances() % NUM_LANCES_PER_TRACK; + int oddLanceCount = contract.getRequiredCombatTeams() % NUM_LANCES_PER_TRACK; if (oddLanceCount > 0) { int scenarioOdds = contractDefinition.getScenarioOdds() .get(Compute.randomInt(contractDefinition.getScenarioOdds().size())); @@ -109,7 +109,7 @@ public static void initializeCampaignState(AtBContract contract, Campaign campai // now seed the tracks with objectives and facilities for (ObjectiveParameters objectiveParams : contractDefinition.getObjectiveParameters()) { int objectiveCount = objectiveParams.objectiveCount > 0 ? (int) objectiveParams.objectiveCount - : (int) Math.max(1, -objectiveParams.objectiveCount * contract.getRequiredLances()); + : (int) Math.max(1, -objectiveParams.objectiveCount * contract.getRequiredCombatTeams()); List trackObjects = trackObjectDistribution(objectiveCount, campaignState.getTracks().size()); @@ -166,7 +166,7 @@ public static void initializeCampaignState(AtBContract contract, Campaign campai // non-objective allied facilities int facilityCount = contractDefinition.getAlliedFacilityCount() > 0 ? (int) contractDefinition.getAlliedFacilityCount() - : (int) (-contractDefinition.getAlliedFacilityCount() * contract.getRequiredLances()); + : (int) (-contractDefinition.getAlliedFacilityCount() * contract.getRequiredCombatTeams()); List trackObjects = trackObjectDistribution(facilityCount, campaignState.getTracks().size()); @@ -180,7 +180,7 @@ public static void initializeCampaignState(AtBContract contract, Campaign campai // non-objective hostile facilities facilityCount = contractDefinition.getHostileFacilityCount() > 0 ? (int) contractDefinition.getHostileFacilityCount() - : (int) (-contractDefinition.getHostileFacilityCount() * contract.getRequiredLances()); + : (int) (-contractDefinition.getHostileFacilityCount() * contract.getRequiredCombatTeams()); trackObjects = trackObjectDistribution(facilityCount, campaignState.getTracks().size()); diff --git a/MekHQ/src/mekhq/campaign/stratcon/SupportPointNegotiation.java b/MekHQ/src/mekhq/campaign/stratcon/SupportPointNegotiation.java index d3d378c32b..4691bf29ba 100644 --- a/MekHQ/src/mekhq/campaign/stratcon/SupportPointNegotiation.java +++ b/MekHQ/src/mekhq/campaign/stratcon/SupportPointNegotiation.java @@ -120,8 +120,8 @@ private static void processContractSupportPoints(Campaign campaign, AtBContract List adminTransport, boolean isInitialNegotiation) { int negotiatedSupportPoints = 0; int maxSupportPoints = isInitialNegotiation - ? contract.getRequiredLances() * 3 - : contract.getRequiredLances(); + ? contract.getRequiredCombatTeams() * 3 + : contract.getRequiredCombatTeams(); StratconCampaignState campaignState = contract.getStratconCampaignState(); diff --git a/MekHQ/src/mekhq/gui/dialog/CustomizeAtBContractDialog.java b/MekHQ/src/mekhq/gui/dialog/CustomizeAtBContractDialog.java index a2c49d2baa..80cd66abff 100644 --- a/MekHQ/src/mekhq/gui/dialog/CustomizeAtBContractDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/CustomizeAtBContractDialog.java @@ -190,7 +190,7 @@ public Component getListCellRendererComponent(final JList list, final Object JLabel lblEnemyRating = new JLabel(); JLabel lblRequiredLances = new JLabel(); - int requiredLances = contract.getRequiredLances() > 0 ? contract.getRequiredLances() : 1; + int requiredLances = contract.getRequiredCombatTeams() > 0 ? contract.getRequiredCombatTeams() : 1; spnRequiredLances = new JSpinner(new SpinnerNumberModel(requiredLances, 1, null, 1)); JLabel lblEnemyMorale = new JLabel(); @@ -574,7 +574,7 @@ private void btnOKActionPerformed(ActionEvent evt) { contract.setAllyQuality(cbAllyQuality.getSelectedIndex()); contract.setEnemySkill(comboEnemySkill.getSelectedItem()); contract.setEnemyQuality(cbEnemyQuality.getSelectedIndex()); - contract.setRequiredLances((Integer) spnRequiredLances.getValue()); + contract.setRequiredCombatTeams((Integer) spnRequiredLances.getValue()); contract.setMoraleLevel(comboEnemyMorale.getSelectedItem()); contract.setContractScoreArbitraryModifier((Integer) spnContractScoreArbitraryModifier.getValue()); contract.setBaseAmount(txtBasePay.getMoney()); diff --git a/MekHQ/src/mekhq/gui/dialog/NewAtBContractDialog.java b/MekHQ/src/mekhq/gui/dialog/NewAtBContractDialog.java index 996273a799..e76d95789a 100644 --- a/MekHQ/src/mekhq/gui/dialog/NewAtBContractDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/NewAtBContractDialog.java @@ -542,7 +542,7 @@ protected void btnOKActionPerformed(ActionEvent evt) { contract.setDesc(txtDesc.getText()); contract.setCommandRights(choiceCommand.getSelectedItem()); - contract.setRequiredLances(AtBContract.calculateRequiredLances(campaign)); + contract.setRequiredCombatTeams(AtBContract.calculateRequiredLances(campaign)); contract.setEnemyCode(getCurrentEnemyCode()); contract.setAllySkill(comboAllySkill.getSelectedItem()); diff --git a/MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java b/MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java index 93d689fbfc..73bf3cc6c0 100644 --- a/MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java +++ b/MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java @@ -8963,7 +8963,6 @@ public void setOptions(@Nullable CampaignOptions options, chkUseStrategy.setSelected(options.isUseStrategy()); spnBaseStrategyDeployment.setValue(options.getBaseStrategyDeployment()); spnAdditionalStrategyDeployment.setValue(options.getAdditionalStrategyDeployment()); - chkAdjustPaymentForStrategy.setSelected(options.isAdjustPaymentForStrategy()); spnAtBBattleChance[CombatRole.MANEUVER.ordinal()] .setValue(options.getAtBBattleChance(CombatRole.MANEUVER)); spnAtBBattleChance[CombatRole.FRONTLINE.ordinal()] @@ -9565,7 +9564,6 @@ public void updateOptions() { options.setUseStrategy(chkUseStrategy.isSelected()); options.setBaseStrategyDeployment((Integer) spnBaseStrategyDeployment.getValue()); options.setAdditionalStrategyDeployment((Integer) spnAdditionalStrategyDeployment.getValue()); - options.setAdjustPaymentForStrategy(chkAdjustPaymentForStrategy.isSelected()); options.setUseAero(chkUseAero.isSelected()); options.setUseVehicles(chkUseVehicles.isSelected()); diff --git a/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java b/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java index 2abe3228a0..c1db22c8bb 100644 --- a/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java +++ b/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java @@ -523,7 +523,7 @@ public void mouseClicked(MouseEvent e) { gridBagConstraintsLabels.gridy = ++y; mainPanel.add(lblRequiredLances, gridBagConstraintsLabels); - JLabel txtRequiredLances = new JLabel(String.valueOf(((AtBContract) contract).getRequiredLances())); + JLabel txtRequiredLances = new JLabel(String.valueOf(((AtBContract) contract).getRequiredCombatTeams())); txtRequiredLances.setName("txtRequiredLances"); gridBagConstraintsText.gridy = y; mainPanel.add(txtRequiredLances, gridBagConstraintsText); diff --git a/MekHQ/src/mekhq/gui/view/LanceAssignmentView.java b/MekHQ/src/mekhq/gui/view/LanceAssignmentView.java index 0d3551ca6e..bb5d673d53 100644 --- a/MekHQ/src/mekhq/gui/view/LanceAssignmentView.java +++ b/MekHQ/src/mekhq/gui/view/LanceAssignmentView.java @@ -362,10 +362,10 @@ public Object getValueAt(int row, int column) { t++; } } - if (t < contract.getRequiredLances()) { - return t + "/" + contract.getRequiredLances(); + if (t < contract.getRequiredCombatTeams()) { + return t + "/" + contract.getRequiredCombatTeams(); } - return Integer.toString(contract.getRequiredLances()); + return Integer.toString(contract.getRequiredCombatTeams()); } else if (contract.getContractType().getRequiredLanceRole().ordinal() == column - 2) { int t = 0; for (CombatTeam combatTeam : campaign.getAllCombatTeams()) { @@ -375,7 +375,7 @@ public Object getValueAt(int row, int column) { t++; } } - int required = Math.max(contract.getRequiredLances() / 2, 1); + int required = Math.max(contract.getRequiredCombatTeams() / 2, 1); if (t < required) { return t + "/" + required; }