-
Notifications
You must be signed in to change notification settings - Fork 176
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
Added Ability to Manually Drop Personnel out of Active Education #4366
Merged
IllianiCBT
merged 13 commits into
MegaMek:master
from
IllianiCBT:education_manualDropOut
Jul 12, 2024
Merged
Added Ability to Manually Drop Personnel out of Active Education #4366
IllianiCBT
merged 13 commits into
MegaMek:master
from
IllianiCBT:education_manualDropOut
Jul 12, 2024
Conversation
This file contains 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
The education checks in EducationController.java were refactored for improved readability and maintainability. The code was broken down into individual methods each handling a specific type of check: weekly, monthly, and yearly.
The text for the "barely graduated" education status in the Education.properties file was updated. The revised version provides a more specific phrase that includes the name of the institution from which the individual has barely graduated.
Refactored the EducationController class, specifically the methods which generate prefixes, suffixes, and types. Switch-case statements were refactored for quick assignment of strings. Removed code that checked for the start of a new month to allocate training XP, which is no longer required. Improvements were also made to add bonus XP. The "graduatedBarely" and "graduatedChild" conditions were streamlined, thus removing duplicated code. Finally, removed the redundant use of Collectors.toList().
The code now checks if the person's highest education level is less than the academy's education level before awarding bonus XP. This prevents a potential exploit in XP distribution.
The method 'checkForAcademyClosure' in EducationController was refactored. The return type was changed from boolean to void as the returned boolean value was not used elsewhere in the code.
The random XP option in the campaign was replaced with a more flexible bonus XP multiplier. Furthermore, all references to the old system were removed from the UI and the underlying codebase.
The calculation for xpRate in the addBonusXp method of EducationController was updated. The formula was adjusted to factor in the faculty skill level and operate over a different range by dividing the time spent in education by 600, rather than 150.
The variable "bonusXpRate" used in different places in CampaignOptions class was renamed to "facultyXpRate". Accompanying changes were made in labels, Spinner and other related methods and comments as well to maintain consistency. This refactoring was made to provide more clarity in identifying the purpose of the variable.
The method 'addBonusXp' was renamed to 'addFacultyXp' to more accurately reflect its functionality. The related variable and calculations were updated accordingly. Moreover, a base XP rate is now also awarded when the person's highest education level is equal or greater than the academy's education level.
In the EducationController class, a line of code has been added for granting faculty XP when a person drops out of education.
Added options to handle student dropouts within the educational module of the MekHQ application. This includes an added tooltip and text message within the GUI properties file, and the functionality to process student dropout scenarios within the PersonnelTableMouseAdapter.java.
A new method, processForcedDropOut, was introduced in the EducationController class. This allows users to manually drop personnel out of educations for whatever reason.
Corrected the mistaken usage of CMD_COMPLETE_STAGE with the correct CMD_DROP_OUT as action command for dropping out students.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4366 +/- ##
============================================
- Coverage 10.27% 10.26% -0.01%
+ Complexity 5810 5808 -2
============================================
Files 925 925
Lines 125997 125989 -8
Branches 18646 18639 -7
============================================
- Hits 12941 12938 -3
+ Misses 111781 111776 -5
Partials 1275 1275 ☔ View full report in Codecov by Sentry. |
HammerGS
approved these changes
Jul 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR builds on changes made in #4365 and should be merged after that PR.
This PR adds the ability to manually drop personnel out of their current education. It does this via the right-click personnel menu. It also does some minor refactoring to
PersonnelTableMouseAdapter.java
.With #4365, this PR closes #4359