Search in sources :

Example 41 with PCClass

use of pcgen.core.PCClass in project pcgen by PCGen.

the class SkillTargetSaveRestoreTest method applyObject.

@Override
protected void applyObject(Skill obj) {
    PCClass cl = context.getReferenceContext().silentlyGetConstructedCDOMObject(PCClass.class, "MyClass");
    pc.addClass(cl);
    pc.incrementClassLevel(1, cl);
    pc.setHP(pc.getActiveClassLevel(cl, 0), 4);
    SkillRankControl.modRanks(1.0, cl, true, pc, obj);
    SkillRankControl.getSkillRankBonusTo(pc, obj);
}
Also used : PCClass(pcgen.core.PCClass)

Example 42 with PCClass

use of pcgen.core.PCClass in project pcgen by PCGen.

the class BasicSaveRestoreTest method testClass.

@Test
public void testClass() {
    PCClass cl = create(PCClass.class, "MyClass");
    new HdToken().parseToken(context, cl, "6");
    finishLoad();
    pc.addClass(cl);
    pc.incrementClassLevel(1, cl);
    pc.setHP(pc.getActiveClassLevel(cl, 0), 4);
    runWriteRead(false);
    //TODO need this to create the spell support :/
    reloadedPC.getSpellSupport(cl);
    checkEquality();
}
Also used : HdToken(plugin.lsttokens.pcclass.HdToken) PCClass(pcgen.core.PCClass) Test(org.junit.Test) AbstractSaveRestoreTest(pcgen.io.testsupport.AbstractSaveRestoreTest)

Example 43 with PCClass

use of pcgen.core.PCClass in project pcgen by PCGen.

the class DomainTargetSaveRestoreTest method prepare.

@Override
protected Object prepare(Domain obj) {
    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 44 with PCClass

use of pcgen.core.PCClass in project pcgen by PCGen.

the class AddAbilityVirtualTest method testMult.

@Test
public void testMult() throws PersistenceLayerException {
    TokenRegistration.register(new NoChoiceToken());
    TokenRegistration.register(new StackToken());
    Domain source = create(Domain.class, "Source");
    PCClass pcc = create(PCClass.class, "Class");
    Ability a = createGrantedObject();
    context.unconditionallyProcess(a, "MULT", "YES");
    context.unconditionallyProcess(a, "STACK", "YES");
    context.unconditionallyProcess(a, "CHOOSE", "NOCHOICE");
    runToken(source);
    processToken(source);
    assocCheck = new AssocCheck() {

        public boolean check(CNAbility g) {
            if (pc.getDetailedAssociationCount(g) == 2) {
                return true;
            } else {
                System.err.println("Incorrect Association Count");
                return false;
            }
        }
    };
    assertEquals(0, getCount());
    ClassSource classSource = new ClassSource(pcc);
    domainFacet.add(id, source, classSource);
    assertTrue(containsExpected(a));
    assertEquals(2, getCount());
    domainFacet.remove(id, source);
    assertEquals(0, getCount());
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility) CNAbility(pcgen.cdom.content.CNAbility) NoChoiceToken(plugin.lsttokens.choose.NoChoiceToken) StackToken(plugin.lsttokens.ability.StackToken) Domain(pcgen.core.Domain) PCClass(pcgen.core.PCClass) AssocCheck(tokenmodel.testsupport.AssocCheck) ClassSource(pcgen.cdom.helper.ClassSource) Test(org.junit.Test) AbstractAddListTokenTest(tokenmodel.testsupport.AbstractAddListTokenTest)

Example 45 with PCClass

use of pcgen.core.PCClass in project pcgen by PCGen.

the class AddAbilityNormalTest method testMult.

//TODO this appears to be a bug - is only applied once?
@Test
public void testMult() throws PersistenceLayerException {
    TokenRegistration.register(new NoChoiceToken());
    TokenRegistration.register(new StackToken());
    Domain source = create(Domain.class, "Source");
    PCClass pcc = create(PCClass.class, "Class");
    Ability a = createGrantedObject();
    context.unconditionallyProcess(a, "MULT", "YES");
    context.unconditionallyProcess(a, "STACK", "YES");
    context.unconditionallyProcess(a, "CHOOSE", "NOCHOICE");
    runToken(source);
    processToken(source);
    assocCheck = new AssocCheck() {

        public boolean check(CNAbility g) {
            if (pc.getDetailedAssociationCount(g) == 2) {
                return true;
            } else {
                System.err.println("Incorrect Association Count");
                return false;
            }
        }
    };
    assertEquals(0, getCount());
    ClassSource classSource = new ClassSource(pcc);
    domainFacet.add(id, source, classSource);
    assertTrue(containsExpected(a));
    assertEquals(2, getCount());
    domainFacet.remove(id, source);
    assertEquals(0, getCount());
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility) CNAbility(pcgen.cdom.content.CNAbility) NoChoiceToken(plugin.lsttokens.choose.NoChoiceToken) StackToken(plugin.lsttokens.ability.StackToken) Domain(pcgen.core.Domain) PCClass(pcgen.core.PCClass) AssocCheck(tokenmodel.testsupport.AssocCheck) ClassSource(pcgen.cdom.helper.ClassSource) Test(org.junit.Test) AbstractAddListTokenTest(tokenmodel.testsupport.AbstractAddListTokenTest)

Aggregations

PCClass (pcgen.core.PCClass)359 Test (org.junit.Test)96 PlayerCharacter (pcgen.core.PlayerCharacter)61 Skill (pcgen.core.Skill)55 ArrayList (java.util.ArrayList)35 Domain (pcgen.core.Domain)30 LoadContext (pcgen.rules.context.LoadContext)28 PCClassLevel (pcgen.cdom.inst.PCClassLevel)26 CDOMObject (pcgen.cdom.base.CDOMObject)23 CharacterSpell (pcgen.core.character.CharacterSpell)20 Spell (pcgen.core.spell.Spell)20 StringTokenizer (java.util.StringTokenizer)19 CharID (pcgen.cdom.enumeration.CharID)19 ClassSource (pcgen.cdom.helper.ClassSource)19 PreClassTester (plugin.pretokens.test.PreClassTester)16 SkillCost (pcgen.cdom.enumeration.SkillCost)15 ParseResult (pcgen.rules.persistence.token.ParseResult)15 Ability (pcgen.core.Ability)14 Race (pcgen.core.Race)14 BonusObj (pcgen.core.bonus.BonusObj)14