From b8ec1c0bc73f9be7673eeeaaae8d10658d9c2ab9 Mon Sep 17 00:00:00 2001 From: IllianiCBT Date: Wed, 25 Sep 2024 10:57:20 -0500 Subject: [PATCH] Added Mission Check for 'prisonerofwar' Award Eligibility Moved the 'prisoner of war' type of Misc Award to be issued only at the end of a Mission. --- .../personnel/autoAwards/MiscAwards.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/MekHQ/src/mekhq/campaign/personnel/autoAwards/MiscAwards.java b/MekHQ/src/mekhq/campaign/personnel/autoAwards/MiscAwards.java index 0fdc54f05c..6dcac12bec 100644 --- a/MekHQ/src/mekhq/campaign/personnel/autoAwards/MiscAwards.java +++ b/MekHQ/src/mekhq/campaign/personnel/autoAwards/MiscAwards.java @@ -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; @@ -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 @@ -64,9 +59,8 @@ public class MiscAwards { * @return a map of eligible awards grouped by their respective IDs */ public static Map> MiscAwardsProcessor(Campaign campaign, @Nullable Mission mission, - UUID person, List awards, - Boolean missionWasSuccessful, boolean isCivilianHelp, @Nullable Integer killCount, - @Nullable Integer injuryCount, @Nullable UUID supportPersonOfTheYear) { + UUID person, List awards, Boolean missionWasSuccessful, boolean isCivilianHelp, + @Nullable Integer killCount, @Nullable Integer injuryCount, @Nullable UUID supportPersonOfTheYear) { List eligibleAwards = new ArrayList<>(); for (Award award : awards) { @@ -102,7 +96,7 @@ public static Map> MiscAwardsProcessor(Campaign campaign, } } case "prisonerofwar" -> { - if (prisonerOfWar(campaign, award, person)) { + if (mission != null && prisonerOfWar(campaign, award, person)) { eligibleAwards.add(award); } }