Search in sources :

Example 86 with CampaignSourceEntry

use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.

the class PreVarTest method test2856622.

public void test2856622() {
    LoadContext context = Globals.getContext();
    final PCClass warrior = new PCClass();
    warrior.setName("Warrior");
    PCClassLevel level1 = warrior.getOriginalClassLevel(1);
    context.unconditionallyProcess(level1, "SAB", "Test Works|PREVARGTEQ:CL,3");
    assertTrue(context.getReferenceContext().resolveReferences(null));
    PlayerCharacter character = this.getCharacter();
    character.incrementClassLevel(1, warrior);
    PCClassLoader loader = new PCClassLoader();
    try {
        SourceEntry se = new CampaignSourceEntry(new Campaign(), new URI("file://test"));
        loader.completeObject(context, se, warrior);
        List<SpecialAbility> sabList = level1.getListFor(ListKey.SAB);
        assertNotNull(sabList);
        assertEquals(1, sabList.size());
        SpecialAbility sab = sabList.get(0);
        assertFalse(sab.qualifies(character, warrior));
        character.incrementClassLevel(1, warrior);
        assertFalse(sab.qualifies(character, warrior));
        character.incrementClassLevel(1, warrior);
        assertTrue(sab.qualifies(character, warrior));
    } catch (URISyntaxException | PersistenceLayerException e) {
        fail(e.getMessage());
    }
}
Also used : SpecialAbility(pcgen.core.SpecialAbility) URISyntaxException(java.net.URISyntaxException) PCClass(pcgen.core.PCClass) URI(java.net.URI) PCClassLevel(pcgen.cdom.inst.PCClassLevel) CampaignSourceEntry(pcgen.persistence.lst.CampaignSourceEntry) PersistenceLayerException(pcgen.persistence.PersistenceLayerException) PlayerCharacter(pcgen.core.PlayerCharacter) Campaign(pcgen.core.Campaign) LoadContext(pcgen.rules.context.LoadContext) PCClassLoader(pcgen.persistence.lst.PCClassLoader) SourceEntry(pcgen.persistence.lst.SourceEntry) CampaignSourceEntry(pcgen.persistence.lst.CampaignSourceEntry)

Example 87 with CampaignSourceEntry

use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.

the class VisionTokenTest method setUp.

/*
	 * @see TestCase#setUp()
	 */
@Override
protected void setUp() throws Exception {
    super.setUp();
    final GenericLoader<PCTemplate> loader = new GenericLoader<>(PCTemplate.class);
    final LoadContext context = Globals.getContext();
    CampaignSourceEntry source;
    try {
        source = new CampaignSourceEntry(new Campaign(), new URI("file:/" + getClass().getName() + ".java"));
    } catch (URISyntaxException e) {
        throw new UnreachableError(e);
    }
    loader.parseLine(context, null, "Darkvision		VISION:Darkvision (60')", source);
    darkvisionT = context.getReferenceContext().silentlyGetConstructedCDOMObject(PCTemplate.class, "Darkvision");
    loader.parseLine(context, null, "Low-light		VISION:Low-light", source);
    lowlightT = context.getReferenceContext().silentlyGetConstructedCDOMObject(PCTemplate.class, "Low-light");
    loader.parseLine(context, null, "Astral		VISION:Astral (130')", source);
    astralT = context.getReferenceContext().silentlyGetConstructedCDOMObject(PCTemplate.class, "Astral");
    assertTrue(context.getReferenceContext().resolveReferences(null));
    metricUS = new UnitSet();
    metricUS.setName("Metric");
    metricUS.setDistanceUnit("m");
    metricUS.setDistanceFactor(new BigDecimal(0.3));
    metricUS.setDistanceDisplayPattern(new DecimalFormat("#.##"));
    SettingsHandler.getGame().getModeContext().getReferenceContext().importObject(metricUS);
}
Also used : CampaignSourceEntry(pcgen.persistence.lst.CampaignSourceEntry) Campaign(pcgen.core.Campaign) DecimalFormat(java.text.DecimalFormat) GenericLoader(pcgen.persistence.lst.GenericLoader) LoadContext(pcgen.rules.context.LoadContext) UnitSet(pcgen.core.UnitSet) URISyntaxException(java.net.URISyntaxException) UnreachableError(pcgen.base.lang.UnreachableError) PCTemplate(pcgen.core.PCTemplate) URI(java.net.URI) BigDecimal(java.math.BigDecimal)

