Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Mission Check for 'prisonerofwar' Award Eligibility #4881

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions MekHQ/src/mekhq/campaign/personnel/death/AbstractDeath.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public Map<Gender, Map<TenYearAgeRange, WeightedDoubleMap<PersonnelStatus>>> get

/**
* This is used to determine if a person can die.
*
*
* @param person the person to determine for
* @param ageGroup the age group of the person in question
* @param randomDeath if this is for random death or manual death
Expand Down Expand Up @@ -144,7 +144,7 @@ public Map<Gender, Map<TenYearAgeRange, WeightedDoubleMap<PersonnelStatus>>> get
// region New Day
/**
* Processes new day random death for an individual.
*
*
* @param campaign the campaign to process
* @param today the current day
* @param person the person to process
Expand Down