Search in sources :

Example 1 with CcskillLst

use of plugin.lsttokens.CcskillLst in project pcgen by PCGen.

the class AbstractGlobalTargetedSaveRestoreTest method testGlobalCCSkill.

@Test
public void testGlobalCCSkill() {
    PCClass myclass = create(PCClass.class, "SomeClass");
    new HdToken().parseToken(context, myclass, "8");
    Skill granted = create(Skill.class, "Granted");
    new ExclusiveToken().parseToken(context, granted, "Yes");
    T target = create(getObjectClass(), "Target");
    create(Skill.class, "MySkill");
    new CcskillLst().parseToken(context, target, "Granted");
    Object o = prepare(target);
    finishLoad();
    pc.incrementClassLevel(1, myclass);
    pc.setHP(pc.getActiveClassLevel(myclass, 0), 3);
    assertEquals(SkillCost.EXCLUSIVE, pc.getSkillCostForClass(granted, myclass));
    applyObject(target);
    assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(granted, myclass));
    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, "SomeClass");
            reloadedPC.getSpellSupport(cl);
        }
    };
    runRoundRobin(fullcleanup);
    assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(granted, myclass));
    assertEquals(SkillCost.CROSS_CLASS, reloadedPC.getSkillCostForClass(granted, myclass));
    remove(o);
    reloadedPC.setDirty(true);
    assertEquals(SkillCost.EXCLUSIVE, reloadedPC.getSkillCostForClass(granted, myclass));
}
Also used : Skill(pcgen.core.Skill) HdToken(plugin.lsttokens.pcclass.HdToken) CDOMObject(pcgen.cdom.base.CDOMObject) PCClass(pcgen.core.PCClass) ExclusiveToken(plugin.lsttokens.skill.ExclusiveToken) CcskillLst(plugin.lsttokens.CcskillLst) Test(org.junit.Test)

Example 2 with CcskillLst

use of plugin.lsttokens.CcskillLst in project pcgen by PCGen.

the class AbstractGlobalTargetedSaveRestoreTest method testGlobalCCSkillList.

public void testGlobalCCSkillList() {
    PCClass myclass = create(PCClass.class, "SomeClass");
    new HdToken().parseToken(context, myclass, "8");
    Skill granted = create(Skill.class, "Granted");
    new ExclusiveToken().parseToken(context, granted, "Yes");
    T target = create(getObjectClass(), "Target");
    create(Skill.class, "MySkill");
    new CcskillLst().parseToken(context, target, "LIST");
    new SkillToken().parseToken(context, target, "Granted|MySkill");
    additionalChooseSet(target);
    Object o = prepare(target);
    finishLoad();
    pc.incrementClassLevel(1, myclass);
    pc.setHP(pc.getActiveClassLevel(myclass, 0), 3);
    assertEquals(SkillCost.EXCLUSIVE, pc.getSkillCostForClass(granted, myclass));
    applyObject(target);
    assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(granted, myclass));
    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, "SomeClass");
            reloadedPC.getSpellSupport(cl);
        }
    };
    runRoundRobin(fullcleanup);
    assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(granted, myclass));
    assertEquals(SkillCost.CROSS_CLASS, reloadedPC.getSkillCostForClass(granted, myclass));
    remove(o);
    reloadedPC.setDirty(true);
    if (isSymmetric()) {
        assertEquals(SkillCost.EXCLUSIVE, reloadedPC.getSkillCostForClass(granted, myclass));
    }
}
Also used : Skill(pcgen.core.Skill) HdToken(plugin.lsttokens.pcclass.HdToken) CDOMObject(pcgen.cdom.base.CDOMObject) PCClass(pcgen.core.PCClass) ExclusiveToken(plugin.lsttokens.skill.ExclusiveToken) SkillToken(plugin.lsttokens.choose.SkillToken) CcskillLst(plugin.lsttokens.CcskillLst)

Aggregations

CDOMObject (pcgen.cdom.base.CDOMObject)2 PCClass (pcgen.core.PCClass)2 Skill (pcgen.core.Skill)2 CcskillLst (plugin.lsttokens.CcskillLst)2 HdToken (plugin.lsttokens.pcclass.HdToken)2 ExclusiveToken (plugin.lsttokens.skill.ExclusiveToken)2 Test (org.junit.Test)1 SkillToken (plugin.lsttokens.choose.SkillToken)1