Search in sources :

Example 1 with SkillArmorCheck

use of pcgen.cdom.enumeration.SkillArmorCheck in project pcgen by PCGen.

the class AcheckToken method parseNonEmptyToken.

@Override
protected ParseResult parseNonEmptyToken(LoadContext context, Skill skill, String value) {
    SkillArmorCheck aCheck;
    try {
        aCheck = SkillArmorCheck.valueOf(value);
    } catch (IllegalArgumentException iae) {
        /*
			 * TODO516 turn on deprecation
			 */
        // Logging.deprecationPrint("Misunderstood " + getTokenName() + ": "
        // + value + " is not an abbreviation");
        char first = value.charAt(0);
        if (first == 'N') {
            // Logging.deprecationPrint(" please use NONE");
            aCheck = SkillArmorCheck.NONE;
        } else if (first == 'Y') {
            // Logging.deprecationPrint(" please use YES");
            aCheck = SkillArmorCheck.YES;
        } else if (first == 'P') {
            // Logging.deprecationPrint(" please use NONPROF");
            aCheck = SkillArmorCheck.NONPROF;
        } else if (first == 'D') {
            // Logging.deprecationPrint(" please use DOUBLE");
            aCheck = SkillArmorCheck.DOUBLE;
        } else if (first == 'W') {
            // Logging.deprecationPrint(" please use WEIGHT");
            aCheck = SkillArmorCheck.WEIGHT;
        } else {
            return new ParseResult.Fail("Skill " + getTokenName() + " Did not understand: " + value, context);
        }
    }
    context.getObjectContext().put(skill, ObjectKey.ARMOR_CHECK, aCheck);
    return ParseResult.SUCCESS;
}
Also used : ParseResult(pcgen.rules.persistence.token.ParseResult) SkillArmorCheck(pcgen.cdom.enumeration.SkillArmorCheck)

Aggregations

SkillArmorCheck (pcgen.cdom.enumeration.SkillArmorCheck)1 ParseResult (pcgen.rules.persistence.token.ParseResult)1