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;
}
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());
}
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);
}
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;
}
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;
}
Aggregations