use of pcgen.cdom.inst.PCClassLevel in project pcgen by PCGen.
the class ClassFacetTest method testCopyContents.
@Test
public void testCopyContents() {
PCClass cl = new PCClass();
PCClassLevel ocl = cl.getOriginalClassLevel(2);
ocl.put(IntegerKey.HIT_DIE, 4);
facet.addClass(id, cl);
facet.setLevel(id, cl, 3);
facet.copyContents(id, altid);
PCClassLevel pcl = facet.getClassLevel(altid, cl, 2);
assertEquals(Integer.valueOf(2), pcl.get(IntegerKey.LEVEL));
assertEquals(Integer.valueOf(4), pcl.get(IntegerKey.HIT_DIE));
assertEquals(3, facet.getLevel(altid, cl));
}
use of pcgen.cdom.inst.PCClassLevel in project pcgen by PCGen.
the class PCClassLevelCCSkillTest method testDirect.
@Test
public void testDirect() throws PersistenceLayerException {
PCClassLevel pcl = dragon.getOriginalClassLevel(1);
ParseResult result = token.parseToken(context, pcl, "MySkill");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
new ExclusiveToken().parseToken(context, sk, "Yes");
finishLoad();
assertEquals(SkillCost.EXCLUSIVE, pc.getSkillCostForClass(sk, dragon));
classFacet.addClass(id, dragon);
classFacet.setLevel(id, dragon, 1);
assertTrue(lscFacet.contains(id, dragon, SkillCost.CROSS_CLASS, sk));
pc.setDirty(true);
assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(sk, dragon));
classFacet.setLevel(id, dragon, 0);
assertFalse(lscFacet.contains(id, dragon, SkillCost.CROSS_CLASS, sk));
}
use of pcgen.cdom.inst.PCClassLevel in project pcgen by PCGen.
the class PCClassLevelCSkillTest method testDirect.
@Test
public void testDirect() throws PersistenceLayerException {
PCClassLevel pcl = dragon.getOriginalClassLevel(1);
ParseResult result = token.parseToken(context, pcl, "MySkill");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
finishLoad();
assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(sk, dragon));
classFacet.addClass(id, dragon);
classFacet.setLevel(id, dragon, 1);
assertTrue(lscFacet.contains(id, dragon, SkillCost.CLASS, sk));
pc.setDirty(true);
assertEquals(SkillCost.CLASS, pc.getSkillCostForClass(sk, dragon));
classFacet.setLevel(id, dragon, 0);
assertFalse(lscFacet.contains(id, dragon, SkillCost.CLASS, sk));
}
use of pcgen.cdom.inst.PCClassLevel in project pcgen by PCGen.
the class LevelToken method getLevelHP.
/**
* Get the HP for the level
* @param pc
* @param pcl
* @return the HP for the level
*/
public static String getLevelHP(PlayerCharacter pc, PCLevelInfo pcl) {
String classKeyName = pcl.getClassKeyName();
PCClass aClass = pc.getClassKeyed(classKeyName);
if (aClass == null) {
aClass = Globals.getContext().getReferenceContext().silentlyGetConstructedCDOMObject(PCClass.class, classKeyName);
if (aClass != null) {
CDOMSingleRef<PCClass> exc = aClass.get(ObjectKey.EX_CLASS);
aClass = pc.getClassKeyed(exc.get().getKeyName());
}
}
if (aClass != null) {
PCClassLevel classLevel = pc.getDisplay().getActiveClassLevel(aClass, pcl.getClassLevel() - 1);
Integer hp = pc.getDisplay().getHP(classLevel);
return hp == null ? "0" : hp.toString();
}
return "";
}
use of pcgen.cdom.inst.PCClassLevel in project pcgen by PCGen.
the class AddTokenTest method testInvalidLevelClearLevelNaN.
@Test
public void testInvalidLevelClearLevelNaN() throws PersistenceLayerException {
primaryProf = new PCClassLevel();
primaryProf.put(IntegerKey.LEVEL, 1);
secondaryProf = new PCClassLevel();
secondaryProf.put(IntegerKey.LEVEL, 1);
assertFalse(parse(".CLEAR.LEVELx"));
assertNoSideEffects();
}
Aggregations