Search in sources :

Example 26 with Ability

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

the class AbilityIntegrationTest method testRoundRobinMixed.

@Test
public void testRoundRobinMixed() throws PersistenceLayerException {
    verifyCleanStart();
    Ability ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
    primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
    secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
    primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
    secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    TestContext tc = new TestContext();
    commit(testCampaign, tc, "FEAT|VIRTUAL|.CLEAR.Abil2|Abil1");
    commit(modCampaign, tc, "FEAT|AUTOMATIC|.CLEAR.Abil1|Abil2");
    completeRoundRobin(tc);
}
Also used : Ability(pcgen.core.Ability) TestContext(plugin.lsttokens.editcontext.testsupport.TestContext) Test(org.junit.Test)

Example 27 with Ability

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

the class AbilityIntegrationTest method testRoundRobinClearOrder.

@Test
public void testRoundRobinClearOrder() throws PersistenceLayerException {
    verifyCleanStart();
    Ability ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
    primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
    secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
    primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
    secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    TestContext tc = new TestContext();
    commit(testCampaign, tc, "FEAT|VIRTUAL|.CLEAR", "FEAT|VIRTUAL|Abil1|Abil2");
    commit(modCampaign, tc, "FEAT|VIRTUAL|.CLEAR");
    completeRoundRobin(tc);
}
Also used : Ability(pcgen.core.Ability) TestContext(plugin.lsttokens.editcontext.testsupport.TestContext) Test(org.junit.Test)

Example 28 with Ability

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

the class AbilityIntegrationTest method testRoundRobinNoReset.

@Test
public void testRoundRobinNoReset() throws PersistenceLayerException {
    verifyCleanStart();
    Ability ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
    primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
    secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
    primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
    secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    TestContext tc = new TestContext();
    commit(testCampaign, tc, "FEAT|VIRTUAL|Abil1|Abil2");
    emptyCommit(modCampaign, tc);
    completeRoundRobin(tc);
}
Also used : Ability(pcgen.core.Ability) TestContext(plugin.lsttokens.editcontext.testsupport.TestContext) Test(org.junit.Test)

Example 29 with Ability

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

the class AbilityIntegrationTest method testRoundRobinSimple.

@Test
public void testRoundRobinSimple() throws PersistenceLayerException {
    verifyCleanStart();
    Ability ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
    primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
    secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
    primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
    secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
    TestContext tc = new TestContext();
    commit(testCampaign, tc, "FEAT|NORMAL|Abil1");
    commit(modCampaign, tc, "FEAT|VIRTUAL|TYPE=TestType");
    completeRoundRobin(tc);
}
Also used : Ability(pcgen.core.Ability) TestContext(plugin.lsttokens.editcontext.testsupport.TestContext) Test(org.junit.Test)

Example 30 with Ability

use of pcgen.core.Ability 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)

Aggregations

Ability (pcgen.core.Ability)279 CNAbility (pcgen.cdom.content.CNAbility)128 AbilityCategory (pcgen.core.AbilityCategory)60 PlayerCharacter (pcgen.core.PlayerCharacter)54 Test (org.junit.Test)46 ArrayList (java.util.ArrayList)43 CNAbilitySelection (pcgen.cdom.helper.CNAbilitySelection)25 ParseResult (pcgen.rules.persistence.token.ParseResult)21 HashMapToList (pcgen.base.util.HashMapToList)15 PCClass (pcgen.core.PCClass)15 Spell (pcgen.core.spell.Spell)15 StringTokenizer (java.util.StringTokenizer)14 TestContext (plugin.lsttokens.editcontext.testsupport.TestContext)13 LoadContext (pcgen.rules.context.LoadContext)12 SpecialAbility (pcgen.core.SpecialAbility)11 CharacterSpell (pcgen.core.character.CharacterSpell)11 PreParserFactory (pcgen.persistence.lst.prereq.PreParserFactory)11 List (java.util.List)10 CDOMObject (pcgen.cdom.base.CDOMObject)10 CDOMSingleRef (pcgen.cdom.reference.CDOMSingleRef)10