use of pcgen.cdom.helper.ClassSource in project pcgen by PCGen.
the class DomainCSkillTest method testDirect.
@Test
public void testDirect() throws PersistenceLayerException {
Domain source = create(Domain.class, "Source");
ParseResult result = token.parseToken(context, source, "MySkill");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
finishLoad();
assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(sk, dragon));
domainInputFacet.add(id, source, new ClassSource(dragon, 0));
assertTrue(lscFacet.contains(id, dragon, SkillCost.CLASS, sk));
pc.addClass(dragon);
pc.setDirty(true);
assertEquals(SkillCost.CLASS, pc.getSkillCostForClass(sk, dragon));
domainInputFacet.remove(id, source);
assertFalse(lscFacet.contains(id, dragon, SkillCost.CLASS, sk));
}
use of pcgen.cdom.helper.ClassSource in project pcgen by PCGen.
the class PreDomainTest method testMultiple.
/**
* Test with multiple options
* @throws Exception
*/
public void testMultiple() throws Exception {
final PlayerCharacter character = getCharacter();
PCClass cl = new PCClass();
character.setDefaultDomainSource(new ClassSource(cl, 1));
Prerequisite prereq;
final PreParserFactory factory = PreParserFactory.getInstance();
prereq = factory.parse("PREDOMAIN:1,Good,Law");
assertFalse("Character has no deity selected", PrereqHandler.passes(prereq, character, null));
character.setAlignment(ng);
character.setDeity(deity);
assertFalse("Character's deity has Good domain", PrereqHandler.passes(prereq, character, null));
character.addDomain(Globals.getContext().getReferenceContext().silentlyGetConstructedCDOMObject(Domain.class, "Good"));
assertTrue("Character has Good domain", PrereqHandler.passes(prereq, character, null));
prereq = factory.parse("PREDOMAIN:2,Good,Law");
assertFalse("Character doesn't have Law domain", PrereqHandler.passes(prereq, character, null));
prereq = factory.parse("PREDOMAIN:2,Good,Animal");
character.addDomain(Globals.getContext().getReferenceContext().silentlyGetConstructedCDOMObject(Domain.class, "Animal"));
assertTrue("Character's deity has Good and animal domains", PrereqHandler.passes(prereq, character, null));
}
use of pcgen.cdom.helper.ClassSource in project pcgen by PCGen.
the class PreDomainTest method testDeity.
/**
* Test to make sure it is not looking at deity domains
* @throws Exception
*/
public void testDeity() throws Exception {
final PlayerCharacter character = getCharacter();
PCClass cl = new PCClass();
character.setDefaultDomainSource(new ClassSource(cl, 1));
Prerequisite prereq;
final PreParserFactory factory = PreParserFactory.getInstance();
prereq = factory.parse("PREDOMAIN:1,Good");
assertFalse("Character has no deity selected", PrereqHandler.passes(prereq, character, null));
character.setAlignment(ng);
character.setDeity(deity);
assertFalse("Character's deity has Good domain", PrereqHandler.passes(prereq, character, null));
character.addDomain(Globals.getContext().getReferenceContext().silentlyGetConstructedCDOMObject(Domain.class, "Good"));
assertTrue("Character has Good domain", PrereqHandler.passes(prereq, character, null));
}
use of pcgen.cdom.helper.ClassSource in project pcgen by PCGen.
the class DomainFacetTest method developSource.
@Override
protected ClassSource developSource() {
PCClass cl = new PCClass();
cl.setName("Class" + n++);
return new ClassSource(cl);
}
use of pcgen.cdom.helper.ClassSource in project pcgen by PCGen.
the class DomainTargetSaveRestoreTest method applyObject.
@Override
protected void applyObject(Domain obj) {
PCClass cl = context.getReferenceContext().silentlyGetConstructedCDOMObject(PCClass.class, "MyClass");
pc.addClass(cl);
pc.incrementClassLevel(1, cl);
pc.setHP(pc.getActiveClassLevel(cl, 0), 4);
pc.addDomain(obj, new ClassSource(cl, 1));
}
Aggregations