Search in sources :

Example 11 with ExclusiveToken

use of plugin.lsttokens.skill.ExclusiveToken in project pcgen by PCGen.

the class DomainCcSkillTest method testList.

@Test
public void testList() throws PersistenceLayerException {
    Domain source = create(Domain.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, "MySkill");
    if (result != ParseResult.SUCCESS) {
        result.printMessages();
        fail("Test Setup Failed");
    }
    new ExclusiveToken().parseToken(context, sk, "Yes");
    finishLoad();
    assertFalse(lascFacet.contains(id, dragon, SkillCost.CROSS_CLASS, sk));
    assertEquals(SkillCost.EXCLUSIVE, pc.getSkillCostForClass(sk, dragon));
    domainInputFacet.add(id, source, new ClassSource(dragon, 0));
    assertTrue(lascFacet.contains(id, dragon, SkillCost.CROSS_CLASS, sk));
    pc.addClass(dragon);
    pc.setDirty(true);
    assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(sk, dragon));
    domainInputFacet.remove(id, source);
    assertFalse(lascFacet.contains(id, dragon, SkillCost.CROSS_CLASS, sk));
}
Also used : ParseResult(pcgen.rules.persistence.token.ParseResult) Domain(pcgen.core.Domain) ExclusiveToken(plugin.lsttokens.skill.ExclusiveToken) ClassSource(pcgen.cdom.helper.ClassSource) Test(org.junit.Test) AbstractTokenModelTest(tokenmodel.testsupport.AbstractTokenModelTest)

Example 12 with ExclusiveToken

use of plugin.lsttokens.skill.ExclusiveToken in project pcgen by PCGen.

the class DomainCcSkillTest 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");
    }
    new ExclusiveToken().parseToken(context, sk, "Yes");
    finishLoad();
    assertEquals(SkillCost.EXCLUSIVE, pc.getSkillCostForClass(sk, dragon));
    domainInputFacet.add(id, source, new ClassSource(dragon, 0));
    assertTrue(lscFacet.contains(id, dragon, SkillCost.CROSS_CLASS, sk));
    pc.addClass(dragon);
    pc.setDirty(true);
    assertEquals(SkillCost.CROSS_CLASS, pc.getSkillCostForClass(sk, dragon));
    domainInputFacet.remove(id, source);
    assertFalse(lscFacet.contains(id, dragon, SkillCost.CROSS_CLASS, sk));
}
Also used : ParseResult(pcgen.rules.persistence.token.ParseResult) Domain(pcgen.core.Domain) ExclusiveToken(plugin.lsttokens.skill.ExclusiveToken) ClassSource(pcgen.cdom.helper.ClassSource) Test(org.junit.Test) AbstractTokenModelTest(tokenmodel.testsupport.AbstractTokenModelTest)

Aggregations

ExclusiveToken (plugin.lsttokens.skill.ExclusiveToken)12 Test (org.junit.Test)11 PCClass (pcgen.core.PCClass)8 Skill (pcgen.core.Skill)7 ParseResult (pcgen.rules.persistence.token.ParseResult)5 SkillToken (plugin.lsttokens.choose.SkillToken)5 HdToken (plugin.lsttokens.pcclass.HdToken)5 CDOMObject (pcgen.cdom.base.CDOMObject)4 Domain (pcgen.core.Domain)4 AbstractTokenModelTest (tokenmodel.testsupport.AbstractTokenModelTest)4 AbstractGlobalTargetedSaveRestoreTest (pcgen.io.testsupport.AbstractGlobalTargetedSaveRestoreTest)3 TypeLst (plugin.lsttokens.TypeLst)3 ClassSource (pcgen.cdom.helper.ClassSource)2 Race (pcgen.core.Race)2 CcskillLst (plugin.lsttokens.CcskillLst)2 CskillLst (plugin.lsttokens.CskillLst)2 PCClassLevel (pcgen.cdom.inst.PCClassLevel)1 ClassSkillList (pcgen.cdom.list.ClassSkillList)1 PCTemplate (pcgen.core.PCTemplate)1 CcskillToken (plugin.lsttokens.domain.CcskillToken)1