From c965c9387d25603f61e7cda5e6dfa7ebb2eb1596 Mon Sep 17 00:00:00 2001 From: IllianiCBT Date: Tue, 16 Jul 2024 11:49:47 -0500 Subject: [PATCH] Expanded autoAwards Coverage to Include 'Prisoner of War' The 'Prisoner of War' award was relocated in the 'standard.xml' file for better organization. Additionally, changed group categorizations for 'Medal of Honor' and 'Ceremonial Duty'. Added checks for 'Prisoner of War' eligibility in 'MiscAwards.java'. --- MekHQ/data/universe/awards/standard.xml | 27 ++++++++++--------- .../personnel/autoAwards/MiscAwards.java | 20 ++++++++++++++ 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/MekHQ/data/universe/awards/standard.xml b/MekHQ/data/universe/awards/standard.xml index c7c067663d..9f8895fdf7 100644 --- a/MekHQ/data/universe/awards/standard.xml +++ b/MekHQ/data/universe/awards/standard.xml @@ -23,17 +23,6 @@ 2 Ignore - - Prisoner of War - Taken prisoner during combat. - Manual Awards - POWM.png - 3-01-1-PrisonerOfWar.png - 1 - 1 - true - Ignore - Support Person Of The Year Awarded to the most outstanding non-combat member of the year. @@ -131,10 +120,22 @@ 6 Time + + Prisoner of War + Taken prisoner during combat. + Manual Awards + POWM.png + 3-01-1-PrisonerOfWar.png + 1 + 1 + true + Misc + Prisoner of War + Medal of Honor Distinguished oneself conspicuously by gallantry and intrepidity at the risk of life above and beyond the call of duty. - Manual Awards + Personal Awards MedalOfHonorM.png 1-01-1-MedalOfHonor.png 10 @@ -276,7 +277,7 @@ Ceremonial Duty Served as honor guard. - Manual Awards + Mission Awards 4-05-1-CeremonialDuty.png 1 Ceremonial Duty diff --git a/MekHQ/src/mekhq/campaign/personnel/autoAwards/MiscAwards.java b/MekHQ/src/mekhq/campaign/personnel/autoAwards/MiscAwards.java index b601d4adf2..8e16e0b853 100644 --- a/MekHQ/src/mekhq/campaign/personnel/autoAwards/MiscAwards.java +++ b/MekHQ/src/mekhq/campaign/personnel/autoAwards/MiscAwards.java @@ -70,6 +70,10 @@ public static Map> MiscAwardsProcessor(Campaign campaign, if (CeremonialDuty(campaign, award, person, mission)) { eligibleAwards.add(award); } + case "prisonerofwar": + if (prisonerOfWar(campaign, award, person)) { + eligibleAwards.add(award); + } default: } } @@ -197,4 +201,20 @@ private static boolean CeremonialDuty(Campaign campaign, Award award, UUID perso } return false; } + + /** + * Checks if a person is a prisoner of war in a given campaign and is eligible to receive an award. + * + * @param campaign the campaign in which the person is participating + * @param award the award to be given + * @param person the unique identifier of the person to check + * @return true if the person is a prisoner of war and is eligible to receive the award, false otherwise + */ + private static boolean prisonerOfWar(Campaign campaign, Award award, UUID person) { + if (award.canBeAwarded(campaign.getPerson(person))) { + return campaign.getPerson(person).getStatus().isPoW(); + } + + return false; + } }