Search in sources :

Example 21 with PrerequisiteOperator

use of pcgen.core.prereq.PrerequisiteOperator in project pcgen by PCGen.

the class PreEquipSecondaryWriter method specialCase.

@Override
public boolean specialCase(Writer writer, Prerequisite prereq) throws IOException {
    PrerequisiteOperator po = getConsolidateMethod(kindHandled(), prereq, false);
    if (po == null) {
        return false;
    }
    if (!po.equals(prereq.getOperator())) {
        writer.write('!');
    }
    writer.write("PRE" + kindHandled().toUpperCase() + ':' + (prereq.isOverrideQualify() ? "Q:" : ""));
    writer.write(po.equals(PrerequisiteOperator.GTEQ) ? prereq.getOperand() : "1");
    for (Prerequisite p : prereq.getPrerequisites()) {
        writer.write(',');
        writer.write(p.getKey());
    }
    return true;
}
Also used : PrerequisiteOperator(pcgen.core.prereq.PrerequisiteOperator) Prerequisite(pcgen.core.prereq.Prerequisite)

Example 22 with PrerequisiteOperator

use of pcgen.core.prereq.PrerequisiteOperator in project pcgen by PCGen.

the class PreEquipTwoWeaponWriter method specialCase.

@Override
public boolean specialCase(Writer writer, Prerequisite prereq) throws IOException {
    PrerequisiteOperator po = getConsolidateMethod(kindHandled(), prereq, false);
    if (po == null) {
        return false;
    }
    if (!po.equals(prereq.getOperator())) {
        writer.write('!');
    }
    writer.write("PRE" + kindHandled().toUpperCase() + ':' + (prereq.isOverrideQualify() ? "Q:" : ""));
    writer.write(po.equals(PrerequisiteOperator.GTEQ) ? prereq.getOperand() : "1");
    for (Prerequisite p : prereq.getPrerequisites()) {
        writer.write(',');
        writer.write(p.getKey());
    }
    return true;
}
Also used : PrerequisiteOperator(pcgen.core.prereq.PrerequisiteOperator) Prerequisite(pcgen.core.prereq.Prerequisite)

Example 23 with PrerequisiteOperator

use of pcgen.core.prereq.PrerequisiteOperator in project pcgen by PCGen.

the class PreCharactertypeWriter method specialCase.

@Override
public boolean specialCase(Writer writer, Prerequisite prereq) throws IOException {
    PrerequisiteOperator po = getConsolidateMethod(kindHandled(), prereq, false);
    if (po == null) {
        return false;
    }
    if (!po.equals(prereq.getOperator())) {
        writer.write('!');
    }
    writer.write("PRE" + kindHandled().toUpperCase() + ':' + (prereq.isOverrideQualify() ? "Q:" : ""));
    writer.write(po.equals(PrerequisiteOperator.GTEQ) ? prereq.getOperand() : "1");
    for (Prerequisite p : prereq.getPrerequisites()) {
        writer.write(',');
        writer.write(p.getKey());
    }
    return true;
}
Also used : PrerequisiteOperator(pcgen.core.prereq.PrerequisiteOperator) Prerequisite(pcgen.core.prereq.Prerequisite)

Example 24 with PrerequisiteOperator

use of pcgen.core.prereq.PrerequisiteOperator in project pcgen by PCGen.

the class PreCheckBaseWriter method specialCase.

@Override
public boolean specialCase(Writer writer, Prerequisite prereq) throws IOException {
    PrerequisiteOperator po = getConsolidateMethod(kindHandled(), prereq, true);
    if (po == null) {
        return false;
    }
    if (!po.equals(prereq.getOperator())) {
        writer.write('!');
    }
    writer.write("PRE" + kindHandled().toUpperCase() + ':' + (prereq.isOverrideQualify() ? "Q:" : ""));
    writer.write(po.equals(PrerequisiteOperator.GTEQ) ? prereq.getOperand() : "1");
    for (Prerequisite p : prereq.getPrerequisites()) {
        writer.write(',');
        writer.write(p.getKey());
        writer.write('=');
        writer.write(p.getOperand());
    }
    return true;
}
Also used : PrerequisiteOperator(pcgen.core.prereq.PrerequisiteOperator) Prerequisite(pcgen.core.prereq.Prerequisite)

Example 25 with PrerequisiteOperator

use of pcgen.core.prereq.PrerequisiteOperator in project pcgen by PCGen.

the class PreFactSetWriter method specialCase.

@Override
public boolean specialCase(Writer writer, Prerequisite prereq) throws IOException {
    PrerequisiteOperator po = getConsolidateMethod(kindHandled(), prereq, false);
    if (po == null) {
        return false;
    }
    String cat = null;
    boolean foundCat = false;
    for (Prerequisite p : prereq.getPrerequisites()) {
        if (foundCat) {
            String thiscat = p.getCategoryName();
            if (thiscat == null) {
                if (cat != null) {
                    return false;
                }
            } else {
                if (!thiscat.equals(cat)) {
                    return false;
                }
            }
        } else {
            cat = p.getCategoryName();
            foundCat = true;
        }
    }
    if (!po.equals(prereq.getOperator())) {
        writer.write('!');
    }
    writer.write("PRE" + kindHandled().toUpperCase() + ':' + (prereq.isOverrideQualify() ? "Q:" : ""));
    writer.write(po.equals(PrerequisiteOperator.GTEQ) ? prereq.getOperand() : "1");
    writer.write(',' + cat);
    for (Prerequisite p : prereq.getPrerequisites()) {
        writer.write(',');
        writer.write(p.getKey());
    }
    return true;
}
Also used : PrerequisiteOperator(pcgen.core.prereq.PrerequisiteOperator) Prerequisite(pcgen.core.prereq.Prerequisite)

Aggregations

PrerequisiteOperator (pcgen.core.prereq.PrerequisiteOperator)52 Prerequisite (pcgen.core.prereq.Prerequisite)50 PersistenceLayerException (pcgen.persistence.PersistenceLayerException)2 IOException (java.io.IOException)1