Search in sources :

Example 1 with SimpleLoader

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

the class SpellListTokenTest method setUp.

/*
	 * @see TestCase#setUp()
	 */
@Override
protected void setUp() throws Exception {
    super.setUp();
    LoadContext context = Globals.getContext();
    SettingsHandler.getGame().setSpellBaseDC("10+SPELLLEVEL+BASESPELLSTAT");
    SimpleLoader<BonusSpellInfo> bonusSpellLoader = new SimpleLoader<>(BonusSpellInfo.class);
    try {
        URI testURI = new URI("file:/" + getClass().getName() + ".java");
        bonusSpellLoader.parseLine(context, "1	BASESTATSCORE:12	STATRANGE:8", testURI);
        bonusSpellLoader.parseLine(context, "2	BASESTATSCORE:14	STATRANGE:8", testURI);
        bonusSpellLoader.parseLine(context, "3	BASESTATSCORE:16	STATRANGE:8", testURI);
    } catch (URISyntaxException e) {
        throw new UnreachableError(e);
    }
    // Human
    human = new Race();
    final BonusObj bon = Bonus.newBonus(context, "FEAT|POOL|2");
    human.addToListFor(ListKey.BONUS, bon);
    arcaneClass = new PCClass();
    arcaneClass.setName("TestArcane");
    BuildUtilities.setFact(arcaneClass, "SpellType", "Arcane");
    context.unconditionallyProcess(arcaneClass, "SPELLSTAT", "CHA");
    arcaneClass.put(ObjectKey.SPELLBOOK, false);
    arcaneClass.put(ObjectKey.MEMORIZE_SPELLS, false);
    context.unconditionallyProcess(arcaneClass.getOriginalClassLevel(1), "KNOWN", "4,2,1");
    context.unconditionallyProcess(arcaneClass.getOriginalClassLevel(1), "CAST", "3,1,0");
    context.getReferenceContext().importObject(arcaneClass);
    divineClass = new PCClass();
    divineClass.setName("TestDivine");
    BuildUtilities.setFact(divineClass, "SpellType", "Divine");
    context.unconditionallyProcess(divineClass, "SPELLSTAT", "WIS");
    divineClass.put(ObjectKey.SPELLBOOK, false);
    divineClass.put(ObjectKey.MEMORIZE_SPELLS, true);
    context.unconditionallyProcess(divineClass.getOriginalClassLevel(1), "CAST", "3,1,0");
    context.unconditionallyProcess(divineClass, "SPELLLEVEL", "CLASS|SPELLCASTER.Divine=1|Cure Light Wounds");
    context.getReferenceContext().importObject(divineClass);
    context.resolveDeferredTokens();
    context.getReferenceContext().buildDerivedObjects();
    context.getReferenceContext().resolveReferences(null);
}
Also used : BonusObj(pcgen.core.bonus.BonusObj) Race(pcgen.core.Race) BonusSpellInfo(pcgen.cdom.content.BonusSpellInfo) LoadContext(pcgen.rules.context.LoadContext) URISyntaxException(java.net.URISyntaxException) UnreachableError(pcgen.base.lang.UnreachableError) PCClass(pcgen.core.PCClass) URI(java.net.URI) SimpleLoader(pcgen.persistence.lst.SimpleLoader)

Aggregations

URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 UnreachableError (pcgen.base.lang.UnreachableError)1 BonusSpellInfo (pcgen.cdom.content.BonusSpellInfo)1 PCClass (pcgen.core.PCClass)1 Race (pcgen.core.Race)1 BonusObj (pcgen.core.bonus.BonusObj)1 SimpleLoader (pcgen.persistence.lst.SimpleLoader)1 LoadContext (pcgen.rules.context.LoadContext)1