Skip to content

Commit

Permalink
Merge pull request #5473 from IllianiCBT/roleNameChange
Browse files Browse the repository at this point in the history
Renamed Fight, Defense, and Scouting Combat Role Names
  • Loading branch information
HammerGS authored Dec 22, 2024
2 parents 1b4f9ce + ec8e06e commit 245e761
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 69 deletions.
16 changes: 8 additions & 8 deletions MekHQ/resources/mekhq/resources/Mission.properties
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ 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.FIGHTING.text=Fight
CombatRole.FIGHTING.toolTipText=The force has been tasked with performing offensive actions against the enemy.
CombatRole.DEFENCE.text=Defend
CombatRole.DEFENCE.toolTipText=The force has been tasked with performing defensive actions, protecting designated targets and locations from the enemy.
CombatRole.SCOUTING.text=Scout
CombatRole.SCOUTING.toolTipText=The force has been tasked with performing reconnaissance actions, scouting the enemy and their positions.
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
CombatRole.RECON.toolTipText=The force has been tasked with performing reconnaissance actions, scouting the enemy and their positions.
CombatRole.TRAINING.text=Training
CombatRole.TRAINING.toolTipText=The force has been tasked with trained ultra green and green members of the force under the leadership of a veteran or elite officer.
CombatRole.AUXILIARY.text=Auxiliary
CombatRole.AUXILIARY.toolTipText=The force has been tasked with supporting other forces.
CombatRole.IN_RESERVE.text=In Reserve
CombatRole.IN_RESERVE.toolTipText=The force is not currently assigned to combat duties.
CombatRole.RESERVE.text=Reserve
CombatRole.RESERVE.toolTipText=The force is not currently assigned to combat duties.

