Skip to content

Commit

Permalink
Merge pull request #5708 from IllianiCBT/stratCon_supportPointSoftCap
Browse files Browse the repository at this point in the history
Added a Soft Cap to Support Point Generation
  • Loading branch information
Sleet01 authored Jan 9, 2025
2 parents 9018040 + 860882e commit d85c65f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
4 changes: 4 additions & 0 deletions MekHQ/resources/mekhq/resources/AtBStratCon.properties
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ unitsSelectedLabel.bv=selected (ignores crew skill)
unitsSelectedLabel.count=selected

### Support Point Negotiation
supportPoints.maximum=Your Admin/Transport personnel cannot use their <i>Administration</i>\
\ skill to create additional Support Points for contract %s, as you have already %s<b>reached the\
\ maximum</b>%s of %s Support Point%s.

supportPoints.initial=Through the <i>Administration</i> skill of your Admin/Transport personnel\
\ contract %s will begin with %s<b>%s</b>%s Support Point%s.
supportPoints.initial.noAdministrators=Your unit has no Admin/Transport personnel. Therefore, contract %s\
Expand Down
22 changes: 21 additions & 1 deletion MekHQ/src/mekhq/campaign/stratcon/SupportPointNegotiation.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,26 @@ private static void processContractSupportPoints(Campaign campaign, AtBContract
? contract.getRequiredLances() * 3
: contract.getRequiredLances();

StratconCampaignState campaignState = contract.getStratconCampaignState();

if (campaignState == null) {
return;
}

if (campaignState.getSupportPoints() >= maxSupportPoints) {
String pluralizer = (maxSupportPoints > 1) || (maxSupportPoints == 0) ? "s" : "";

campaign.addReport(String.format(
resources.getString("supportPoints.maximum"),
contract.getName(),
spanOpeningWithCustomColor(MekHQ.getMHQOptions().getFontColorWarningHexColor()),
CLOSING_SPAN_TAG,
negotiatedSupportPoints,
pluralizer));

return;
}

Iterator<Person> iterator = adminTransport.iterator();

while (iterator.hasNext() && negotiatedSupportPoints < maxSupportPoints) {
Expand All @@ -139,7 +159,7 @@ private static void processContractSupportPoints(Campaign campaign, AtBContract

// Add points to the contract if positive
if (negotiatedSupportPoints > 0) {
contract.getStratconCampaignState().addSupportPoints(negotiatedSupportPoints);
campaignState.addSupportPoints(negotiatedSupportPoints);
}

// Add a report
Expand Down

0 comments on commit d85c65f

Please sign in to comment.