Skip to content

Commit 2eed1c8

Browse files
authored
Merge pull request #7235 from IllianiBird/factionStandingSafeBooleans
Improvement: Added 'Safe' Faction Standing Getters
2 parents 8424b27 + f4e2da1 commit 2eed1c8

File tree

2 files changed

+219
-11
lines changed

2 files changed

+219
-11
lines changed

MekHQ/src/mekhq/campaign/CampaignOptions.java

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,6 +1283,16 @@ public CampaignOptions() {
12831283
setScenarioModBV(50);
12841284
autoGenerateOpForCallsigns = true;
12851285
minimumCallsignSkillLevel = SkillLevel.VETERAN;
1286+
useFactionStandingNegotiation = true;
1287+
useFactionStandingResupply = true;
1288+
useFactionStandingCommandCircuit = true;
1289+
useFactionStandingOutlawed = true;
1290+
useFactionStandingBatchallRestrictions = true;
1291+
useFactionStandingRecruitment = true;
1292+
useFactionStandingBarracksCosts = true;
1293+
useFactionStandingUnitMarket = true;
1294+
useFactionStandingContractPay = true;
1295+
useFactionStandingSupportPoints = true;
12861296
// endregion Against the Bot Tab
12871297
}
12881298
// endregion Constructors
@@ -6911,82 +6921,277 @@ public void setAutoResolveExperimentalPacarGuiEnabled(boolean autoResolveExperim
69116921
this.autoResolveExperimentalPacarGuiEnabled = autoResolveExperimentalPacarGuiEnabled;
69126922
}
69136923

6924+
/**
6925+
* Determines if faction standing negotiation is enabled.
6926+
*
6927+
* <p><b>Usage:</b> for most use cases you will want to use {@link #isUseFactionStandingNegotiationSafe()} as
6928+
* that also verifies that Faction Standing is enabled.</p>
6929+
*
6930+
* @return {@code true} if faction standing negotiation is enabled, {@code false} otherwise.
6931+
*/
69146932
public boolean isUseFactionStandingNegotiation() {
69156933
return useFactionStandingNegotiation;
69166934
}
69176935

6936+
/**
6937+
* Checks whether tracking faction standing is enabled and if the use of faction standing negotiation is active.
6938+
*
6939+
* @return {@code true} if both faction standing tracking and faction standing negotiation usage are enabled;
6940+
* {@code false} otherwise.
6941+
*/
6942+
public boolean isUseFactionStandingNegotiationSafe() {
6943+
return trackFactionStanding && useFactionStandingNegotiation;
6944+
}
6945+
6946+
/**
6947+
* Sets whether the system should use faction standing negotiation.
6948+
*
6949+
* @param useFactionStandingNegotiation a boolean indicating if faction standing negotiation should be enabled
6950+
* (true) or disabled (false)
6951+
*/
69186952
public void setUseFactionStandingNegotiation(boolean useFactionStandingNegotiation) {
69196953
this.useFactionStandingNegotiation = useFactionStandingNegotiation;
69206954
}
69216955

6956+
/**
6957+
* Determines if faction standing resupply modifiers is enabled.
6958+
*
6959+
* <p><b>Usage:</b> for most use cases you will want to use {@link #isUseFactionStandingResupplySafe()} as
6960+
* that also verifies that Faction Standing is enabled.</p>
6961+
*
6962+
* @return {@code true} if faction standing resupply modifiers is enabled, {@code false} otherwise.
6963+
*/
69226964
public boolean isUseFactionStandingResupply() {
69236965
return useFactionStandingResupply;
69246966
}
69256967

