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

Refactored Difficulty Multiplier Calculation #4722

Merged
merged 3 commits into from
Sep 13, 2024
Merged
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
27 changes: 14 additions & 13 deletions MekHQ/src/mekhq/campaign/mission/AtBDynamicScenarioFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -2514,20 +2514,21 @@ public static int calculateEffectiveUnitCount(AtBDynamicScenario scenario, Campa
}

/**
* Helper function that calculates the BV budget multiplier based on AtB skill
* level
* Calculates the difficulty multiplier based on campaign options.
*
* @param c
* @return
*/
private static double getDifficultyMultiplier(Campaign c) {
// skill level is between Ultra-Green (0) and Legendary (6), with Elite being
// the highest
// primary skill level.
// We want a number between 0.8 and 1.2 for the primary skill levels, so the
// formula is:
// 1 + ((skill level - 2) / 10)
return 1.0 + ((c.getCampaignOptions().getSkillLevel().getAdjustedValue() - 2) * 0.1);
* @param campaign the campaign for which to calculate the difficulty multiplier
* @return the difficulty multiplier
*/
private static double getDifficultyMultiplier(Campaign campaign) {
return switch (campaign.getCampaignOptions().getSkillLevel()) {
case NONE, ULTRA_GREEN -> 0.5;
case GREEN -> 0.75;
case REGULAR -> 1.0;
case VETERAN -> 1.25;
case ELITE -> 1.5;
case HEROIC -> 1.75;
case LEGENDARY -> 2.0;
};
}

/**
Expand Down