Search in sources :

Example 1 with AddFilterConverter

use of pcgen.cdom.converter.AddFilterConverter in project pcgen by PCGen.

the class SpellLevelInfo method getLevels.

public Collection<SpellLevel> getLevels(PlayerCharacter pc) {
    List<SpellLevel> list = new ArrayList<>();
    Converter<PCClass, PCClass> conv = new AddFilterConverter<>(new DereferencingConverter<>(pc), this);
    for (PCClass cl : filter.getCollection(pc, conv)) {
        int min = minimumLevel.resolve(pc, cl.getQualifiedKey()).intValue();
        int max = maximumLevel.resolve(pc, cl.getQualifiedKey()).intValue();
        if (min > max) {
            Logging.errorPrint("Resolved Minimum: " + min + " (from " + minimumLevel + ") was greater than resolved Maximum: " + max + " (from " + maximumLevel + ")");
        }
        for (int i = min; i <= max; ++i) {
            list.add(new SpellLevel(cl, i));
        }
    }
    return list;
}
Also used : AddFilterConverter(pcgen.cdom.converter.AddFilterConverter) ArrayList(java.util.ArrayList) PCClass(pcgen.core.PCClass)

Aggregations

ArrayList (java.util.ArrayList)1 AddFilterConverter (pcgen.cdom.converter.AddFilterConverter)1 PCClass (pcgen.core.PCClass)1