6968+
/**
6969+
* Checks whether tracking faction standing is enabled and if the use of faction standing resupply modifiers is
6970+
* active.
6971+
*
6972+
* @return {@code true} if both faction standing tracking and faction standing resupply modifier usage are enabled;
6973+
* {@code false} otherwise.
6974+
*/
6975+
public boolean isUseFactionStandingResupplySafe() {
6976+
return trackFactionStanding && useFactionStandingResupply;
6977+
}
6978+
69266979
public void setUseFactionStandingResupply(boolean useFactionStandingResupply) {
69276980
this.useFactionStandingResupply = useFactionStandingResupply;
69286981
}
69296982

6983+
/**
6984+
* Determines if faction standing command circuit access is enabled.
6985+
*
6986+
* <p><b>Usage:</b> for most use cases you will want to use {@link #isUseFactionStandingCommandCircuitSafe()} as
6987+
* that also verifies that Faction Standing is enabled.</p>
6988+
*
6989+
* @return {@code true} if faction standing command circuit access is enabled, {@code false} otherwise.
6990+
*/
69306991
public boolean isUseFactionStandingCommandCircuit() {
69316992
return useFactionStandingCommandCircuit;
69326993
}
69336994

6995+
/**
6996+
* Checks whether tracking faction standing is enabled and if the use of faction standing command circuits are
6997+
* active.
6998+
*
6999+
* @return {@code true} if both faction standing tracking and faction standing command circuit
7000+
* usage are enabled; {@code false} otherwise.
7001+
*/
7002+
public boolean isUseFactionStandingCommandCircuitSafe() {
7003+
return trackFactionStanding && useFactionStandingCommandCircuit;
7004+
}
7005+
69347006
public void setUseFactionStandingCommandCircuit(boolean useFactionStandingCommandCircuit) {
69357007
this.useFactionStandingCommandCircuit = useFactionStandingCommandCircuit;
69367008
}
69377009

7010+
/**
7011+
* Determines if faction standing outlawing is enabled.
7012+
*
7013+
* <p><b>Usage:</b> for most use cases you will want to use {@link #isUseFactionStandingOutlawedSafe()} as
7014+
* that also verifies that Faction Standing is enabled.</p>
7015+
*
7016+
* @return {@code true} if faction standing outlawing is enabled, {@code false} otherwise.
7017+
*/
69387018
public boolean isUseFactionStandingOutlawed() {
69397019
return useFactionStandingOutlawed;
69407020
}
69417021

7022+
/**
7023+
* Checks whether tracking faction standing is enabled and if the use of faction standing outlawing is
7024+
* active.
7025+
*
7026+
* @return {@code true} if both faction standing tracking and faction standing outlaw
7027+
* usage are enabled; {@code false} otherwise.
7028+
*/
7029+
public boolean isUseFactionStandingOutlawedSafe() {
7030+
return trackFactionStanding && useFactionStandingOutlawed;
7031+
}
7032+
69427033
public void setUseFactionStandingOutlawed(boolean useFactionStandingOutlawed) {
69437034
this.useFactionStandingOutlawed = useFactionStandingOutlawed;
69447035
}
69457036

7037+
/**
7038+
* Determines if faction standing batchall restriction is enabled.
7039+
*
7040+
* <p><b>Usage:</b> for most use cases you will want to use {@link #isUseFactionStandingBatchallRestrictionsSafe()} as
7041+
* that also verifies that Faction Standing is enabled.</p>
7042+
*
7043+
* @return {@code true} if faction standing batchall restriction is enabled, {@code false} otherwise.
7044+
*/
69467045
public boolean isUseFactionStandingBatchallRestrictions() {
69477046
return useFactionStandingBatchallRestrictions;
69487047
}
69497048

7049+
/**
7050+
* Checks whether tracking faction standing is enabled and if the use of faction standing batchall restrictions are
7051+
* active.
7052+
*
7053+
* @return {@code true} if both faction standing tracking and faction standing batchall restrictions
7054+
* usage are enabled; {@code false} otherwise.
7055+
*/
7056+
public boolean isUseFactionStandingBatchallRestrictionsSafe() {
7057+
return trackFactionStanding && useFactionStandingBatchallRestrictions;
7058+
}
7059+
69507060
public void setUseFactionStandingBatchallRestrictions(boolean useFactionStandingBatchallRestrictions) {
69517061
this.useFactionStandingBatchallRestrictions = useFactionStandingBatchallRestrictions;
69527062
}
69537063

