Search in sources :

Example 1 with IsmonsterToken

use of plugin.lsttokens.pcclass.IsmonsterToken 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));
}
Also used : MoncskillToken(plugin.lsttokens.race.MoncskillToken) Skill(pcgen.core.Skill) HdToken(plugin.lsttokens.pcclass.HdToken) IsmonsterToken(plugin.lsttokens.pcclass.IsmonsterToken) Race(pcgen.core.Race) PCClass(pcgen.core.PCClass) TypeLst(plugin.lsttokens.TypeLst) ExclusiveToken(plugin.lsttokens.skill.ExclusiveToken) SkillToken(plugin.lsttokens.choose.SkillToken) Test(org.junit.Test) AbstractGlobalTargetedSaveRestoreTest(pcgen.io.testsupport.AbstractGlobalTargetedSaveRestoreTest)

Example 2 with IsmonsterToken

use of plugin.lsttokens.pcclass.IsmonsterToken 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)2 Skill (pcgen.core.Skill)2 HdToken (plugin.lsttokens.pcclass.HdToken)2 IsmonsterToken (plugin.lsttokens.pcclass.IsmonsterToken)2 Test (org.junit.Test)1 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 TypeLst (plugin.lsttokens.TypeLst)1 SkillToken (plugin.lsttokens.choose.SkillToken)1 MoncskillToken (plugin.lsttokens.race.MoncskillToken)1 ExclusiveToken (plugin.lsttokens.skill.ExclusiveToken)1