# AtBMoraleLevel Enum
AtBMoraleLevel.ROUTED.text=Routed
Expand Down
2 changes: 1 addition & 1 deletion MekHQ/src/mekhq/campaign/Campaign.java
Original file line number Diff line number Diff line change
Expand Up @@ -3768,7 +3768,7 @@ public int getDeploymentDeficit(AtBContract contract) {

final CombatRole requiredLanceRole = contract.getContractType().getRequiredLanceRole();
for (CombatTeam combatTeam : combatTeams.values()) {
if (!(combatTeam.getRole().isInReserve() || combatTeam.getRole().isAuxiliary())
if (!(combatTeam.getRole().isReserve() || combatTeam.getRole().isAuxiliary())
&& (combatTeam.getMissionId() == contract.getId())) {
total++;
if (combatTeam.getRole() == requiredLanceRole) {
Expand Down
18 changes: 9 additions & 9 deletions MekHQ/src/mekhq/campaign/CampaignOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -1209,9 +1209,9 @@ public CampaignOptions() {
additionalStrategyDeployment = 1;
adjustPaymentForStrategy = false;
atbBattleChance = new int[CombatRole.values().length - 1];
atbBattleChance[CombatRole.FIGHTING.ordinal()] = 40;
atbBattleChance[CombatRole.DEFENCE.ordinal()] = 20;
atbBattleChance[CombatRole.SCOUTING.ordinal()] = 60;
atbBattleChance[CombatRole.FRONTLINE.ordinal()] = 40;
atbBattleChance[CombatRole.GARRISON.ordinal()] = 20;
atbBattleChance[CombatRole.RECON.ordinal()] = 60;
atbBattleChance[CombatRole.TRAINING.ordinal()] = 10;
generateChases = true;

Expand Down Expand Up @@ -4478,15 +4478,15 @@ public void setPlayerControlsAttachedUnits(final boolean playerControlsAttachedU
* This method calculates the battle chance percentage for the provided combat role based on
* its ordinal position in the {@code atbBattleChance} array. If StratCon is enabled, the
* method immediately returns {@code 0}.
* Roles marked as {@link CombatRole#IN_RESERVE} or as {@link CombatRole#AUXILIARY} are not
* Roles marked as {@link CombatRole#RESERVE} or as {@link CombatRole#AUXILIARY} are not
* eligible for battles and also return {@code 0}.
* </p>
*
* @param role the {@link CombatRole} to evaluate the battle chance for.
* @return the chance of having a battle for the specified role. Returns:
* <ul>
* <li>{@code 0} if StratCon is enabled.</li>
* <li>{@code 0} if the role is {@link CombatRole#IN_RESERVE} or
* <li>{@code 0} if the role is {@link CombatRole#RESERVE} or
* {@link CombatRole#AUXILIARY}.</li>
* <li>A non-zero value from the {@code atbBattleChance} array corresponding to the
* role otherwise.</li>
Expand All @@ -4497,7 +4497,7 @@ public int getAtBBattleChance(CombatRole role) {
return 0;
}

if (role.isInReserve() || role.isAuxiliary()) {
if (role.isReserve() || role.isAuxiliary()) {
return 0;
}

Expand Down Expand Up @@ -6353,9 +6353,9 @@ 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.FIGHTING.ordinal()] = (int) Math.round(((40.0 * intensity) / (40.0 * intensity + 60.0)) * 100.0 + 0.5);
retVal.atbBattleChance[CombatRole.DEFENCE.ordinal()] = (int) Math.round(((20.0 * intensity) / (20.0 * intensity + 80.0)) * 100.0 + 0.5);
retVal.atbBattleChance[CombatRole.SCOUTING.ordinal()] = (int) Math.round(((60.0 * intensity) / (60.0 * intensity + 40.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);
} else if (wn2.getNodeName().equalsIgnoreCase("personnelMarketType")) { // Legacy
retVal.personnelMarketName = PersonnelMarket.getTypeName(Integer.parseInt(wn2.getTextContent().trim()));
Expand Down
8 changes: 4 additions & 4 deletions MekHQ/src/mekhq/campaign/force/CombatTeam.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public CombatTeam() {}

public CombatTeam(int forceId, Campaign campaign) {
this.forceId = forceId;
role = CombatRole.IN_RESERVE;
role = CombatRole.RESERVE;
missionId = -1;
for (AtBContract contract : campaign.getActiveAtBContracts()) {
missionId = ((contract.getParentContract() == null)
Expand Down Expand Up @@ -422,7 +422,7 @@ public AtBScenario checkForBattle(Campaign campaign) {
*/

switch (role) {
case FIGHTING: {
case FRONTLINE: {
roll = Compute.randomInt(40) + battleTypeMod;
if (roll < 1) {
return AtBScenarioFactory.createScenario(campaign, this,
Expand Down Expand Up @@ -460,7 +460,7 @@ public AtBScenario checkForBattle(Campaign campaign) {
getBattleDate(campaign.getLocalDate()));
}
}
case SCOUTING: {
case RECON: {
roll = Compute.randomInt(60) + battleTypeMod;
if (roll < 1) {
return AtBScenarioFactory.createScenario(campaign, this,
Expand Down Expand Up @@ -498,7 +498,7 @@ public AtBScenario checkForBattle(Campaign campaign) {
getBattleDate(campaign.getLocalDate()));
}
}
case DEFENCE: {
case GARRISON: {
roll = Compute.randomInt(20) + battleTypeMod;
if (roll < 1) {
return AtBScenarioFactory.createScenario(campaign, this,
Expand Down
4 changes: 2 additions & 2 deletions MekHQ/src/mekhq/campaign/mission/AtBScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public abstract class AtBScenario extends Scenario implements IAtBScenario {
public AtBScenario() {
super();
combatTeamId = -1;
combatRole = CombatRole.IN_RESERVE;
combatRole = CombatRole.RESERVE;
alliesPlayer = new ArrayList<>();
alliesPlayerStub = new ArrayList<>();
attachedUnitIds = new ArrayList<>();
Expand Down Expand Up @@ -237,7 +237,7 @@ public void initialize(Campaign c, CombatTeam lance, boolean attacker, LocalDate

if (null == lance) {
combatTeamId = -1;
combatRole = CombatRole.IN_RESERVE;
combatRole = CombatRole.RESERVE;
} else {
this.combatTeamId = lance.getForceId();
combatRole = lance.getRole();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public static void createScenariosForNewWeek(Campaign campaign) {
List<CombatTeam> lList = new ArrayList<>();
for (CombatTeam combatTeam : combatTeamsTable.values()) {
if ((combatTeam.getMissionId() == contract.getId())
&& combatTeam.getRole().isDefence() && combatTeam.isEligible(campaign)) {
&& combatTeam.getRole().isGarrison() && combatTeam.isEligible(campaign)) {
lList.add(combatTeam);
}
}
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.isFighting() || requiredLanceRole.isScouting()) {
if (requiredLanceRole.isFrontline() || requiredLanceRole.isScouting()) {
victoryEffect.effectType = ObjectiveEffectType.ContractVictory;
destroyHostiles.addDetail(getResourceBundle().getString("battleDetails.baseAttack.attacker.details.winnerFightScout"));
} else {
Expand Down
8 changes: 4 additions & 4 deletions MekHQ/src/mekhq/campaign/mission/enums/AtBContractType.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,19 @@ public CombatRole getRequiredLanceRole() {
case GARRISON_DUTY:
case SECURITY_DUTY:
case RIOT_DUTY:
return CombatRole.DEFENCE;
return CombatRole.GARRISON;
case GUERRILLA_WARFARE:
case PIRATE_HUNTING:
case PLANETARY_ASSAULT:
case RELIEF_DUTY:
return CombatRole.FIGHTING;
return CombatRole.FRONTLINE;
case DIVERSIONARY_RAID:
case EXTRACTION_RAID:
case OBJECTIVE_RAID:
case RECON_RAID:
return CombatRole.SCOUTING;
return CombatRole.RECON;
default:
return CombatRole.IN_RESERVE;
return CombatRole.RESERVE;
}
}

Expand Down
24 changes: 12 additions & 12 deletions MekHQ/src/mekhq/campaign/mission/enums/CombatRole.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

public enum CombatRole {
// region Enum Declarations
FIGHTING("CombatRole.FIGHTING.text", "CombatRole.FIGHTING.toolTipText"),
DEFENCE("CombatRole.DEFENCE.text", "CombatRole.DEFENCE.toolTipText"),
SCOUTING("CombatRole.SCOUTING.text", "CombatRole.SCOUTING.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"),
AUXILIARY("CombatRole.AUXILIARY.text", "CombatRole.AUXILIARY.toolTipText"),
IN_RESERVE("CombatRole.IN_RESERVE.text", "CombatRole.IN_RESERVE.toolTipText");
RESERVE("CombatRole.RESERVE.text", "CombatRole.RESERVE.toolTipText");
// endregion Enum Declarations

// region Variable Declarations
Expand All @@ -54,16 +54,16 @@ public String getToolTipText() {
// endregion Getters

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

public boolean isDefence() {
return this == DEFENCE;
public boolean isGarrison() {
return this == GARRISON;
}

public boolean isScouting() {
return this == SCOUTING;
return this == RECON;
}

public boolean isTraining() {
Expand All @@ -74,8 +74,8 @@ public boolean isAuxiliary() {
return this == AUXILIARY;
}

public boolean isInReserve() {
return this == IN_RESERVE;
public boolean isReserve() {
return this == RESERVE;
}
// endregion Boolean Comparison Methods

Expand Down Expand Up @@ -111,7 +111,7 @@ public static CombatRole parseFromString(final String text) {
MMLogger.create(CombatRole.class)
.error("Unable to parse " + text + " into an CombatRole. Returning IN_RESERVE.");

return IN_RESERVE;
return RESERVE;
}
// endregion File I/O

Expand Down
8 changes: 4 additions & 4 deletions MekHQ/src/mekhq/campaign/stratcon/StratconRulesManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1574,7 +1574,7 @@ private static boolean commanderLanceHasDefensiveAssignment(AtBDynamicScenario s
if (commanderUnit != null) {
CombatTeam lance = campaign.getCombatTeamsTable().get(commanderUnit.getForceId());

return (lance != null) && lance.getRole().isDefence();
return (lance != null) && lance.getRole().isGarrison();
}
}

Expand Down Expand Up @@ -2003,7 +2003,7 @@ public static List<Integer> getAvailableForceIDs(Campaign campaign, AtBContract
}

// So long as the combat team isn't In Reserve or Auxiliary, they are eligible to be deployed
if (!combatTeam.getRole().isInReserve() && !combatTeam.getRole().isAuxiliary()) {
if (!combatTeam.getRole().isReserve() && !combatTeam.getRole().isAuxiliary()) {
suitableForces.add(combatTeam.getForceId());
}
}
Expand Down Expand Up @@ -2064,7 +2064,7 @@ public static List<Integer> getAvailableForceIDs(int unitType, Campaign campaign
continue;
}

if (formation.getRole().isInReserve()) {
if (formation.getRole().isReserve()) {
continue;
}

Expand Down Expand Up @@ -2280,7 +2280,7 @@ public static ReinforcementEligibilityType getReinforcementType(int forceID, Str
}

if (campaignState.getSupportPoints() > 0) {
if (formation.getRole().isFighting() || formation.getRole().isAuxiliary()) {
if (formation.getRole().isFrontline() || formation.getRole().isAuxiliary()) {
return AUXILIARY;
} else {
return ReinforcementEligibilityType.REGULAR;
Expand Down
Loading

0 comments on commit 245e761

Please sign in to comment.