use of pcgen.persistence.lst.PCClassLoader in project pcgen by PCGen.
the class PreVarTest method test2857849and2862276.
public void test2857849and2862276() {
LoadContext context = Globals.getContext();
final PCClass spellcaster = new PCClass();
spellcaster.setName("Spellcaster");
context.getReferenceContext().importObject(spellcaster);
context.unconditionallyProcess(spellcaster, "SPELLTYPE", "Arcane");
context.unconditionallyProcess(spellcaster, "SPELLSTAT", "INT");
context.unconditionallyProcess(spellcaster, "PREVARGTEQ", "BASESPELLSTAT,2");
PCClassLoader loader = new PCClassLoader();
try {
SourceEntry se = new CampaignSourceEntry(new Campaign(), new URI("file://test"));
loader.completeObject(context, se, spellcaster);
context.getReferenceContext().resolveReferences(null);
PlayerCharacter character = this.getCharacter();
setPCStat(character, intel, 16);
assertTrue(spellcaster.qualifies(character, spellcaster));
} catch (URISyntaxException | PersistenceLayerException e) {
fail(e.getMessage());
}
}
use of pcgen.persistence.lst.PCClassLoader in project pcgen by PCGen.
the class PreVarTest method test2857849a.
public void test2857849a() {
final PCClass warrior = new PCClass();
warrior.setName("Warrior");
LoadContext context = Globals.getContext();
context.unconditionallyProcess(warrior, "DEFINE", "MyVar|0");
context.unconditionallyProcess(warrior, "BONUS", "VAR|MyVar|2");
PCClassLoader loader = new PCClassLoader();
try {
SourceEntry se = new CampaignSourceEntry(new Campaign(), new URI("file://test"));
final PCClass notawarrior = loader.parseLine(context, null, "CLASS:NotAWarrior\tPREVARGTEQ:MyVar,1", se);
loader.completeObject(context, se, warrior);
loader.completeObject(context, se, notawarrior);
PlayerCharacter character = this.getCharacter();
assertFalse(notawarrior.qualifies(character, notawarrior));
character.incrementClassLevel(1, warrior);
assertTrue(notawarrior.qualifies(character, notawarrior));
} catch (URISyntaxException | PersistenceLayerException e) {
fail(e.getMessage());
}
}
use of pcgen.persistence.lst.PCClassLoader in project pcgen by PCGen.
the class PreVarTest method test2857848a.
public void test2857848a() {
LoadContext context = Globals.getContext();
final PCClass spellcaster = new PCClass();
spellcaster.setName("Spellcaster");
context.getReferenceContext().importObject(spellcaster);
Skill concentration = context.getReferenceContext().constructCDOMObject(Skill.class, "Concentration");
context.unconditionallyProcess(spellcaster, "SPELLTYPE", "Arcane");
context.unconditionallyProcess(spellcaster, "SPELLSTAT", "INT");
context.unconditionallyProcess(spellcaster, "CSKILL", "Concentration");
context.unconditionallyProcess(spellcaster, "BONUS", "SKILL|Concentration|5|PREVARGT:BASESPELLSTAT,2");
assertTrue(context.getReferenceContext().resolveReferences(null));
PlayerCharacter character = this.getCharacter();
setPCStat(character, intel, 16);
PCClassLoader loader = new PCClassLoader();
try {
SourceEntry se = new CampaignSourceEntry(new Campaign(), new URI("file://test"));
loader.completeObject(context, se, spellcaster);
assertEquals(0, SkillModifier.modifier(concentration, character).intValue());
character.incrementClassLevel(1, spellcaster);
assertEquals(5, SkillModifier.modifier(concentration, character).intValue());
} catch (URISyntaxException | PersistenceLayerException e) {
fail(e.getMessage());
}
}
use of pcgen.persistence.lst.PCClassLoader in project pcgen by PCGen.
the class PCTLTermEvaluatorTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
Campaign customCampaign = new Campaign();
customCampaign.setName("Unit Test");
customCampaign.setName("KEY_Unit Test");
customCampaign.addToListFor(ListKey.DESCRIPTION, new Description("Unit Test data"));
CampaignSourceEntry source = new CampaignSourceEntry(customCampaign, new URI("file:/" + getClass().getName() + ".java"));
// Create the humanoid class
String classDef = "CLASS:Humanoid KEY:KEY_Humanoid HD:8 CLASSTYPE:Monster STARTSKILLPTS:1 " + "MODTOSKILLS:NO MONSKILL:6+INT MONNONSKILLHD:1|PRESIZELTEQ:M " + "MONNONSKILLHD:2|PRESIZEEQ:L";
PCClassLoader classLoader = new PCClassLoader();
LoadContext context = Globals.getContext();
humanoidClass = classLoader.parseLine(context, null, classDef, source);
Globals.getContext().getReferenceContext().importObject(humanoidClass);
// Create the BugBear race
bugbearRace = new Race();
bugbearRace.setName("Bugbear");
bugbearRace.put(StringKey.KEY_NAME, "KEY_Bugbear");
CDOMDirectSingleRef<SizeAdjustment> mediumRef = CDOMDirectSingleRef.getRef(medium);
bugbearRace.put(FormulaKey.SIZE, new FixedSizeFormula(mediumRef));
bugbearRace.addToListFor(ListKey.HITDICE_ADVANCEMENT, Integer.MAX_VALUE);
bugbearRace.put(IntegerKey.INITIAL_SKILL_MULT, 1);
Globals.getContext().getReferenceContext().importObject(bugbearRace);
}
use of pcgen.persistence.lst.PCClassLoader in project pcgen by PCGen.
the class PCRacialHDSizeTermEvaluatorTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
Campaign customCampaign = new Campaign();
customCampaign.setName("Unit Test");
customCampaign.setName("KEY_Unit Test");
customCampaign.addToListFor(ListKey.DESCRIPTION, new Description("Unit Test data"));
CampaignSourceEntry source = new CampaignSourceEntry(customCampaign, new URI("file:/" + getClass().getName() + ".java"));
LoadContext context = Globals.getContext();
PCClassLoader classLoader = new PCClassLoader();
// Create the humanoid monster class
final String humanoidClassLine = "CLASS:Humanoid KEY:KEY_Humanoid HD:8 TYPE:Monster CLASSTYPE:Monster " + "STARTSKILLPTS:2 MODTOSKILLS:YES";
humanoidClass = classLoader.parseLine(context, null, humanoidClassLine, source);
context.getReferenceContext().importObject(humanoidClass);
// Create the pc class
final String pcClassLine = "CLASS:TestPCClass TYPE:PC HD:10";
pcClass = classLoader.parseLine(context, null, pcClassLine, source);
context.getReferenceContext().importObject(pcClass);
CDOMDirectSingleRef<SizeAdjustment> mediumRef = CDOMDirectSingleRef.getRef(medium);
// Create the BugBear race
bugbearRace.setName("Bugbear");
bugbearRace.put(StringKey.KEY_NAME, "KEY_Bugbear");
bugbearRace.put(FormulaKey.SIZE, new FixedSizeFormula(mediumRef));
bugbearRace.addToListFor(ListKey.HITDICE_ADVANCEMENT, Integer.MAX_VALUE);
bugbearRace.put(ObjectKey.MONSTER_CLASS, new LevelCommandFactory(CDOMDirectSingleRef.getRef(humanoidClass), FormulaFactory.getFormulaFor(3)));
context.getReferenceContext().importObject(bugbearRace);
// Create the human race
humanRace.setName("Human");
humanRace.put(StringKey.KEY_NAME, "KEY_Human");
humanRace.put(FormulaKey.SIZE, new FixedSizeFormula(mediumRef));
context.getReferenceContext().importObject(humanRace);
}
Aggregations