Skip to content

Commit

Permalink
Renamed CombatRole.BATTLELINE to CombatRole.FRONTLINE
Browse files Browse the repository at this point in the history
Updated all references to the BATTLELINE combat role across the codebase to use the new FRONTLINE designation. This change enhances naming clarity and consistency within the code.
  • Loading branch information
IllianiCBT committed Dec 21, 2024
1 parent a559ba6 commit ec8e06e
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions MekHQ/resources/mekhq/resources/Mission.properties
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ AtBContractType.EXTRACTION_RAID.text=Extraction Raid
AtBContractType.EXTRACTION_RAID.toolTipText=The unit is tasked with raiding an enemy planet to capture a target and return the target to their employer.

# CombatRole Enum
CombatRole.BATTLELINE.text=Battleline
CombatRole.BATTLELINE.toolTipText=The force has been tasked with performing offensive actions against the enemy.
CombatRole.FRONTLINE.text=Frontline
CombatRole.FRONTLINE.toolTipText=The force has been tasked with performing offensive actions against the enemy.
CombatRole.GARRISON.text=Garrison
CombatRole.GARRISON.toolTipText=The force has been tasked with performing defensive actions, protecting designated targets and locations from the enemy.
CombatRole.RECON.text=Recon
Expand Down
4 changes: 2 additions & 2 deletions MekHQ/src/mekhq/campaign/CampaignOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ public CampaignOptions() {
additionalStrategyDeployment = 1;
adjustPaymentForStrategy = false;
atbBattleChance = new int[CombatRole.values().length - 1];
atbBattleChance[CombatRole.BATTLELINE.ordinal()] = 40;
atbBattleChance[CombatRole.FRONTLINE.ordinal()] = 40;
atbBattleChance[CombatRole.GARRISON.ordinal()] = 20;
atbBattleChance[CombatRole.RECON.ordinal()] = 60;
atbBattleChance[CombatRole.TRAINING.ordinal()] = 10;
Expand Down Expand Up @@ -6353,7 +6353,7 @@ public static CampaignOptions generateCampaignOptionsFromXml(Node wn, Version ve
} else if (wn2.getNodeName().equalsIgnoreCase("intensity")) { // Legacy
double intensity = Double.parseDouble(wn2.getTextContent().trim());

retVal.atbBattleChance[CombatRole.BATTLELINE.ordinal()] = (int) Math.round(((40.0 * intensity) / (40.0 * intensity + 60.0)) * 100.0 + 0.5);
retVal.atbBattleChance[CombatRole.FRONTLINE.ordinal()] = (int) Math.round(((40.0 * intensity) / (40.0 * intensity + 60.0)) * 100.0 + 0.5);
retVal.atbBattleChance[CombatRole.GARRISON.ordinal()] = (int) Math.round(((20.0 * intensity) / (20.0 * intensity + 80.0)) * 100.0 + 0.5);
retVal.atbBattleChance[CombatRole.RECON.ordinal()] = (int) Math.round(((60.0 * intensity) / (60.0 * intensity + 40.0)) * 100.0 + 0.5);
retVal.atbBattleChance[CombatRole.TRAINING.ordinal()] = (int) Math.round(((10.0 * intensity) / (10.0 * intensity + 90.0)) * 100.0 + 0.5);
Expand Down
2 changes: 1 addition & 1 deletion MekHQ/src/mekhq/campaign/force/CombatTeam.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public AtBScenario checkForBattle(Campaign campaign) {
*/

switch (role) {
case BATTLELINE: {
case FRONTLINE: {
roll = Compute.randomInt(40) + battleTypeMod;
if (roll < 1) {
return AtBScenarioFactory.createScenario(campaign, this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public void setObjectives(Campaign campaign, AtBContract contract) {
// Rout for a while
ObjectiveEffect victoryEffect = new ObjectiveEffect();
final CombatRole requiredLanceRole = contract.getContractType().getRequiredLanceRole();
if (requiredLanceRole.isBattleline() || requiredLanceRole.isScouting()) {
if (requiredLanceRole.isFrontline() || requiredLanceRole.isScouting()) {
victoryEffect.effectType = ObjectiveEffectType.ContractVictory;
destroyHostiles.addDetail(getResourceBundle().getString("battleDetails.baseAttack.attacker.details.winnerFightScout"));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public CombatRole getRequiredLanceRole() {
case PIRATE_HUNTING:
case PLANETARY_ASSAULT:
case RELIEF_DUTY:
return CombatRole.BATTLELINE;
return CombatRole.FRONTLINE;
case DIVERSIONARY_RAID:
case EXTRACTION_RAID:
case OBJECTIVE_RAID:
Expand Down
6 changes: 3 additions & 3 deletions MekHQ/src/mekhq/campaign/mission/enums/CombatRole.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

public enum CombatRole {
// region Enum Declarations
BATTLELINE("CombatRole.BATTLELINE.text", "CombatRole.BATTLELINE.toolTipText"),
FRONTLINE("CombatRole.FRONTLINE.text", "CombatRole.FRONTLINE.toolTipText"),
GARRISON("CombatRole.GARRISON.text", "CombatRole.GARRISON.toolTipText"),
RECON("CombatRole.RECON.text", "CombatRole.RECON.toolTipText"),
TRAINING("CombatRole.TRAINING.text", "CombatRole.TRAINING.toolTipText"),
Expand Down Expand Up @@ -54,8 +54,8 @@ public String getToolTipText() {
// endregion Getters

// region Boolean Comparison Methods
public boolean isBattleline() {
return this == BATTLELINE;
public boolean isFrontline() {
return this == FRONTLINE;
}

public boolean isGarrison() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2194,7 +2194,7 @@ public static ReinforcementEligibilityType getReinforcementType(int forceID, Str
}

if (campaignState.getSupportPoints() > 0) {
if (formation.getRole().isBattleline() || formation.getRole().isAuxiliary()) {
if (formation.getRole().isFrontline() || formation.getRole().isAuxiliary()) {
return AUXILIARY;
} else {
return ReinforcementEligibilityType.REGULAR;
Expand Down
14 changes: 7 additions & 7 deletions MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -3152,13 +3152,13 @@ private JScrollPane createAgainstTheBotTab() {

spnAtBBattleChance = new JSpinner[CombatRole.values().length - 1];

JLabel lblFightChance = new JLabel(CombatRole.BATTLELINE + ":");
JLabel lblFightChance = new JLabel(CombatRole.FRONTLINE + ":");
gridBagConstraints.gridy = 15;
gridBagConstraints.gridwidth = 1;
panSubAtBContract.add(lblFightChance, gridBagConstraints);

JSpinner atbBattleChance = new JSpinner(new SpinnerNumberModel(0, 0, 100, 1));
spnAtBBattleChance[CombatRole.BATTLELINE.ordinal()] = atbBattleChance;
spnAtBBattleChance[CombatRole.FRONTLINE.ordinal()] = atbBattleChance;
gridBagConstraints.gridx = 1;
panSubAtBContract.add(atbBattleChance, gridBagConstraints);

Expand Down Expand Up @@ -8962,8 +8962,8 @@ public void setOptions(@Nullable CampaignOptions options,
spnBaseStrategyDeployment.setValue(options.getBaseStrategyDeployment());
spnAdditionalStrategyDeployment.setValue(options.getAdditionalStrategyDeployment());
chkAdjustPaymentForStrategy.setSelected(options.isAdjustPaymentForStrategy());
spnAtBBattleChance[CombatRole.BATTLELINE.ordinal()]
.setValue(options.getAtBBattleChance(CombatRole.BATTLELINE));
spnAtBBattleChance[CombatRole.FRONTLINE.ordinal()]
.setValue(options.getAtBBattleChance(CombatRole.FRONTLINE));
spnAtBBattleChance[CombatRole.GARRISON.ordinal()]
.setValue(options.getAtBBattleChance(CombatRole.GARRISON));
spnAtBBattleChance[CombatRole.RECON.ordinal()]
Expand Down Expand Up @@ -9977,7 +9977,7 @@ private void enableAtBComponents(JPanel panel, boolean enabled) {
private double determineAtBBattleIntensity() {
double intensity = 0.0;

int x = (Integer) spnAtBBattleChance[CombatRole.BATTLELINE.ordinal()].getValue();
int x = (Integer) spnAtBBattleChance[CombatRole.FRONTLINE.ordinal()].getValue();
intensity += ((-3.0 / 2.0) * (2.0 * x - 1.0)) / (2.0 * x - 201.0);

x = (Integer) spnAtBBattleChance[CombatRole.GARRISON.ordinal()].getValue();
Expand Down Expand Up @@ -10006,7 +10006,7 @@ public void stateChanged(ChangeEvent e) {
if (intensity >= AtBContract.MINIMUM_INTENSITY) {
int value = (int) Math.min(
Math.round(400.0 * intensity / (4.0 * intensity + 6.0) + 0.05), 100);
spnAtBBattleChance[CombatRole.BATTLELINE.ordinal()].setValue(value);
spnAtBBattleChance[CombatRole.FRONTLINE.ordinal()].setValue(value);
value = (int) Math.min(Math.round(200.0 * intensity / (2.0 * intensity + 8.0) + 0.05),
100);
spnAtBBattleChance[CombatRole.GARRISON.ordinal()].setValue(value);
Expand All @@ -10016,7 +10016,7 @@ public void stateChanged(ChangeEvent e) {
value = (int) Math.min(Math.round(100.0 * intensity / (intensity + 9.0) + 0.05), 100);
spnAtBBattleChance[CombatRole.TRAINING.ordinal()].setValue(value);
} else {
spnAtBBattleChance[CombatRole.BATTLELINE.ordinal()].setValue(0);
spnAtBBattleChance[CombatRole.FRONTLINE.ordinal()].setValue(0);
spnAtBBattleChance[CombatRole.GARRISON.ordinal()].setValue(0);
spnAtBBattleChance[CombatRole.RECON.ordinal()].setValue(0);
spnAtBBattleChance[CombatRole.TRAINING.ordinal()].setValue(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ AtBScenario createScenario(Campaign campaign) {
when(scenario.getBlowingSand()).thenReturn(BlowingSand.BLOWING_SAND_NONE);

// Lance setup
when(scenario.getCombatRole()).thenReturn(CombatRole.BATTLELINE);
when(scenario.getCombatRole()).thenReturn(CombatRole.FRONTLINE);
when(scenario.getId()).thenReturn(11);

// Bots setup
Expand Down

0 comments on commit ec8e06e

Please sign in to comment.