diff --git a/MekHQ/resources/mekhq/resources/PersonnelStatus.properties b/MekHQ/resources/mekhq/resources/PersonnelStatus.properties index f97dac5d7a6..f13d1b56781 100644 --- a/MekHQ/resources/mekhq/resources/PersonnelStatus.properties +++ b/MekHQ/resources/mekhq/resources/PersonnelStatus.properties @@ -63,6 +63,10 @@ BONDSREF.label=Bondsref BONDSREF.tooltip=They have performed Bondsref BONDSREF.report=%s has preformed {0}Bondsref{1} instead of becoming a Bondsman. BONDSREF.log=Performed Bondsref +SEPPUKU.label=Seppuku +SEPPUKU.tooltip=They have performed Seppuku +SEPPUKU.report=%s has performed {0}Seppuku{1} instead of becoming a Prisoner. +SEPPUKU.log=Performed Seppuku ### DEATH KIA.label=Killed in Action KIA.tooltip=They have been killed in action. diff --git a/MekHQ/resources/mekhq/resources/PrisonerEvents.properties b/MekHQ/resources/mekhq/resources/PrisonerEvents.properties index cbbf0002ef1..ce120616d84 100644 --- a/MekHQ/resources/mekhq/resources/PrisonerEvents.properties +++ b/MekHQ/resources/mekhq/resources/PrisonerEvents.properties @@ -3,6 +3,8 @@ # CapturePrisoners.java bondsref.report={0} has performed {1}Bondsref{2} instead of accepting capture by our forces.\ \ Their body has been transported to the morgue. +seppuku.report={0} has performed {1}Seppuku{2} instead of accepting capture by our forces.\ + \ Their body has been transported to the morgue. # EVENT GENERAL result.ooc=Closing or canceling this conversation will automatically pick the first option.\