7064+
/**
7065+
* Determines if faction standing recruitment modifiers is enabled.
7066+
*
7067+
* <p><b>Usage:</b> for most use cases you will want to use {@link #isUseFactionStandingRecruitmentSafe()} as
7068+
* that also verifies that Faction Standing is enabled.</p>
7069+
*
7070+
* @return {@code true} if faction standing recruitment modifiers is enabled, {@code false} otherwise.
7071+
*/
69547072
public boolean isUseFactionStandingRecruitment() {
69557073
return useFactionStandingRecruitment;
69567074
}
69577075

7076+
/**
7077+
* Checks whether tracking faction standing is enabled and if the use of faction standing recruitment modifiers is
7078+
* active.
7079+
*
7080+
* @return {@code true} if both faction standing tracking and faction standing recruitment modifier
7081+
* usage are enabled; {@code false} otherwise.
7082+
*/
7083+
public boolean isUseFactionStandingRecruitmentSafe() {
7084+
return trackFactionStanding && useFactionStandingRecruitment;
7085+
}
7086+
69587087
public void setUseFactionStandingRecruitment(boolean useFactionStandingRecruitment) {
69597088
this.useFactionStandingRecruitment = useFactionStandingRecruitment;
69607089
}
69617090

7091+
/**
7092+
* Determines if faction standing barrack costs is enabled.
7093+
*
7094+
* <p><b>Usage:</b> for most use cases you will want to use {@link #isUseFactionStandingBarracksCostsSafe()} as
7095+
* that also verifies that Faction Standing is enabled.</p>
7096+
*
7097+
* @return {@code true} if faction standing barrack costs is enabled, {@code false} otherwise.
7098+
*/
69627099
public boolean isUseFactionStandingBarracksCosts() {
69637100
return useFactionStandingBarracksCosts;
69647101
}
69657102

7103+
/**
7104+
* Checks whether tracking faction standing is enabled and if the use of faction standing barrack cost modifiers is
7105+
* active.
7106+
*
7107+
* @return {@code true} if both faction standing tracking and faction standing barrack cost modifier
7108+
* usage are enabled; {@code false} otherwise.
7109+
*/
7110+
public boolean isUseFactionStandingBarracksCostsSafe() {
7111+
return trackFactionStanding && useFactionStandingBarracksCosts;
7112+
}
7113+
69667114
public void setUseFactionStandingBarracksCosts(boolean useFactionStandingBarracksCosts) {
69677115
this.useFactionStandingBarracksCosts = useFactionStandingBarracksCosts;
69687116
}
69697117

7118+
/**
7119+
* Determines if faction standing unit market modifiers is enabled.
7120+
*
7121+
* <p><b>Usage:</b> for most use cases you will want to use {@link #isUseFactionStandingUnitMarketSafe()} as
7122+
* that also verifies that Faction Standing is enabled.</p>
7123+
*
7124+
* @return {@code true} if faction standing unit market modifiers is enabled, {@code false} otherwise.
7125+
*/
69707126
public boolean isUseFactionStandingUnitMarket() {
69717127
return useFactionStandingUnitMarket;
69727128
}
69737129

7130+
/**
7131+
* Checks whether tracking faction standing is enabled and if the use of faction standing unit market modifiers is
7132+
* active.
7133+
*
7134+
* @return {@code true} if both faction standing tracking and faction standing unit market modifier
7135+
* usage are enabled; {@code false} otherwise.
7136+
*/
7137+
public boolean isUseFactionStandingUnitMarketSafe() {
7138+
return trackFactionStanding && useFactionStandingUnitMarket;
7139+
}
7140+
69747141
public void setUseFactionStandingUnitMarket(boolean useFactionStandingUnitMarket) {
69757142
this.useFactionStandingUnitMarket = useFactionStandingUnitMarket;
69767143
}
69777144

