Skip to content

Commit

Permalink
Merge pull request #6046 from IllianiCBT/opFor_skills
Browse files Browse the repository at this point in the history
Deleted `StratConSkillGenerator.java`
  • Loading branch information
HammerGS authored Oct 2, 2024
2 parents 44a0297 + c386a0e commit c7f66e8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 67 deletions.

This file was deleted.

29 changes: 26 additions & 3 deletions megamek/src/megamek/common/enums/SkillLevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
*/
package megamek.common.enums;

import megamek.MegaMek;
import megamek.logging.MMLogger;

import java.util.List;
import java.util.ResourceBundle;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import megamek.MegaMek;
import megamek.logging.MMLogger;

public enum SkillLevel {
// region Enum Declarations
NONE("SkillLevel.NONE.text", "SkillLevel.NONE.toolTipText"),
Expand Down Expand Up @@ -190,6 +190,29 @@ public static SkillLevel parseFromString(final String text) {

return REGULAR;
}

/**
* Parses an integer value to a {@link SkillLevel} enumeration.
*
* @param value the integer value to parse
* @return the {@link SkillLevel} enum corresponding to the given integer value
* @throws IllegalStateException if the integer value does not match any {@link SkillLevel} enum
* value
*/
public static SkillLevel parseFromInteger(final int value) {
return switch (value) {
case 0 -> NONE;
case 1 -> ULTRA_GREEN;
case 2 -> GREEN;
case 3 -> REGULAR;
case 4 -> VETERAN;
case 5 -> ELITE;
case 6 -> HEROIC;
case 7 -> LEGENDARY;
default -> throw new IllegalStateException(
"Unexpected value in megamek/common/enums/SkillLevel.java: " + value);
};
}
// endregion File I/O

@Override
Expand Down

0 comments on commit c7f66e8

Please sign in to comment.