diff --git a/MekHQ/data/universe/academies/Local Academies.xml b/MekHQ/data/universe/academies/Local Academies.xml index c0b88c60c4..035bc92d24 100644 --- a/MekHQ/data/universe/academies/Local Academies.xml +++ b/MekHQ/data/universe/academies/Local Academies.xml @@ -12,7 +12,7 @@ Early Childhood 10 General Education - Bonus XP + XP 2300 1 @@ -28,9 +28,9 @@ 10 16 General Education - Bonus XP + XP 2300 - 1 + 0 Preparatory School @@ -45,9 +45,9 @@ 10 16 General Education - Bonus XP, Leadership + XP, Leadership 2300 - 1 + 0 Military School @@ -105,9 +105,9 @@ 16 150 General Education - Bonus XP + XP 2300 - 1 + 0 Technical College @@ -229,7 +229,7 @@ Early Childhood Early Childhood Reeducation & Social Encouragement - Bonus XP + XP 2300 1 diff --git a/MekHQ/resources/mekhq/resources/CampaignOptionsDialog.properties b/MekHQ/resources/mekhq/resources/CampaignOptionsDialog.properties index 43bdef80ae..a03ccc1ba8 100644 --- a/MekHQ/resources/mekhq/resources/CampaignOptionsDialog.properties +++ b/MekHQ/resources/mekhq/resources/CampaignOptionsDialog.properties @@ -553,6 +553,8 @@ chkUseEducationModule.toolTip=Enables the Education Module. lblMaximumJumpCount.text=Maximum Jump Radius lblMaximumJumpCount.toolTip=The maximum distance when searching for academies. +lblCurriculumXpRate.text=Bonus XP Rate +lblCurriculumXpRate.toolTip=Some curriculum award bonus xp (outside monthly random xp). This setting determines how much XP should be gained per education level. chkUseReeducationCamps.text=Enable Reeducation Camp Faction Change chkUseReeducationCamps.toolTip=Should reeducation camps change a students' origin faction to match the campaign faction? chkShowIneligibleAcademies.text=Show Ineligible Academies diff --git a/MekHQ/resources/mekhq/resources/Education.properties b/MekHQ/resources/mekhq/resources/Education.properties index bb2c047e80..d4e0395ba9 100644 --- a/MekHQ/resources/mekhq/resources/Education.properties +++ b/MekHQ/resources/mekhq/resources/Education.properties @@ -1,7 +1,6 @@ #### Tooltip Builder curriculum.text=Curriculum: educationLevel.text=Education Level: -xpBonus.text=d6 nothingToLearn.text=nothing to learn tuition.text=Tuition: duration.text=Duration: @@ -76,7 +75,7 @@ graduatedMasters.text=has completed their Master's Degree. graduatedDoctorate.text=has completed their Doctorate. bonusAdded.text=During their education or training, %s discovered a natural talent! bonusXp.text=%s learned something new (+%s XP) -graduatedChild.text=has graduated from %s. Tomorrow, they will begin their journey back to the unit. +graduatedChild.text=graduated from %s. Tomorrow, they will begin their journey back to the unit. #### Graduation Events (positive) addressEncouragement.text=during which, the commencement address included words of encouragement diff --git a/MekHQ/src/mekhq/campaign/CampaignOptions.java b/MekHQ/src/mekhq/campaign/CampaignOptions.java index d77d821343..13005eadd0 100644 --- a/MekHQ/src/mekhq/campaign/CampaignOptions.java +++ b/MekHQ/src/mekhq/campaign/CampaignOptions.java @@ -384,6 +384,7 @@ public static String getTransitUnitName(final int unit) { // Education private boolean useEducationModule; + private Integer curriculumXpRate; private Integer maximumJumpCount; private boolean useReeducationCamps; private boolean enableLocalAcademies; @@ -894,6 +895,7 @@ public CampaignOptions() { // Education setUseEducationModule(true); + setCurriculumXpRate(3); setMaximumJumpCount(5); setUseReeducationCamps(true); setEnableLocalAcademies(true); @@ -2689,6 +2691,14 @@ public void setUseEducationModule(boolean useEducationModule) { this.useEducationModule = useEducationModule; } + public Integer getCurriculumXpRate() { + return curriculumXpRate; + } + + public void setCurriculumXpRate(final int curriculumXpRate) { + this.curriculumXpRate = curriculumXpRate; + } + public Integer getMaximumJumpCount() { return maximumJumpCount; } @@ -4729,6 +4739,7 @@ public void writeToXml(final PrintWriter pw, int indent) { //region Education MHQXMLUtility.writeSimpleXMLTag(pw, indent, "useEducationModule", isUseEducationModule()); + MHQXMLUtility.writeSimpleXMLTag(pw, indent, "curriculumXpRate", getCurriculumXpRate()); MHQXMLUtility.writeSimpleXMLTag(pw, indent, "maximumJumpCount", getMaximumJumpCount()); MHQXMLUtility.writeSimpleXMLTag(pw, indent, "useReeducationCamps", isUseReeducationCamps()); MHQXMLUtility.writeSimpleXMLTag(pw, indent, "enableLocalAcademies", isEnableLocalAcademies()); @@ -5478,6 +5489,8 @@ public static CampaignOptions generateCampaignOptionsFromXml(Node wn, Version ve //region Education } else if (wn2.getNodeName().equalsIgnoreCase("useEducationModule")) { retVal.setUseEducationModule(Boolean.parseBoolean(wn2.getTextContent().trim())); + } else if (wn2.getNodeName().equalsIgnoreCase("curriculumXpRate")) { + retVal.setCurriculumXpRate(Integer.parseInt(wn2.getTextContent().trim())); } else if (wn2.getNodeName().equalsIgnoreCase("maximumJumpCount")) { retVal.setMaximumJumpCount(Integer.parseInt(wn2.getTextContent().trim())); } else if (wn2.getNodeName().equalsIgnoreCase("useReeducationCamps")) { diff --git a/MekHQ/src/mekhq/campaign/personnel/education/Academy.java b/MekHQ/src/mekhq/campaign/personnel/education/Academy.java index 9e26fb7c91..6f5445399a 100644 --- a/MekHQ/src/mekhq/campaign/personnel/education/Academy.java +++ b/MekHQ/src/mekhq/campaign/personnel/education/Academy.java @@ -872,11 +872,11 @@ public String getTooltip(Campaign campaign, List personnel, int courseIn for (String skill : skills) { tooltip.append(skill).append(" ("); - if (skill.equalsIgnoreCase("xp bonus") || (skill.equalsIgnoreCase("bonus xp"))) { + if (skill.equalsIgnoreCase("xp")) { if (EducationLevel.parseToInt(person.getEduHighestEducation()) >= educationLevel) { tooltip.append(resources.getString("nothingToLearn.text")).append(")
"); } else { - tooltip.append(educationLevel).append(resources.getString("xpBonus.text")).append(")
"); + tooltip.append(educationLevel * campaign.getCampaignOptions().getCurriculumXpRate()).append(")
"); } } else { String skillParsed = skillParser(skill); diff --git a/MekHQ/src/mekhq/campaign/personnel/education/EducationController.java b/MekHQ/src/mekhq/campaign/personnel/education/EducationController.java index 8d925ea03c..43cb6f56b7 100644 --- a/MekHQ/src/mekhq/campaign/personnel/education/EducationController.java +++ b/MekHQ/src/mekhq/campaign/personnel/education/EducationController.java @@ -882,8 +882,8 @@ private static void improveSkills(Campaign campaign, Person person, Academy acad } for (String skill : curriculum) { - if (skill.equalsIgnoreCase("bonus xp")) { - person.awardXP(campaign, Compute.d6(Math.max(1, educationLevel))); + if (skill.equalsIgnoreCase("xp")) { + person.awardXP(campaign, educationLevel * campaign.getCampaignOptions().getCurriculumXpRate()); } else { String skillParsed = Academy.skillParser(skill); int bonus; @@ -940,18 +940,17 @@ private static void addBonus(Campaign campaign, Person person, Academy academy, campaign.addReport(String.format(resources.getString("bonusAdded.text"), person.getFirstName())); } else { - roll = Compute.d6(2); - person.awardXP(campaign, roll); + person.awardXP(campaign, campaign.getCampaignOptions().getCurriculumXpRate()); campaign.addReport(String.format(resources.getString("bonusXp.text"), - person.getFirstName(), roll)); + person.getFirstName(), campaign.getCampaignOptions().getCurriculumXpRate())); } } catch (Exception e) { - // if we get this, it means the 'skill' was Bonus XP - person.awardXP(campaign, Compute.d6(2)); + // if we get this, it means the 'skill' was XP + person.awardXP(campaign, campaign.getCampaignOptions().getCurriculumXpRate()); campaign.addReport(String.format(resources.getString("bonusXp.text"), - person.getFirstName(), roll)); + person.getFirstName(), campaign.getCampaignOptions().getCurriculumXpRate())); } } } diff --git a/MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java b/MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java index cb80e612a3..d0cfb4fb39 100644 --- a/MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java +++ b/MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java @@ -445,6 +445,8 @@ public class CampaignOptionsPane extends AbstractMHQTabbedPane { // Education private JCheckBox chkUseEducationModule; + private JLabel lblCurriculumXpRate; + private JSpinner spnCurriculumXpRate; private JLabel lblMaximumJumpCount; private JSpinner spnMaximumJumpCount; private JCheckBox chkUseReeducationCamps; @@ -6042,6 +6044,14 @@ public Component getListCellRendererComponent(final JList list, final Object private JPanel createEducationPanel() { // General Settings + lblCurriculumXpRate = new JLabel(resources.getString("lblCurriculumXpRate.text")); + lblCurriculumXpRate.setToolTipText(resources.getString("lblCurriculumXpRate.toolTip")); + lblCurriculumXpRate.setName("lblCurriculumXpRate"); + + spnCurriculumXpRate = new JSpinner(new SpinnerNumberModel(3, 1, 10, 1)); + spnCurriculumXpRate.setToolTipText(resources.getString("lblCurriculumXpRate.toolTip")); + spnCurriculumXpRate.setName("spnCurriculumXpRate"); + lblMaximumJumpCount = new JLabel(resources.getString("lblMaximumJumpCount.text")); lblMaximumJumpCount.setToolTipText(resources.getString("lblMaximumJumpCount.toolTip")); lblMaximumJumpCount.setName("lblMaximumJumpCount"); @@ -6088,6 +6098,8 @@ private JPanel createEducationPanel() { chkUseEducationModule.addActionListener(evt -> { final boolean isEnabled = chkUseEducationModule.isSelected(); + lblCurriculumXpRate.setEnabled(isEnabled); + spnCurriculumXpRate.setEnabled(isEnabled); lblMaximumJumpCount.setEnabled(isEnabled); spnMaximumJumpCount.setEnabled(isEnabled); chkUseReeducationCamps.setEnabled(isEnabled); @@ -6123,6 +6135,8 @@ private JPanel createEducationPanel() { // this prevents a really annoying bug where disabled options don't stay disabled when // reloading Campaign Options + lblCurriculumXpRate.setEnabled(campaign.getCampaignOptions().isUseEducationModule()); + spnCurriculumXpRate.setEnabled(campaign.getCampaignOptions().isUseEducationModule()); lblMaximumJumpCount.setEnabled(campaign.getCampaignOptions().isUseEducationModule()); spnMaximumJumpCount.setEnabled(campaign.getCampaignOptions().isUseEducationModule()); chkUseReeducationCamps.setEnabled(campaign.getCampaignOptions().isUseEducationModule()); @@ -6147,6 +6161,9 @@ private JPanel createEducationPanel() { layout.createSequentialGroup() .addComponent(chkUseEducationModule) .addGap(10) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(lblCurriculumXpRate) + .addComponent(spnCurriculumXpRate)) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(lblMaximumJumpCount) .addComponent(spnMaximumJumpCount)) @@ -6163,6 +6180,9 @@ private JPanel createEducationPanel() { layout.createParallelGroup(Alignment.LEADING) .addComponent(chkUseEducationModule) .addGap(10) + .addGroup(layout.createSequentialGroup() + .addComponent(lblCurriculumXpRate) + .addComponent(spnCurriculumXpRate)) .addGroup(layout.createSequentialGroup() .addComponent(lblMaximumJumpCount) .addComponent(spnMaximumJumpCount)) @@ -8212,6 +8232,7 @@ public void setOptions(@Nullable CampaignOptions options, // Education chkUseEducationModule.setSelected(options.isUseEducationModule()); + spnCurriculumXpRate.setValue(options.getCurriculumXpRate()); spnMaximumJumpCount.setValue(options.getMaximumJumpCount()); chkUseReeducationCamps.setSelected(options.isUseReeducationCamps()); chkEnableLocalAcademies.setSelected(options.isEnableLocalAcademies()); @@ -8877,6 +8898,7 @@ public void updateOptions() { // Education options.setUseEducationModule(chkUseEducationModule.isSelected()); + options.setCurriculumXpRate((Integer) spnCurriculumXpRate.getValue()); options.setMaximumJumpCount((Integer) spnMaximumJumpCount.getValue()); options.setUseReeducationCamps(chkUseReeducationCamps.isSelected()); options.setEnableLocalAcademies(chkEnableLocalAcademies.isSelected());