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

Decoupled Prisoner Capture & Defection from AtB, Updated Mechanics, & Added Supporting Documentation #4413

Merged
merged 7 commits 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
Binary file not shown.
10 changes: 5 additions & 5 deletions MekHQ/resources/mekhq/resources/CampaignOptionsDialog.properties
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,13 @@ prisonerPanel.title=Prisoners
lblPrisonerCaptureStyle.text=Prisoner Capture Style
lblPrisonerCaptureStyle.toolTipText=This is the style of logic to use when determining if a person has been captured by the force following a scenario.
lblPrisonerStatus.text=Default Prisoner Status
lblPrisonerStatus.toolTipText=<html>This is the default prisoner status assigned when a person is captured. <br>Defectors are an unofficial addition as part of the AtB ruleset and are prisoners that willing to defect to your forces.</html>
lblPrisonerStatus.toolTipText=This is the default prisoner status assigned when a person is captured. Defectors are prisoners that are willing to defect to your forces.
chkPrisonerBabyStatus.text=Babies Born to Prisoners Share Mother's Prisoner Status
chkPrisonerBabyStatus.toolTipText=Babies born to prisoners will share their mother's prisoner status. Otherwise, they will instead be added to your force as a baby dependent.
chkAtBPrisonerDefection.text=Enable AtB Prisoner Defection
chkAtBPrisonerDefection.toolTipText=<html>This adds a random roll to determine if a prisoner is willing to defect as per the AtB ruleset. <br>This option will be ignored if Prisoner Defector is selected for the default prisoner status.</html>
chkAtBPrisonerRansom.text=Enable AtB Prisoner Ransom
chkAtBPrisonerRansom.toolTipText=Prisoners can be ransomed back to their previous faction as per the AtB ruleset.
chkAtBPrisonerDefection.text=Random Prisoner Defection
chkAtBPrisonerDefection.toolTipText=<html>This adds a random roll to determine if a prisoner is willing to defect. <br>This option will be ignored if Prisoner Defector is selected for the default prisoner status.</html>
chkAtBPrisonerRansom.text=Enable Prisoner Ransom
chkAtBPrisonerRansom.toolTipText=Prisoners can be ransomed back to their previous faction.

# Fatigue
turnoverAndRetentionFatiguePanel.title=CamOps Fatigue
Expand Down
8 changes: 4 additions & 4 deletions MekHQ/resources/mekhq/resources/Personnel.properties
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,10 @@ Phenotype.GENERAL.toolTipText=Error: this should never be displayed and is used
# PrisonerCaptureStyle Enum
PrisonerCaptureStyle.NONE.text=Disabled
PrisonerCaptureStyle.NONE.toolTipText=Prisoner Capture is disabled
PrisonerCaptureStyle.ATB.text=Against the Bot
PrisonerCaptureStyle.ATB.toolTipText=Determine randomly which enemy personnel were captured and which escaped based on the AtB rules at the end of a battle
PrisonerCaptureStyle.TAHARQA.text=Taharqa
PrisonerCaptureStyle.TAHARQA.toolTipText=All potentially capturable enemy combatants will become prisoners when resolving scenarios.
PrisonerCaptureStyle.ATB.text=Random
PrisonerCaptureStyle.ATB.toolTipText=Determine randomly which enemy personnel were captured and which escaped at the end of a battle
PrisonerCaptureStyle.TAHARQA.text=Automatic
PrisonerCaptureStyle.TAHARQA.toolTipText=All potentially captured enemy combatants will become prisoners when resolving scenarios.

