Search in sources :

Example 6 with HdToken

use of plugin.lsttokens.pcclass.HdToken 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)

Example 7 with HdToken

use of plugin.lsttokens.pcclass.HdToken in project pcgen by PCGen.

the class SkillTargetSaveRestoreTest method prepare.

@Override
protected Object prepare(Skill obj) {
    obj.put(ObjectKey.EXCLUSIVE, true);
    PCClass cl = create(PCClass.class, "MyClass");
    new HdToken().parseToken(context, cl, "6");
    return obj;
}
Also used : HdToken(plugin.lsttokens.pcclass.HdToken) PCClass(pcgen.core.PCClass)

Example 8 with HdToken

use of plugin.lsttokens.pcclass.HdToken in project pcgen by PCGen.

the class AbstractGlobalTargetedSaveRestoreTest method testGlobalCSkill.

@Test
public void testGlobalCSkill() {
    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, "Granted");
    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);
    assertEquals(SkillCost.EXCLUSIVE, reloadedPC.getSkillCostForClass(granted, monclass));
}
Also used : Skill(pcgen.core.Skill) CskillLst(plugin.lsttokens.CskillLst) HdToken(plugin.lsttokens.pcclass.HdToken) CDOMObject(pcgen.cdom.base.CDOMObject) PCClass(pcgen.core.PCClass) TypeLst(plugin.lsttokens.TypeLst) ExclusiveToken(plugin.lsttokens.skill.ExclusiveToken) Test(org.junit.Test)

Example 9 with HdToken

use of plugin.lsttokens.pcclass.HdToken in project pcgen by PCGen.

the class RaceMonCSkillTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    mcsFacet = FacetLibrary.getFacet(MonsterCSkillFacet.class);
    lscFacet = FacetLibrary.getFacet(ListSkillCostFacet.class);
    sk = context.getReferenceContext().constructCDOMObject(Skill.class, "MySkill");
    dragon = context.getReferenceContext().constructCDOMObject(PCClass.class, "Dragon");
    dragon.addToListFor(ListKey.TYPE, Type.MONSTER);
    new HdToken().parseToken(context, dragon, "8");
    new IsmonsterToken().parseToken(context, dragon, "YES");
    TokenRegistration.register(CHOOSE_SKILL_TOKEN);
    ChooserFactory.setDelegate(new MockUIDelegate());
}
Also used : Skill(pcgen.core.Skill) HdToken(plugin.lsttokens.pcclass.HdToken) IsmonsterToken(plugin.lsttokens.pcclass.IsmonsterToken) MockUIDelegate(pcgen.gui2.facade.MockUIDelegate) ListSkillCostFacet(pcgen.cdom.facet.analysis.ListSkillCostFacet) MonsterCSkillFacet(pcgen.cdom.facet.input.MonsterCSkillFacet) PCClass(pcgen.core.PCClass)

Aggregations

PCClass (pcgen.core.PCClass)9 HdToken (plugin.lsttokens.pcclass.HdToken)9 Skill (pcgen.core.Skill)6 Test (org.junit.Test)5 ExclusiveToken (plugin.lsttokens.skill.ExclusiveToken)5 CDOMObject (pcgen.cdom.base.CDOMObject)4 TypeLst (plugin.lsttokens.TypeLst)3 SkillToken (plugin.lsttokens.choose.SkillToken)3 CcskillLst (plugin.lsttokens.CcskillLst)2 CskillLst (plugin.lsttokens.CskillLst)2 IsmonsterToken (plugin.lsttokens.pcclass.IsmonsterToken)2 ListSkillCostFacet (pcgen.cdom.facet.analysis.ListSkillCostFacet)1 MonsterCSkillFacet (pcgen.cdom.facet.input.MonsterCSkillFacet)1 Race (pcgen.core.Race)1 MockUIDelegate (pcgen.gui2.facade.MockUIDelegate)1 AbstractGlobalTargetedSaveRestoreTest (pcgen.io.testsupport.AbstractGlobalTargetedSaveRestoreTest)1 AbstractSaveRestoreTest (pcgen.io.testsupport.AbstractSaveRestoreTest)1 MoncskillToken (plugin.lsttokens.race.MoncskillToken)1