Skip to content

Commit

Permalink
Merge pull request #4881 from IllianiCBT/autoAwards_pow
Browse files Browse the repository at this point in the history
Added Mission Check for 'prisonerofwar' Award Eligibility
  • Loading branch information
HammerGS authored Sep 25, 2024
2 parents 903f3fd + b8ec1c0 commit edb3e8e
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions MekHQ/src/mekhq/campaign/personnel/autoAwards/MiscAwards.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@

package mekhq.campaign.personnel.autoAwards;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.UUID;

import megamek.common.annotations.Nullable;
import mekhq.MekHQ;
import mekhq.campaign.Campaign;
Expand All @@ -38,14 +31,16 @@
import mekhq.campaign.universe.PlanetarySystem;
import mekhq.campaign.universe.RandomFactionGenerator;

import java.time.LocalDate;
import java.util.*;

public class MiscAwards {

/**
* This function processes miscellaneous awards for a given person in a
* campaign.
* It checks the eligibility of the person for each type of award and returns a
* map
* of eligible awards grouped by their respective IDs.
* map of eligible awards grouped by their respective IDs.
*
* @param campaign the current campaign
* @param mission the mission just completed (null if no mission
Expand All @@ -64,9 +59,8 @@ public class MiscAwards {
* @return a map of eligible awards grouped by their respective IDs
*/
public static Map<Integer, List<Object>> MiscAwardsProcessor(Campaign campaign, @Nullable Mission mission,
UUID person, List<Award> awards,
Boolean missionWasSuccessful, boolean isCivilianHelp, @Nullable Integer killCount,
@Nullable Integer injuryCount, @Nullable UUID supportPersonOfTheYear) {
UUID person, List<Award> awards, Boolean missionWasSuccessful, boolean isCivilianHelp,
@Nullable Integer killCount, @Nullable Integer injuryCount, @Nullable UUID supportPersonOfTheYear) {
List<Award> eligibleAwards = new ArrayList<>();

for (Award award : awards) {
Expand Down Expand Up @@ -102,7 +96,7 @@ public static Map<Integer, List<Object>> MiscAwardsProcessor(Campaign campaign,
}
}
case "prisonerofwar" -> {
if (prisonerOfWar(campaign, award, person)) {
if (mission != null && prisonerOfWar(campaign, award, person)) {
eligibleAwards.add(award);
}
}
Expand Down

0 comments on commit edb3e8e

Please sign in to comment.