# PrisonerStatus Enum
PrisonerStatus.FREE.text=Free
Expand Down
12 changes: 9 additions & 3 deletions MekHQ/src/mekhq/campaign/ResolveScenarioTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,7 @@ private void processPrisonerCapture(List<TestUnit> unitsToProcess) {
status.setHits(hits);
}
}
status.setPickedUp(pickedUp);
status.setCaptured(Utilities.isLikelyCapture(en) || pickedUp);
status.setXP(campaign.getCampaignOptions().getScenarioXP());
oppositionPersonnel.put(p.getId(), status);
Expand Down Expand Up @@ -1460,11 +1461,16 @@ public void resolveScenario(ScenarioStatus resolution, String report) {
PrisonerStatus prisonerStatus = getCampaign().getCampaignOptions().getDefaultPrisonerStatus();

// Then, we need to determine if they are a defector
if (prisonerStatus.isCurrentPrisoner() && getCampaign().getCampaignOptions().isUseAtBPrisonerDefection()
&& isAtBContract) {
int enemyRating = ((AtBContract) mission).getEnemySkill().ordinal();
if (prisonerStatus.isCurrentPrisoner() && getCampaign().getCampaignOptions().isUseAtBPrisonerDefection()) {
int campaignUnitRating = getCampaign().getUnitRatingAsInteger();

// if this isn't an AtB Contract, we use the individual's experience level, instead of enemy skill
int enemyRating = person.getExperienceLevel(campaign, false);

if (isAtBContract) {
enemyRating = ((AtBContract) mission).getEnemySkill().ordinal();
}

int requiredValue = 8 + enemyRating - campaignUnitRating;

if (getCampaign().getCampaignOptions().isUseLoyaltyModifiers()) {
Expand Down
8 changes: 4 additions & 4 deletions MekHQ/src/mekhq/campaign/personnel/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,15 @@ public class Person {
// initializes the AtB ransom values
static {
MECHWARRIOR_AERO_RANSOM_VALUES = new HashMap<>();
MECHWARRIOR_AERO_RANSOM_VALUES.put(SkillType.EXP_NONE, Money.of(0)); // no official AtB rules for really inexperienced scrubs, but...
MECHWARRIOR_AERO_RANSOM_VALUES.put(SkillType.EXP_NONE, Money.of(2500)); // no official AtB rules for really inexperienced scrubs, but...
MECHWARRIOR_AERO_RANSOM_VALUES.put(SkillType.EXP_ULTRA_GREEN, Money.of(5000)); // no official AtB rules for really inexperienced scrubs, but...
MECHWARRIOR_AERO_RANSOM_VALUES.put(SkillType.EXP_GREEN, Money.of(10000));
MECHWARRIOR_AERO_RANSOM_VALUES.put(SkillType.EXP_REGULAR, Money.of(25000));
MECHWARRIOR_AERO_RANSOM_VALUES.put(SkillType.EXP_VETERAN, Money.of(75000));
MECHWARRIOR_AERO_RANSOM_VALUES.put(SkillType.EXP_ELITE, Money.of(150000));
MECHWARRIOR_AERO_RANSOM_VALUES.put(SkillType.EXP_VETERAN, Money.of(50000));
MECHWARRIOR_AERO_RANSOM_VALUES.put(SkillType.EXP_ELITE, Money.of(100000));

OTHER_RANSOM_VALUES = new HashMap<>();
OTHER_RANSOM_VALUES.put(SkillType.EXP_NONE, Money.of(0));
OTHER_RANSOM_VALUES.put(SkillType.EXP_NONE, Money.of(1250));
OTHER_RANSOM_VALUES.put(SkillType.EXP_ULTRA_GREEN, Money.of(2500));
OTHER_RANSOM_VALUES.put(SkillType.EXP_GREEN, Money.of(5000));
OTHER_RANSOM_VALUES.put(SkillType.EXP_REGULAR, Money.of(10000));
Expand Down
18 changes: 9 additions & 9 deletions MekHQ/src/mekhq/gui/dialog/ResolveScenarioWizardDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ private void initComponents() {
wasCaptured = true;
} else {
for (int n = 0; n < status.getHits() + 1; n++) {
if (Utilities.dice(1, 6) == 1) {
if (Utilities.dice(1, 6) == 6) {
wasCaptured = true;
break;
}
Expand Down Expand Up @@ -1607,7 +1607,7 @@ private void updatePreviewPanel() {
}

sb.append(objectiveProcessor.processObjective(objective, qualifyingUnitCount, override, tracker, true));
sb.append("\n");
sb.append('\n');
}

txtReport.setText(sb.toString());
Expand All @@ -1620,11 +1620,11 @@ private void updatePreviewPanel() {
for (int i = 0; i < pstatuses.size(); i++) {
PersonStatus status = pstatuses.get(i);
if (hitSliders.get(i).getValue() >= 6 || kiaBtns.get(i).isSelected()) {
kiaNames.append(status.getName()).append("\n");
kiaNames.append(status.getName()).append('\n');
} else if (miaBtns.get(i).isSelected()) {
missingNames.append(status.getName()).append("\n");
missingNames.append(status.getName()).append('\n');
} else {
recoverNames.append(status.getName()).append("\n");
recoverNames.append(status.getName()).append('\n');
}
}
txtRecoveredPilots.setText(recoverNames.toString());
Expand All @@ -1637,9 +1637,9 @@ private void updatePreviewPanel() {
for (int i = 0; i < chksTotaled.size(); i++) {
String name = ustatuses.get(i).getName();
if (chksTotaled.get(i).isSelected()) {
missUnits.append(name).append("\n");
missUnits.append(name).append('\n');
} else {
recoverUnits.append(name).append("\n");
recoverUnits.append(name).append('\n');
}
}
txtRecoveredUnits.setText(recoverUnits.toString());
Expand All @@ -1650,7 +1650,7 @@ private void updatePreviewPanel() {
for (int i = 0; i < salvageBoxes.size(); i++) {
JCheckBox box = salvageBoxes.get(i);
if (box.isSelected()) {
salvageUnits.append(salvageables.get(i).getName()).append("\n");
salvageUnits.append(salvageables.get(i).getName()).append('\n');
}
}
txtSalvage.setText(salvageUnits.toString());
Expand All @@ -1660,7 +1660,7 @@ private void updatePreviewPanel() {
for (int i = 0; i < lootBoxes.size(); i++) {
JCheckBox box = lootBoxes.get(i);
if (box.isSelected()) {
claimed.append(loots.get(i).getShortDescription()).append("\n");
claimed.append(loots.get(i).getShortDescription()).append('\n');
}
}
txtRewards.setText(claimed.toString());
Expand Down