-
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
Updated MekHQ Morale & StratCon Scenario Spawn Methods #5243
Merged
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
Added the calculation of planetary diameter to the initialization of StratconTrackState. This allows the track size to be set proportionally based on the planet's surface area, ensuring more realistic and varied gameplay environments.
Added null checks throughout Stratcon scenario generation methods to handle potential null scenarios. Created new methods and updated existing ones to ensure robust error handling and to return null if scenario creation fails.
Implemented a `getSize` method to calculate the track size based on width and height. This change enhances the functionality by providing a straightforward way to retrieve the total size of the track. Additionally, minor formatting adjustments were made for code consistency.
Added logic to seed sectors with hidden forces based on contract type in StratconContractInitializer. Differentiated scenario creation between garrison, raid, pirate hunting, and planetary assault contracts.
Modified contract generation to prevent full-scale invasions for pirate hunting contracts. Adjusted multiplier settings to treat guerrilla warfare similarly to raid types. These changes enhance the accuracy and realism of mission deployment scenarios.
Removed redundant scenario generation checks and refactored pre-deployment probability calculations. Simplified conditionals in StratconRulesManager, and integrated scenario odds computation into StratconContractInitializer. This enhances code clarity and consistency in scenario management.
Modified scenario generation to include an option for allowing scenarios to spawn on top of player-allied facilities. Updated function signatures and added logic to accommodate this new parameter, ensuring that scenarios can now be placed more flexibly based on provided configurations.
Refactored the calculation of scenario odds for better readability and maintainability. Also added a new method to handle daily movement processing for scenarios in each track. Expanded pre-deployment logic and cleaned up code to enhance functionality.
Updated the copyright years to 2024 and revised the license information for consistency and accuracy. This ensures the codebase reflects the correct legal information and adheres to the project's licensing guidelines.
Changed the visibility of the seedPreDeployedForces method to private and added a detailed Javadoc comment explaining its functionality. Removed redundant comments from the initializeTrackState method to improve code readability.
Made `seedPreDeployedForces` method public to allow seeding of pre-deployed forces in StratCon tracks. Also added logic to handle pre-deployment for garrison and pirate hunting contract types.
PreSeeded enemy force count is now based on enemy quality and faction.
Introduced a new method, `processMassRout`, in `StratconRulesManager` to handle scenarios without deployment dates. Integrated this method into `AtBContract` to ensure these scenarios are removed and updated appropriately.
Ensured that mass rout processing in AtBContract only occurs when StratCon is enabled in campaign options. This change prevents unnecessary operations and aligns with the intended functionality of user-defined campaign options.
Updated isOffensive method to include planetary assaults, modified processMassRout to streamline parameters, and adjusted seeding logic with revised multipliers. This enhances the clarity and efficiency of the StratCon campaign state management and scenario processing.
Modified `getUnoccupiedAdjacentCoords` method to include an optional boolean parameter `weightPlayerForces` which prioritizes player-allied forces and facilities when determining suitable adjacent coordinates. Updated `StratconRulesManager` to leverage this new parameter for enhanced scenario deployment logic.
Updated the condition to exclude strategic objectives when checking for null deployment dates in scenarios. This ensures that only relevant scenarios get new coordinates, preventing strategic objectives from being relocated erroneously.
Improved the morale calculation and routing logic when handling contracts, especially garrison duties. Updated methods to factor in enemy skill, weapon reliability, and included a more sophisticated approach to determining balance of power. Minor refactoring was also done for code clarity and efficiency.
# Conflicts: # MekHQ/resources/mekhq/resources/Campaign.properties
Adjusted performance modifier calculation to include tightened conditions for victory and defeat ratios. Modified the decrease and increase values to better reflect performance variability.
Updated the morale initialization logic to differentiate between garrison and relief duty contracts. Utilized the 'min' function to adjust morale levels more accurately and corrected a typo in the contract type check.
IllianiCBT
added
StratCon
Bugs relating strictly to StratCon
Refactoring
Documentation
labels
Nov 24, 2024
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5243 +/- ##
============================================
- Coverage 10.50% 10.50% -0.01%
- Complexity 6039 6044 +5
============================================
Files 957 957
Lines 134609 134716 +107
Branches 19535 19572 +37
============================================
+ Hits 14147 14149 +2
- Misses 119106 119216 +110
+ Partials 1356 1351 -5 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
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 includes the non-persistent OpFor changes, from my earlier (now scrapped) PR.
This includes an update to MekHQ Morale to make it feel less random and more reflective of the actual game state. Documentation has been updated accordingly.
Contracts will no longer universally begin with
Stalemate
morale. Instead we will make a preliminary morale check, which may cause contracts to begin with their morale adjusted by up to 2 steps up, or down. Though most contracts will likely still begin atStalemate
.Garrison contracts will begin at
Routed
with a certain number of months' peace guaranteed. This means it is no longer possible to know for certain who you will be facing when accepting a garrison contract - or if you will be fighting at all. A warning dialog appears when accepting a Garrison contract, allowing users to cancel out of accepting the contract if they don't want to take this risk.Relief Duty contracts are more likely to have contracts start with higher than normal morale levels, potentially starting with the enemy already at
Overwhelming
.On the backend side, the new methods that allow us to easily add new scenarios to StratCon tracks have been expanded and updated to be more reliable and feature complete.