Normally this situation will be caused by low Prisoner Capacity. If that\ diff --git a/MekHQ/src/mekhq/campaign/personnel/enums/PersonnelStatus.java b/MekHQ/src/mekhq/campaign/personnel/enums/PersonnelStatus.java index 38639d3a72b..c8b287ab023 100644 --- a/MekHQ/src/mekhq/campaign/personnel/enums/PersonnelStatus.java +++ b/MekHQ/src/mekhq/campaign/personnel/enums/PersonnelStatus.java @@ -24,6 +24,11 @@ * * Catalyst Game Labs and the Catalyst Game Labs logo are trademarks of * InMediaRes Productions, LLC. + * + * MechWarrior Copyright Microsoft Corporation. MekHQ was created under + * Microsoft's "Game Content Usage Rules" + * and it is not endorsed by or + * affiliated with Microsoft. */ package mekhq.campaign.personnel.enums; @@ -81,7 +86,8 @@ public enum PersonnelStatus { UNDETERMINED(NotificationSeverity.NEGATIVE, true, true), SUICIDE(NotificationSeverity.NEGATIVE, true, true), ENEMY_BONDSMAN(NotificationSeverity.NEGATIVE, false, false), - BONDSREF(NotificationSeverity.NEGATIVE, true, true); + BONDSREF(NotificationSeverity.NEGATIVE, true, true), + SEPPUKU(NotificationSeverity.NEGATIVE, true, true); /** * Represents the severity levels of a status. @@ -490,6 +496,15 @@ public boolean isBondsref() { return this == BONDSREF; } + /** + * Checks if the character has the {@code SEPPUKU} personnel status. + * + * @return {@code true} if the character has the {@code SEPPUKU} personnel status {@code false} otherwise. + */ + public boolean isSeppuku() { + return this == SEPPUKU; + } + /** * @return {@code true} if a person is currently absent from the core force, otherwise {@code false} */ @@ -533,8 +548,7 @@ public boolean isDead() { isMedicalComplications() || isPregnancyComplications() || isUndetermined() || - isSuicide() || - isBondsref(); + isSuicide() || isBondsref() || isSeppuku(); } /** diff --git a/MekHQ/src/mekhq/campaign/randomEvents/prisoners/CapturePrisoners.java b/MekHQ/src/mekhq/campaign/randomEvents/prisoners/CapturePrisoners.java index d035f475273..33ab2b65495 100644 --- a/MekHQ/src/mekhq/campaign/randomEvents/prisoners/CapturePrisoners.java +++ b/MekHQ/src/mekhq/campaign/randomEvents/prisoners/CapturePrisoners.java @@ -24,10 +24,14 @@ * * Catalyst Game Labs and the Catalyst Game Labs logo are trademarks of * InMediaRes Productions, LLC. + * + * MechWarrior Copyright Microsoft Corporation. MekHQ was created under + * Microsoft's "Game Content Usage Rules" + * and it is not endorsed by or + * affiliated with Microsoft. */ package mekhq.campaign.randomEvents.prisoners; -import static java.lang.Math.round; import static megamek.common.Board.T_SPACE; import static megamek.common.MiscType.createBeagleActiveProbe; import static megamek.common.MiscType.createCLImprovedSensors; @@ -38,6 +42,7 @@ import static mekhq.campaign.personnel.enums.PersonnelStatus.KIA; import static mekhq.campaign.personnel.enums.PersonnelStatus.MIA; import static mekhq.campaign.personnel.enums.PersonnelStatus.POW; +import static mekhq.campaign.personnel.enums.PersonnelStatus.SEPPUKU; import static mekhq.campaign.randomEvents.prisoners.enums.PrisonerStatus.BECOMING_BONDSMAN; import static mekhq.campaign.randomEvents.prisoners.enums.PrisonerStatus.PRISONER; import static mekhq.campaign.randomEvents.prisoners.enums.PrisonerStatus.PRISONER_DEFECTOR; @@ -49,6 +54,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Objects; import megamek.common.Compute; import megamek.common.ITechnology; @@ -275,7 +281,7 @@ void processPrisoner(Person prisoner, @Nullable Faction capturingFaction, boolea int bondsmanRoll = d6(1); if (capturingFaction != null && capturingFaction.isClan()) { - if (isMekHQCaptureStyle && prisoner.isClanPersonnel() && (bondsmanRoll == 1)) { + if (isMekHQCaptureStyle && prisoner.isClanPersonnel() && (bondsmanRoll + d6(1) == 2)) { if (isNPC) { campaign.addReport(getFormattedTextAt(RESOURCE_BUNDLE, "bondsref.report", @@ -297,6 +303,40 @@ void processPrisoner(Person prisoner, @Nullable Faction capturingFaction, boolea } return; } + } else if (capturingFaction != null && capturingFaction.getHonorRating(campaign) == HonorRating.NONE) { + if (bondsmanRoll == 1) { + if (isNPC) { + campaign.addReport(getFormattedTextAt(RESOURCE_BUNDLE, + "bondsref.report", + prisoner.getFullName(), + spanOpeningWithCustomColor(MekHQ.getMHQOptions().getFontColorNegativeHexColor()), + CLOSING_SPAN_TAG)); + + campaign.removePerson(prisoner); + } else { + prisoner.changeStatus(campaign, today, POW); + } + return; + } + } + + if (isMekHQCaptureStyle) { + if (Objects.equals(prisoner.getOriginFaction().getShortName(), "DC")) { + if (d6(2) == 2) { + if (isNPC) { + campaign.addReport(getFormattedTextAt(RESOURCE_BUNDLE, + "seppuku.report", + prisoner.getFullName(), + spanOpeningWithCustomColor(MekHQ.getMHQOptions().getFontColorNegativeHexColor()), + CLOSING_SPAN_TAG)); + + campaign.removePerson(prisoner); + } else { + prisoner.changeStatus(campaign, today, SEPPUKU); + } + return; + } + } } if (isNPC) { @@ -323,7 +363,7 @@ int determineDefectionChance(Person potentialDefector, boolean isNPC) { int adjustedDefectionChance = DEFECTION_CHANCE; if (potentialDefector.getOriginFaction().isMercenary()) { - adjustedDefectionChance = (int) round(adjustedDefectionChance * MERCENARY_MULTIPLIER); + adjustedDefectionChance = (int) Math.round(adjustedDefectionChance * MERCENARY_MULTIPLIER); } if (potentialDefector.isClanPersonnel()) { diff --git a/MekHQ/unittests/mekhq/campaign/personnel/enums/PersonnelStatusTest.java b/MekHQ/unittests/mekhq/campaign/personnel/enums/PersonnelStatusTest.java index e96f5bc22ee..5ddba83152a 100644 --- a/MekHQ/unittests/mekhq/campaign/personnel/enums/PersonnelStatusTest.java +++ b/MekHQ/unittests/mekhq/campaign/personnel/enums/PersonnelStatusTest.java @@ -24,18 +24,23 @@ * * Catalyst Game Labs and the Catalyst Game Labs logo are trademarks of * InMediaRes Productions, LLC. + * + * MechWarrior Copyright Microsoft Corporation. MekHQ was created under + * Microsoft's "Game Content Usage Rules" + * and it is not endorsed by or + * affiliated with Microsoft. */ package mekhq.campaign.personnel.enums; -import org.junit.jupiter.api.Test; - -import java.util.List; - import static mekhq.campaign.personnel.enums.PersonnelStatus.*; import static mekhq.utilities.MHQInternationalization.isResourceKeyValid; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; +import java.util.List; + +import org.junit.jupiter.api.Test; + public class PersonnelStatusTest { @Test public void testFromString_ValidStatus() { @@ -119,7 +124,9 @@ public void testIsAbsent() { public void testIsDepartedUnit() { List deadStatuses = List.of(KIA, HOMICIDE, WOUNDS, DISEASE, ACCIDENTAL, NATURAL_CAUSES, OLD_AGE, MEDICAL_COMPLICATIONS, PREGNANCY_COMPLICATIONS, UNDETERMINED, - SUICIDE, BONDSREF); + SUICIDE, + BONDSREF, + SEPPUKU); List validStatuses = List.of(RETIRED, RESIGNED, SACKED, DESERTED, DEFECTED, MISSING, LEFT, ENEMY_BONDSMAN); @@ -134,7 +141,9 @@ public void testIsDepartedUnit() { public void testIsDead() { List validStatuses = List.of(KIA, HOMICIDE, WOUNDS, DISEASE, ACCIDENTAL, NATURAL_CAUSES, OLD_AGE, MEDICAL_COMPLICATIONS, PREGNANCY_COMPLICATIONS, UNDETERMINED, - SUICIDE, BONDSREF); + SUICIDE, + BONDSREF, + SEPPUKU); for (PersonnelStatus status : PersonnelStatus.values()) { boolean isDead = validStatuses.contains(status); @@ -147,7 +156,10 @@ public void testIsDead() { public void testIsDeadOrMIA() { List validStatuses = List.of(KIA, HOMICIDE, WOUNDS, DISEASE, ACCIDENTAL, NATURAL_CAUSES, OLD_AGE, MEDICAL_COMPLICATIONS, PREGNANCY_COMPLICATIONS, UNDETERMINED, - SUICIDE, BONDSREF, MIA); + SUICIDE, + BONDSREF, + MIA, + SEPPUKU); for (PersonnelStatus status : PersonnelStatus.values()) { boolean isDeadOrMIA = validStatuses.contains(status);