Search in sources :

Example 6 with PCAlignment

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

the class BuildUtilities method createAlignment.

public static PCAlignment createAlignment(final String longName, final String shortName) {
    final PCAlignment align = new PCAlignment();
    align.setName(longName);
    align.setKeyName(shortName);
    return align;
}
Also used : PCAlignment(pcgen.core.PCAlignment)

Example 7 with PCAlignment

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

the class PreAlignTester method toHtmlString.

/**
	 * @see pcgen.core.prereq.PrerequisiteTest#toHtmlString(pcgen.core.prereq.Prerequisite)
	 */
@Override
public String toHtmlString(final Prerequisite prereq) {
    String alignment = prereq.getKey();
    PCAlignment al = getPCAlignment(alignment);
    return LanguageBundle.getFormattedString("PreAlign.toHtml", prereq.getOperator().toDisplayString(), //$NON-NLS-1$
    al.getKeyName());
}
Also used : PCAlignment(pcgen.core.PCAlignment)

Example 8 with PCAlignment

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

the class PreDeityAlignTester method passes.

/**
	 * @see pcgen.core.prereq.PrerequisiteTest#passes(pcgen.core.PlayerCharacter)
	 */
@Override
public int passes(final Prerequisite prereq, final CharacterDisplay display, CDOMObject source) {
    //
    // If game mode doesn't support alignment, then pass the prereq
    //
    int runningTotal = 0;
    if (Globals.getGameModeAlignmentText().isEmpty()) {
        runningTotal = 1;
    } else {
        //$NON-NLS-1$
        CDOMSingleRef<PCAlignment> deityAlign = null;
        Deity deity = display.getDeity();
        if (deity != null) {
            deityAlign = deity.get(ObjectKey.ALIGNMENT);
        }
        if (deityAlign != null) {
            String desiredAlignIdentifier = prereq.getOperand();
            PCAlignment desiredAlign = getPCAlignment(desiredAlignIdentifier);
            if (desiredAlign.equals(deityAlign.get())) {
                runningTotal = 1;
            }
        }
    }
    return countedTotal(prereq, runningTotal);
}
Also used : Deity(pcgen.core.Deity) PCAlignment(pcgen.core.PCAlignment)

Example 9 with PCAlignment

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

the class AlignmentFacetTest method getItem.

@Override
protected PCAlignment getItem() {
    PCAlignment a = new PCAlignment();
    a.setName("Align" + n++);
    return a;
}
Also used : PCAlignment(pcgen.core.PCAlignment)

Example 10 with PCAlignment

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

the class AlignToken method parseTokenWithSeparator.

@Override
protected ParseResult parseTokenWithSeparator(LoadContext context, KitAlignment kitAlignment, String value) {
    StringTokenizer tok = new StringTokenizer(value, Constants.PIPE);
    while (tok.hasMoreTokens()) {
        String tokText = tok.nextToken();
        CDOMSingleRef<PCAlignment> ref = context.getReferenceContext().getCDOMReference(ALIGNMENT_CLASS, tokText);
        kitAlignment.addAlignment(ref);
    }
    return ParseResult.SUCCESS;
}
Also used : StringTokenizer(java.util.StringTokenizer) PCAlignment(pcgen.core.PCAlignment)

Aggregations

PCAlignment (pcgen.core.PCAlignment)19 Before (org.junit.Before)3 Deity (pcgen.core.Deity)3 ArrayList (java.util.ArrayList)2 StringTokenizer (java.util.StringTokenizer)2 CDOMReference (pcgen.cdom.base.CDOMReference)2 PCClass (pcgen.core.PCClass)2 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 Test (org.junit.Test)1 Indirect (pcgen.base.util.Indirect)1 WeightedCollection (pcgen.base.util.WeightedCollection)1 FactKey (pcgen.cdom.enumeration.FactKey)1 FactSetKey (pcgen.cdom.enumeration.FactSetKey)1 Gender (pcgen.cdom.enumeration.Gender)1 Ability (pcgen.core.Ability)1 Description (pcgen.core.Description)1 Domain (pcgen.core.Domain)1 Race (pcgen.core.Race)1 WeaponProf (pcgen.core.WeaponProf)1