Skip to content

Commit

Permalink
2521: Star League Caches no longer generate in eras before the Star L…
Browse files Browse the repository at this point in the history
…eague
  • Loading branch information
Windchild292 committed Aug 21, 2021
1 parent 3a471af commit f89e20e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MekHQ/src/mekhq/campaign/mission/AtBContract.java
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ public void checkEvents(Campaign c) {
case EVT_SPECIALMISSION:
c.addReport("<b>Special Event:</b> Special mission this month");
specialEventScenarioDate = getRandomDayOfMonth(c.getLocalDate());
specialEventScenarioType = getContractType().generateSpecialMissionType();
specialEventScenarioType = getContractType().generateSpecialMissionType(c);
break;
case EVT_CIVILDISTURBANCE:
c.addReport("<b>Special Event:</b> Civil disturbance<br />Next enemy morale roll gets +1 modifier");
Expand Down
9 changes: 7 additions & 2 deletions MekHQ/src/mekhq/campaign/mission/enums/AtBContractType.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
import megamek.common.Compute;
import megamek.common.util.EncodeControl;
import mekhq.MekHQ;
import mekhq.campaign.Campaign;
import mekhq.campaign.mission.AtBContract;
import mekhq.campaign.mission.AtBScenario;
import mekhq.campaign.universe.enums.EraFlag;

import java.util.ResourceBundle;

Expand Down Expand Up @@ -345,8 +347,11 @@ public int generateEventType() {
}
}

public int generateSpecialMissionType() {
final int roll = Compute.randomInt(20) + 1;
public int generateSpecialMissionType(final Campaign campaign) {
// Our roll is era-based. If it is pre-spaceflight, early spaceflight, or Age of War there
// cannot be Star League Caches as the Star League hasn't formed
final int roll = Compute.randomInt(campaign.getEra().hasFlag(EraFlag.PRE_SPACEFLIGHT,
EraFlag.EARLY_SPACEFLIGHT, EraFlag.AGE_OF_WAR) ? 12 : 20) + 1;
switch (this) {
case DIVERSIONARY_RAID:
case OBJECTIVE_RAID:
Expand Down

0 comments on commit f89e20e

Please sign in to comment.