7145+
/**
7146+
* Determines if faction standing contract pay is enabled.
7147+
*
7148+
* <p><b>Usage:</b> for most use cases you will want to use {@link #isUseFactionStandingContractPaySafe()} as
7149+
* that also verifies that Faction Standing is enabled.</p>
7150+
*
7151+
* @return {@code true} if faction standing contract pay is enabled, {@code false} otherwise.
7152+
*/
69787153
public boolean isUseFactionStandingContractPay() {
69797154
return useFactionStandingContractPay;
69807155
}
69817156

7157+
/**
7158+
* Checks whether tracking faction standing is enabled and if the use of faction standing contract payment modifiers
7159+
* is active.
7160+
*
7161+
* @return {@code true} if both faction standing tracking and faction standing contract pay modifier
7162+
* usage are enabled; {@code false} otherwise.
7163+
*/
7164+
public boolean isUseFactionStandingContractPaySafe() {
7165+
return trackFactionStanding && useFactionStandingContractPay;
7166+
}
7167+
69827168
public void setUseFactionStandingContractPay(boolean useFactionStandingContractPay) {
69837169
this.useFactionStandingContractPay = useFactionStandingContractPay;
69847170
}
69857171

7172+
/**
7173+
* Determines if faction standing support points is enabled.
7174+
*
7175+
* <p><b>Usage:</b> for most use cases you will want to use {@link #isUseFactionStandingSupportPointsSafe()} as
7176+
* that also verifies that Faction Standing is enabled.</p>
7177+
*
7178+
* @return {@code true} if faction standing support points is enabled, {@code false} otherwise.
7179+
*/
69867180
public boolean isUseFactionStandingSupportPoints() {
69877181
return useFactionStandingSupportPoints;
69887182
}
69897183

7184+
/**
7185+
* Checks whether tracking faction standing is enabled and if the use of faction standing support point modifiers
7186+
* is active.
7187+
*
7188+
* @return {@code true} if both faction standing tracking and faction standing resupply modifier
7189+
* usage are enabled; {@code false} otherwise.
7190+
*/
7191+
public boolean isUseFactionStandingSupportPointsSafe() {
7192+
return trackFactionStanding && useFactionStandingSupportPoints;
7193+
}
7194+
69907195
public void setUseFactionStandingSupportPoints(boolean useFactionStandingSupportPoints) {
69917196
this.useFactionStandingSupportPoints = useFactionStandingSupportPoints;
69927197
}