Example 88 with CampaignSourceEntry

use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.

the class PCBooleanFunctionTest method additionalSetUp.

@Override
protected void additionalSetUp() throws Exception {
    CampaignSourceEntry cse = new CampaignSourceEntry(new Campaign(), new URI("file:/" + getClass().getName() + ".java"));
    final FeatLoader featLoader = new FeatLoader();
    fooFeat = new Ability();
    final String fooFeatStr = "Foo	TYPE:General	DEFINE:FooV|0";
    featLoader.parseLine(Globals.getContext(), fooFeat, fooFeatStr, cse);
}
Also used : CampaignSourceEntry(pcgen.persistence.lst.CampaignSourceEntry) Ability(pcgen.core.Ability) Campaign(pcgen.core.Campaign) FeatLoader(pcgen.persistence.lst.FeatLoader) URI(java.net.URI)

Example 89 with CampaignSourceEntry

use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.

the class PCHasVarFunctionTest method additionalSetUp.

@Override
protected void additionalSetUp() throws Exception {
    CampaignSourceEntry cse = new CampaignSourceEntry(new Campaign(), new URI("file:/" + getClass().getName() + ".java"));
    final FeatLoader featLoader = new FeatLoader();
    fooFeat = new Ability();
    final String fooFeatStr = "Foo	TYPE:General	DEFINE:FooV|0";
    featLoader.parseLine(Globals.getContext(), fooFeat, fooFeatStr, cse);
}
Also used : CampaignSourceEntry(pcgen.persistence.lst.CampaignSourceEntry) Ability(pcgen.core.Ability) Campaign(pcgen.core.Campaign) FeatLoader(pcgen.persistence.lst.FeatLoader) URI(java.net.URI)

Example 90 with CampaignSourceEntry

use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.

the class DisplayNameTokenTest method classSetUp.

@BeforeClass
public static void classSetUp() throws URISyntaxException {
    testCampaign = new CampaignSourceEntry(new Campaign(), new URI("file:/Test%20Case"));
    classSetUpFired = true;
}
Also used : CampaignSourceEntry(pcgen.persistence.lst.CampaignSourceEntry) Campaign(pcgen.core.Campaign) URI(java.net.URI) BeforeClass(org.junit.BeforeClass)

Aggregations

CampaignSourceEntry (pcgen.persistence.lst.CampaignSourceEntry)95 URI (java.net.URI)54 Campaign (pcgen.core.Campaign)44 URISyntaxException (java.net.URISyntaxException)27 LoadContext (pcgen.rules.context.LoadContext)25 UnreachableError (pcgen.base.lang.UnreachableError)19 BeforeClass (org.junit.BeforeClass)16 PCClassLoader (pcgen.persistence.lst.PCClassLoader)15 TreeSet (java.util.TreeSet)12 PlayerCharacter (pcgen.core.PlayerCharacter)11 PersistenceLayerException (pcgen.persistence.PersistenceLayerException)11 ArrayList (java.util.ArrayList)9 PCClass (pcgen.core.PCClass)9 File (java.io.File)8 GenericLoader (pcgen.persistence.lst.GenericLoader)8 CDOMReference (pcgen.cdom.base.CDOMReference)7 SourceEntry (pcgen.persistence.lst.SourceEntry)7 Ability (pcgen.core.Ability)6 FeatLoader (pcgen.persistence.lst.FeatLoader)6 AbilityList (pcgen.cdom.list.AbilityList)5