use of pcgen.cdom.base.CDOMObject in project pcgen by PCGen.
the class ShieldProfTokenTest method constructTyped.
@Override
protected CDOMObject constructTyped(LoadContext loadContext, String one) {
CDOMObject cdo = loadContext.getReferenceContext().constructCDOMObject(Equipment.class, one);
cdo.addToListFor(ListKey.TYPE, Type.getConstant("Shield"));
return cdo;
}
use of pcgen.cdom.base.CDOMObject in project pcgen by PCGen.
the class ShieldProficiencyTokenTest method testValidPc.
/**
* Check that a PC qualifier with a restriction is parsed correctly.
* @throws PersistenceLayerException If an error occurs.
*/
public void testValidPc() throws PersistenceLayerException {
CDOMObject a = (CDOMObject) construct(primaryContext, "DwarvenShield");
a.addToListFor(ListKey.TYPE, Type.getConstant("Exotic"));
CDOMObject c = (CDOMObject) construct(secondaryContext, "Typed1");
c.addToListFor(ListKey.TYPE, Type.getConstant("Exotic"));
runRoundRobin("SHIELDPROFICIENCY|PC[TYPE=Exotic]");
}
use of pcgen.cdom.base.CDOMObject in project pcgen by PCGen.
the class SpellsTokenTest method testValidSubSchool.
/**
* Check that a SubSchool qualifier is parsed correctly.
* @throws PersistenceLayerException If an error occurs.
*/
public void testValidSubSchool() throws PersistenceLayerException {
CDOMObject a = (CDOMObject) construct(primaryContext, "Endure Elements");
a.addToListFor(ListKey.SPELL_SUBSCHOOL, "Summoning");
CDOMObject c = (CDOMObject) construct(secondaryContext, "Remove Curse");
c.addToListFor(ListKey.SPELL_SUBSCHOOL, "Summoning");
runRoundRobin("SPELLS|SUBSCHOOL=Summoning");
}
use of pcgen.cdom.base.CDOMObject in project pcgen by PCGen.
the class SpellsTokenTest method testValidSchool.
/**
* Check that a School qualifier is parsed correctly.
* @throws PersistenceLayerException If an error occurs.
*/
public void testValidSchool() throws PersistenceLayerException {
TokenRegistration.register(new SchoolToken());
SpellSchool schoolA = primaryContext.getReferenceContext().constructNowIfNecessary(SpellSchool.class, "Abjuration");
SpellSchool schoolB = secondaryContext.getReferenceContext().constructNowIfNecessary(SpellSchool.class, "Abjuration");
CDOMObject a = (CDOMObject) construct(primaryContext, "Endure Elements");
a.addToListFor(ListKey.SPELL_SCHOOL, schoolA);
CDOMObject c = (CDOMObject) construct(secondaryContext, "Remove Curse");
c.addToListFor(ListKey.SPELL_SCHOOL, schoolB);
runRoundRobin("SPELLS|SCHOOL=Abjuration");
}
use of pcgen.cdom.base.CDOMObject in project pcgen by PCGen.
the class SpellListKnownToken method getToken.
/**
* @see pcgen.io.exporttoken.Token#getToken(java.lang.String, pcgen.core.PlayerCharacter, pcgen.io.ExportHandler)
*/
@Override
public String getToken(String tokenSource, PlayerCharacter pc, ExportHandler eh) {
StringBuilder retValue = new StringBuilder();
SpellListTokenParams params = new SpellListTokenParams(tokenSource, SpellListToken.SPELLTAG_KNOWN);
final CDOMObject aObject = pc.getSpellClassAtIndex(params.getClassNum());
if (aObject != null) {
retValue.append(Integer.toString(getKnownNum(aObject, params.getLevel(), pc)));
}
return retValue.toString();
}
Aggregations