use of pcgen.core.Campaign 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());
}
}
use of pcgen.core.Campaign 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);
}
use of pcgen.core.Campaign 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);
}
use of pcgen.core.Campaign 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);
}
use of pcgen.core.Campaign 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;
}
Aggregations