Skip to content

Commit

Permalink
Merge pull request #3116 from Windchild292/dev_Windchild_LegendarySki…
Browse files Browse the repository at this point in the history
…llLevel

Adding the Legendary SkillLevel
  • Loading branch information
Windchild292 authored Feb 19, 2022
2 parents cd44e0d + 9abc4ea commit 119931a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import megamek.common.*;
import megamek.common.enums.SkillLevel;
import megamek.common.options.OptionsConstants;
import mekhq.Utilities;
import mekhq.campaign.Campaign;
import mekhq.campaign.force.Force;
import mekhq.campaign.mission.*;
Expand Down Expand Up @@ -172,9 +173,9 @@ public static void expendAmmo(AtBDynamicScenario scenario, Campaign campaign,
public static void adjustSkill(AtBDynamicScenario scenario, Campaign campaign,
ForceAlignment eventRecipient, int skillAdjustment) {
// We want a non-none Skill Level
final SkillLevel adjustedSkill = SkillLevel.values()[Math.min(SkillLevel.HEROIC.ordinal(),
Math.max(SkillLevel.ULTRA_GREEN.ordinal(), scenario.getEffectiveOpforSkill().ordinal() + skillAdjustment))];

final SkillLevel adjustedSkill = SkillLevel.values()[Utilities.clamp(
scenario.getEffectiveOpforSkill().ordinal() + skillAdjustment,
SkillLevel.ULTRA_GREEN.ordinal(), SkillLevel.LEGENDARY.ordinal())];
// fire up a skill generator set to the appropriate skill model
final AbstractSkillGenerator abstractSkillGenerator = new TaharqaSkillGenerator();
abstractSkillGenerator.setLevel(adjustedSkill);
Expand Down

0 comments on commit 119931a

Please sign in to comment.