protected void finishLoad() {
   context.commit();
   SourceFileLoader.processFactDefinitions(context);
   context.getReferenceContext().buildDeferredObjects();
   context.getReferenceContext().buildDerivedObjects();
   context.resolveDeferredTokens();
   assertTrue(context.getReferenceContext().resolveReferences(null));
   context.resolvePostDeferredTokens();
   context.loadCampaignFacets();
   pc = new PlayerCharacter();
   id = pc.getCharID();
 }
Пример #2
0
  /*
   * @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>(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");
    arcaneClass.put(StringKey.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");
    divineClass.put(StringKey.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);
  }