Skip to content

Commit

Permalink
Added Mission Check for 'prisonerofwar' Award Eligibility
Browse files Browse the repository at this point in the history
Moved the 'prisoner of war' type of Misc Award to be issued only at the end of a Mission.
  • Loading branch information
IllianiCBT committed Sep 25, 2024
1 parent 8619d8e commit b8ec1c0
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 b8ec1c0

Please sign in to comment.