|
48 | 48 | import mekhq.campaign.personnel.generator.DefaultSpecialAbilityGenerator; |
49 | 49 | import mekhq.campaign.personnel.skills.RandomSkillPreferences; |
50 | 50 | import mekhq.campaign.personnel.skills.Skill; |
| 51 | +import mekhq.campaign.personnel.skills.SkillType; |
51 | 52 |
|
52 | 53 | /** |
53 | 54 | * Utility class that provides methods for managing and modifying the skills, loyalty, and advantages of personnel in |
@@ -202,16 +203,19 @@ private static void randomizeSkills(Person person, List<String> skills) { |
202 | 203 | * Otherwise, the skill is added with the specified experience level.</p> |
203 | 204 | * |
204 | 205 | * @param person the {@link Person} to whom the skill is being added. |
205 | | - * @param skill the name of the skill to add. |
| 206 | + * @param skillName the name of the skill to add. |
206 | 207 | * @param skillLevel the {@link SkillLevel} used to set the skill's experience level. |
207 | 208 | */ |
208 | | - private static void addSkillFixedExperienceLevel(Person person, String skill, SkillLevel skillLevel) { |
209 | | - int bonus = 0; |
| 209 | + private static void addSkillFixedExperienceLevel(Person person, String skillName, SkillLevel skillLevel) { |
| 210 | + SkillType skillType = SkillType.getType(skillName); |
| 211 | + int targetLevel = skillType.getLevelFromExperience(skillLevel.getAdjustedValue()); |
210 | 212 |
|
211 | | - if (person.hasSkill(skill)) { |
212 | | - bonus = person.getSkill(skill).getBonus(); |
| 213 | + int bonus = 0; |
| 214 | + Skill skill = person.getSkill(skillName); |
| 215 | + if (skill != null) { |
| 216 | + bonus = skill.getBonus(); |
213 | 217 | } |
214 | 218 |
|
215 | | - addSkill(person, skill, skillLevel.getAdjustedValue(), bonus); |
| 219 | + addSkill(person, skillName, targetLevel, bonus); |
216 | 220 | } |
217 | 221 | } |
0 commit comments