Search in sources :

Example 1 with ClassType

use of pcgen.core.ClassType in project pcgen by PCGen.

the class ChallengeRatingFacet method getClassCRModPriority.

private int getClassCRModPriority(PCClass cl) {
    int crModPriority = 0;
    ClassType aClassType = SettingsHandler.getGame().getClassTypeByName(cl.getClassType());
    if (aClassType != null) {
        int crmp = aClassType.getCRModPriority();
        if (crmp != 0) {
            crModPriority = crmp;
        }
    } else {
        // use old method to determine the class type from TYPE. 
        for (Type type : cl.getTrueTypeList(false)) {
            aClassType = SettingsHandler.getGame().getClassTypeByName(type.toString());
            if (aClassType != null) {
                int crmp = aClassType.getCRModPriority();
                if (crmp != 0) {
                    crModPriority = aClassType.getCRModPriority();
                }
            }
        }
    }
    return crModPriority;
}
Also used : Type(pcgen.cdom.enumeration.Type) ClassType(pcgen.core.ClassType) ClassType(pcgen.core.ClassType)

Example 2 with ClassType

use of pcgen.core.ClassType in project pcgen by PCGen.

the class ChallengeRatingFacet method getClassCRMod.

private int getClassCRMod(CharID id, PCClass cl) {
    int crMod = 0;
    ClassType aClassType = SettingsHandler.getGame().getClassTypeByName(cl.getClassType());
    if (aClassType != null) {
        String crmf = aClassType.getCRMod();
        Formula crm = FormulaFactory.getFormulaFor(crmf);
        crMod = Math.min(crMod, formulaResolvingFacet.resolve(id, crm, cl.getQualifiedKey()).intValue());
    } else {
        // use old method to determine the class type from TYPE. 
        for (Type type : cl.getTrueTypeList(false)) {
            aClassType = SettingsHandler.getGame().getClassTypeByName(type.toString());
            if (aClassType != null) {
                String crmf = aClassType.getCRMod();
                Formula crm = FormulaFactory.getFormulaFor(crmf);
                crMod = Math.min(crMod, formulaResolvingFacet.resolve(id, crm, cl.getQualifiedKey()).intValue());
            }
        }
    }
    return crMod;
}
Also used : Formula(pcgen.base.formula.Formula) Type(pcgen.cdom.enumeration.Type) ClassType(pcgen.core.ClassType) ClassType(pcgen.core.ClassType)

Aggregations

Type (pcgen.cdom.enumeration.Type)2 ClassType (pcgen.core.ClassType)2 Formula (pcgen.base.formula.Formula)1