use of pcgen.core.PCClass in project pcgen by PCGen.
the class KitLevelAbility method doApplication.
private boolean doApplication(PlayerCharacter aPC) {
PCClass theClass = theClassName.get();
PCClass classKeyed = aPC.getClassKeyed(theClass.getKeyName());
if (classKeyed == null) {
//Error?
}
//Look for ADD in class
List<PersistentTransitionChoice<?>> adds = theClass.getListFor(ListKey.ADD);
if (adds == null) {
//Error?
}
for (PersistentTransitionChoice<?> ch : adds) {
if (add.equals(ch)) {
process(aPC, classKeyed, ch);
return true;
}
}
return false;
}
use of pcgen.core.PCClass in project pcgen by PCGen.
the class GlobalCSkillTest method testList.
@Test
public void testList() throws PersistenceLayerException {
PCTemplate source = create(PCTemplate.class, "Source");
ParseResult result = token.parseToken(context, source, "LIST");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
result = CHOOSE_SKILL_TOKEN.parseToken(context, source, "Granted");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
PCClass wizard = create(PCClass.class, "Wizard");
finishLoad();
pc.incrementClassLevel(1, wizard);
assertFalse(globalAddedSkillCostFacet.contains(id, SkillCost.CLASS, granted));
assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(granted, wizard));
templateInputFacet.directAdd(id, source, granted);
pc.calcActiveBonuses();
assertEquals(SkillCost.CLASS, pc.getSkillCostForClass(granted, wizard));
assertTrue(globalAddedSkillCostFacet.contains(id, SkillCost.CLASS, granted));
templateInputFacet.remove(id, source);
pc.calcActiveBonuses();
assertFalse(globalAddedSkillCostFacet.contains(id, SkillCost.CLASS, granted));
}
use of pcgen.core.PCClass in project pcgen by PCGen.
the class GlobalCcSkillTest method testList.
@Test
public void testList() throws PersistenceLayerException {
PCTemplate source = create(PCTemplate.class, "Source");
ParseResult result = token.parseToken(context, source, "LIST");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
result = CHOOSE_SKILL_TOKEN.parseToken(context, source, "Granted");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
PCClass wizard = create(PCClass.class, "Wizard");
new ExclusiveToken().parseToken(context, granted, "Yes");
finishLoad();
pc.incrementClassLevel(1, wizard);
assertFalse(globalAddedSkillCostFacet.contains(id, SkillCost.CROSS_CLASS, granted));
assertEquals(SkillCost.EXCLUSIVE, pc.getSkillCostForClass(granted, wizard));
templateInputFacet.directAdd(id, source, granted);
pc.calcActiveBonuses();
assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(granted, wizard));
assertTrue(globalAddedSkillCostFacet.contains(id, SkillCost.CROSS_CLASS, granted));
templateInputFacet.remove(id, source);
pc.calcActiveBonuses();
assertFalse(globalAddedSkillCostFacet.contains(id, SkillCost.CROSS_CLASS, granted));
}
use of pcgen.core.PCClass in project pcgen by PCGen.
the class CharacterLevelsFacadeImpl method refreshClassList.
/**
* Update the list of class levels from scratch to match the current
* state of the character.
*/
private void refreshClassList() {
List<PCClass> newClasses = charDisplay.getClassList();
Collection<PCLevelInfo> levelInfo = charDisplay.getLevelInfo();
Map<String, Integer> levelCount = new HashMap<>();
Map<String, PCClass> classMap = new HashMap<>();
for (PCClass pcClass : newClasses) {
levelCount.put(pcClass.getKeyName(), 1);
classMap.put(pcClass.getKeyName(), pcClass);
}
classLevels.clear();
clearContents();
for (PCLevelInfo lvlInfo : levelInfo) {
final String classKeyName = lvlInfo.getClassKeyName();
PCClass currClass = classMap.get(classKeyName);
if (currClass == null) {
Logging.errorPrint("No PCClass found for '" + classKeyName + "' in character's class list: " + newClasses);
return;
}
int clsLvlNum = levelCount.get(classKeyName);
levelCount.put(classKeyName, clsLvlNum + 1);
classLevels.add(currClass);
CharacterLevelFacadeImpl levelFI = new CharacterLevelFacadeImpl(currClass, classLevels.size());
addElement(levelFI);
//PCClassLevel classLevel = currClass.getClassLevel(clsLvlNum);
}
updateSkillsTodo();
}
use of pcgen.core.PCClass in project pcgen by PCGen.
the class PCClassLoader method getCopy.
@Override
public PCClass getCopy(LoadContext context, String baseName, String copyName, CampaignSourceEntry source) throws PersistenceLayerException {
PCClass copy = super.getCopy(context, baseName, copyName, source);
PCClassKeyChange.changeReferences(baseName, copy);
return copy;
}
Aggregations