MekHQ/src/mekhq/campaign/universe/factionStanding/FactionStandingLevel.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -440,32 +440,33 @@ public String getEffectsDescription(boolean isClan, CampaignOptions campaignOpti
440440
logger.info(this);
441441
List<String> effects = new ArrayList<>();
442442

443-
if (hasCommandCircuitAccess && campaignOptions.isUseFactionStandingCommandCircuit()) {
443+
if (hasCommandCircuitAccess && campaignOptions.isUseFactionStandingCommandCircuitSafe()) {
444444
effects.add(getFormattedTextAt(RESOURCE_BUNDLE, "factionStandingLevel.commandCircuit"));
445445
}
446446

447-
if (isOutlawed && campaignOptions.isUseFactionStandingOutlawed()) {
447+
if (isOutlawed && campaignOptions.isUseFactionStandingOutlawedSafe()) {
448448
effects.add(getFormattedTextAt(RESOURCE_BUNDLE, "factionStandingLevel.outlawed"));
449449
}
450450

451-
if (isClan && !isBatchallAllowed && campaignOptions.isUseFactionStandingBatchallRestrictions()) {
451+
if (isClan && !isBatchallAllowed && campaignOptions.isUseFactionStandingBatchallRestrictionsSafe()) {
452452
effects.add(getFormattedTextAt(RESOURCE_BUNDLE, "factionStandingLevel.batchall"));
453453
}
454454

455-
if (negotiationModifier != 0 && campaignOptions.isUseFactionStandingNegotiation()) {
455+
if (negotiationModifier != 0 && campaignOptions.isUseFactionStandingNegotiationSafe()) {
456456
effects.add(getFormattedTextAt(RESOURCE_BUNDLE,
457457
"factionStandingLevel.negotiation",
458458
getPolarityOfModifier(negotiationModifier)));
459459
}
460460

461+
final boolean isUseStratCon = campaignOptions.isUseStratCon();
461462
if (resupplyWeightModifier != 1.0
462-
&& campaignOptions.isUseStratCon()
463-
&& campaignOptions.isUseFactionStandingResupply()) {
463+
&& isUseStratCon
464+
&& campaignOptions.isUseFactionStandingResupplySafe()) {
464465
int resupplyPercentage = (int) round(resupplyWeightModifier * 100);
465466
effects.add(getFormattedTextAt(RESOURCE_BUNDLE, "factionStandingLevel.resupply", resupplyPercentage));
466467
}
467468

468-
if (campaignOptions.isUseFactionStandingRecruitment()) {
469+
if (campaignOptions.isUseFactionStandingRecruitmentSafe()) {
469470
int ticketsModifier = recruitmentTickets - STANDING_LEVEL_4.getRecruitmentTickets();
470471
if (ticketsModifier != 0) {
471472
effects.add(getFormattedTextAt(RESOURCE_BUNDLE, "factionStandingLevel.recruitment.popularity",
@@ -478,22 +479,24 @@ public String getEffectsDescription(boolean isClan, CampaignOptions campaignOpti
478479
}
479480
}
480481

481-
if (barrackCostsMultiplier != 1.0 && campaignOptions.isUseFactionStandingBarracksCosts()) {
482+
if (barrackCostsMultiplier != 1.0 && campaignOptions.isUseFactionStandingBarracksCostsSafe()) {
482483
int barracksCostPercentage = (int) round(barrackCostsMultiplier * 100);
483484
effects.add(getFormattedTextAt(RESOURCE_BUNDLE, "factionStandingLevel.barracks", barracksCostPercentage));
484485
}
485486

486-
if (unitMarketRarityModifier != 0 && campaignOptions.isUseFactionStandingUnitMarket()) {
487+
if (unitMarketRarityModifier != 0
488+
&& !campaignOptions.getUnitMarketMethod().isNone()
489+
&& campaignOptions.isUseFactionStandingUnitMarketSafe()) {
487490
effects.add(getFormattedTextAt(RESOURCE_BUNDLE, "factionStandingLevel.unitMarket",
488491
getPolarityOfModifier(unitMarketRarityModifier)));
489492
}
490493

491-
if (contractPayMultiplier != 1.0 && campaignOptions.isUseFactionStandingContractPay()) {
494+
if (contractPayMultiplier != 1.0 && campaignOptions.isUseFactionStandingContractPaySafe()) {
492495
int payPercentage = (int) round(contractPayMultiplier * 100);
493496
effects.add(getFormattedTextAt(RESOURCE_BUNDLE, "factionStandingLevel.contractPay", payPercentage));
494497
}
495498

496-
if (campaignOptions.isUseFactionStandingSupportPoints()) {
499+
if (isUseStratCon && campaignOptions.isUseFactionStandingSupportPointsSafe()) {
497500
if (supportPointModifierContractStart != 0) {
498501
effects.add(getFormattedTextAt(RESOURCE_BUNDLE, "factionStandingLevel.supportPoints.signing",
499502
getPolarityOfModifier(supportPointModifierContractStart)));

0 commit comments

Comments
 (0)