use of plugin.lsttokens.skill.ExclusiveToken in project pcgen by PCGen.
the class AbstractGlobalTargetedSaveRestoreTest method testGlobalCSkillList.
@Test
public void testGlobalCSkillList() {
PCClass monclass = create(PCClass.class, "MonClass");
new HdToken().parseToken(context, monclass, "8");
new TypeLst().parseToken(context, monclass, "Monster");
Skill granted = create(Skill.class, "Granted");
new ExclusiveToken().parseToken(context, granted, "Yes");
T target = create(getObjectClass(), "Target");
Skill skill = create(Skill.class, "MySkill");
new ExclusiveToken().parseToken(context, skill, "Yes");
new CskillLst().parseToken(context, target, "LIST");
new SkillToken().parseToken(context, target, "Granted|MySkill");
additionalChooseSet(target);
Object o = prepare(target);
finishLoad();
pc.incrementClassLevel(1, monclass);
pc.setHP(pc.getActiveClassLevel(monclass, 0), 3);
assertEquals(SkillCost.EXCLUSIVE, pc.getSkillCostForClass(granted, monclass));
applyObject(target);
assertEquals(SkillCost.CLASS, pc.getSkillCostForClass(granted, monclass));
final Runnable cleanup = getPreEqualityCleanup();
Runnable fullcleanup = new Runnable() {
public void run() {
if (cleanup != null) {
cleanup.run();
}
//TODO need this to create the spell support :/
PCClass cl = context.getReferenceContext().silentlyGetConstructedCDOMObject(PCClass.class, "MonClass");
reloadedPC.getSpellSupport(cl);
}
};
runRoundRobin(fullcleanup);
assertEquals(SkillCost.CLASS, pc.getSkillCostForClass(granted, monclass));
assertEquals(SkillCost.CLASS, reloadedPC.getSkillCostForClass(granted, monclass));
remove(o);
reloadedPC.setDirty(true);
if (isSymmetric()) {
assertEquals(SkillCost.EXCLUSIVE, reloadedPC.getSkillCostForClass(granted, monclass));
}
}
use of plugin.lsttokens.skill.ExclusiveToken in project pcgen by PCGen.
the class DomainTargetSaveRestoreTest method testDomainCSkill.
@Test
public void testDomainCSkill() {
Skill granted = create(Skill.class, "Granted");
new ExclusiveToken().parseToken(context, granted, "Yes");
Domain target = create(getObjectClass(), "Target");
create(Skill.class, "MySkill");
new CskillToken().parseToken(context, target, "LIST");
new SkillToken().parseToken(context, target, "Granted|MySkill");
Object o = prepare(target);
finishLoad();
applyObject(target);
PCClass myclass = pc.getClassKeyed("MyClass");
assertEquals(SkillCost.CLASS, pc.getSkillCostForClass(granted, myclass));
runRoundRobin(getPreEqualityCleanup());
assertEquals(SkillCost.CLASS, pc.getSkillCostForClass(granted, myclass));
myclass = reloadedPC.getClassKeyed("MyClass");
assertEquals(SkillCost.CLASS, reloadedPC.getSkillCostForClass(granted, myclass));
remove(o);
reloadedPC.setDirty(true);
assertEquals(SkillCost.EXCLUSIVE, reloadedPC.getSkillCostForClass(granted, myclass));
}
use of plugin.lsttokens.skill.ExclusiveToken in project pcgen by PCGen.
the class RaceTargetSaveRestoreTest method testRaceMonCSkill.
@Test
public void testRaceMonCSkill() {
PCClass monclass = create(PCClass.class, "MonClass");
new TypeLst().parseToken(context, monclass, "Monster");
new HdToken().parseToken(context, monclass, "8");
new IsmonsterToken().parseToken(context, monclass, "YES");
Skill monskill = create(Skill.class, "MonSkill");
new ExclusiveToken().parseToken(context, monskill, "Yes");
Race monster = create(Race.class, "Monster");
Race other = create(Race.class, "Other");
Skill skill = create(Skill.class, "MySkill");
new ExclusiveToken().parseToken(context, skill, "Yes");
new MoncskillToken().parseToken(context, monster, "LIST");
new SkillToken().parseToken(context, monster, "MonSkill|MySkill");
finishLoad();
pc.setRace(monster);
pc.incrementClassLevel(1, monclass);
pc.setHP(pc.getActiveClassLevel(monclass, 0), 3);
final Runnable cleanup = getPreEqualityCleanup();
Runnable fullcleanup = new Runnable() {
public void run() {
if (cleanup != null) {
cleanup.run();
}
//TODO need this to create the spell support :/
PCClass cl = context.getReferenceContext().silentlyGetConstructedCDOMObject(PCClass.class, "MonClass");
reloadedPC.getSpellSupport(cl);
}
};
runRoundRobin(fullcleanup);
assertEquals(SkillCost.CLASS, pc.getSkillCostForClass(monskill, monclass));
assertEquals(SkillCost.CLASS, reloadedPC.getSkillCostForClass(monskill, monclass));
reloadedPC.setRace(other);
reloadedPC.setDirty(true);
assertEquals(SkillCost.EXCLUSIVE, reloadedPC.getSkillCostForClass(monskill, monclass));
}
use of plugin.lsttokens.skill.ExclusiveToken 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 plugin.lsttokens.skill.ExclusiveToken in project pcgen by PCGen.
the class DomainTargetSaveRestoreTest method testDomainCCSkill.
@Test
public void testDomainCCSkill() {
Skill granted = create(Skill.class, "Granted");
new ExclusiveToken().parseToken(context, granted, "Yes");
Domain target = create(getObjectClass(), "Target");
create(Skill.class, "MySkill");
new CcskillToken().parseToken(context, target, "LIST");
new SkillToken().parseToken(context, target, "Granted|MySkill");
Object o = prepare(target);
finishLoad();
applyObject(target);
PCClass myclass = pc.getClassKeyed("MyClass");
assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(granted, myclass));
runRoundRobin(getPreEqualityCleanup());
assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(granted, myclass));
myclass = reloadedPC.getClassKeyed("MyClass");
assertEquals(SkillCost.CROSS_CLASS, reloadedPC.getSkillCostForClass(granted, myclass));
remove(o);
reloadedPC.setDirty(true);
assertEquals(SkillCost.EXCLUSIVE, reloadedPC.getSkillCostForClass(granted, myclass));
}
Aggregations