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

Expanded autoAwards Coverage to Include 'Prisoner of War' #4422

Merged
merged 1 commit into from
Jul 17, 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
27 changes: 14 additions & 13 deletions MekHQ/data/universe/awards/standard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@
<edge>2</edge>
<item>Ignore</item>
</award>
<award>
<name>Prisoner of War</name>
<description>Taken prisoner during combat.</description>
<group>Manual Awards</group>
<medal>POWM.png</medal>
<ribbon>3-01-1-PrisonerOfWar.png</ribbon>
<xp>1</xp>
<edge>1</edge>
<stackable>true</stackable>
<item>Ignore</item>
</award>
<award>
<name>Support Person Of The Year</name>
<description>Awarded to the most outstanding non-combat member of the year.</description>
Expand Down Expand Up @@ -131,10 +120,22 @@
<qty>6</qty>
<item>Time</item>
</award>
<award>
<name>Prisoner of War</name>
<description>Taken prisoner during combat.</description>
<group>Manual Awards</group>
<medal>POWM.png</medal>
<ribbon>3-01-1-PrisonerOfWar.png</ribbon>
<xp>1</xp>
<edge>1</edge>
<stackable>true</stackable>
<item>Misc</item>
<range>Prisoner of War</range>
</award>
<award>
<name>Medal of Honor</name>
<description>Distinguished oneself conspicuously by gallantry and intrepidity at the risk of life above and beyond the call of duty.</description>
<group>Manual Awards</group>
<group>Personal Awards</group>
<medal>MedalOfHonorM.png</medal>
<ribbon>1-01-1-MedalOfHonor.png</ribbon>
<xp>10</xp>
Expand Down Expand Up @@ -276,7 +277,7 @@
<award>
<name>Ceremonial Duty</name>
<description>Served as honor guard.</description>
<group>Manual Awards</group>
<group>Mission Awards</group>
<ribbon>4-05-1-CeremonialDuty.png</ribbon>
<xp>1</xp>
<item>Ceremonial Duty</item>
Expand Down
20 changes: 20 additions & 0 deletions MekHQ/src/mekhq/campaign/personnel/autoAwards/MiscAwards.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public static Map<Integer, List<Object>> MiscAwardsProcessor(Campaign campaign,
if (CeremonialDuty(campaign, award, person, mission)) {
eligibleAwards.add(award);
}
case "prisonerofwar":
if (prisonerOfWar(campaign, award, person)) {
eligibleAwards.add(award);
}
default:
}
}
Expand Down Expand Up @@ -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;
}
}