-
Notifications
You must be signed in to change notification settings - Fork 188
Improvement: Adjusted the Rate of Captured Clan Personnel Committing Bondsref; Added the Ability for Captured Combine Personnel to Commit Seppuku #6907
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9301ead
Improvement: Adjusted the Rate of Captured Clan Personnel Committing …
IllianiBird fa14d56
Minor fix
IllianiBird c559eee
Added null protection
IllianiBird dd3d567
Explicit import
IllianiBird 4746eeb
Fixed typo
IllianiBird 7a85fa2
Merge branch 'master' into seppuku
IllianiBird d9085b5
Added check to ensure player is on MekHQCaptureStyle before processin…
IllianiBird e239fab
Update MekHQ/resources/mekhq/resources/PersonnelStatus.properties
IllianiBird a78ef73
Merge branch 'master' into seppuku
HammerGS ddd18b6
Merge branch 'master' into seppuku
HammerGS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
* <https://www.xbox.com/en-US/developers/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")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] The hard-coded faction short name "DC" appears as a magic string; consider defining it as a constant for improved maintainability and clarity. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
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()) { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider extracting the dice roll calculation (bondsmanRoll + d6(1)) into a clearly named variable to clarify that it simulates a 2d6 roll, which would improve overall readability.
Copilot uses AI. Check for mistakes.