use of pcgen.core.character.CompanionMod in project pcgen by PCGen.
the class CompanionModFacetTest method getObject.
@Override
protected CompanionMod getObject() {
CompanionMod t = new CompanionMod();
t.put(IntegerKey.LEVEL, n);
t.setName("CompanionMod" + n++);
return t;
}
use of pcgen.core.character.CompanionMod in project pcgen by PCGen.
the class CompanionList method resolve.
@Override
public boolean resolve(ReferenceManufacturer<CompanionMod> rm, String name, CDOMSingleRef<CompanionMod> reference, UnconstructedValidator validator) {
boolean returnGood = true;
CompanionMod activeObj = rm.getObject(name);
if (activeObj == null) {
// Wasn't constructed!
if (name.charAt(0) != '*' && !report(validator, name)) {
Logging.errorPrint("Unconstructed Reference: " + getReferenceDescription() + " " + name);
rm.fireUnconstuctedEvent(reference);
returnGood = false;
}
activeObj = rm.buildObject(name);
}
reference.addResolution(activeObj);
return returnGood;
}
use of pcgen.core.character.CompanionMod in project pcgen by PCGen.
the class CompanionList method newInstance.
@Override
public CompanionMod newInstance() {
CompanionMod mod = new CompanionMod();
mod.setCDOMCategory(this);
return mod;
}
use of pcgen.core.character.CompanionMod in project pcgen by PCGen.
the class RaceTypeFacet method getRaceType.
/**
* Returns the RaceType of the Player Character represented by the given
* CharID.
*
* @param id
* The CharID representing the Player Character for which the
* RaceType will be returned
* @return The RaceType of the Player Character represented by the given
* CharID.
*/
public RaceType getRaceType(CharID id) {
RaceType raceType = null;
Race race = raceFacet.get(id);
if (race != null) {
RaceType rt = race.get(ObjectKey.RACETYPE);
if (rt != null) {
raceType = rt;
}
}
for (CompanionMod cm : companionModFacet.getSet(id)) {
RaceType rt = cm.get(ObjectKey.RACETYPE);
if (rt != null) {
raceType = rt;
}
}
for (PCTemplate t : templateFacet.getSet(id)) {
RaceType rt = t.get(ObjectKey.RACETYPE);
if (rt != null) {
raceType = rt;
}
}
return raceType;
}
use of pcgen.core.character.CompanionMod in project pcgen by PCGen.
the class RaceTypeFacetTest method testGetFromCMod.
@Test
public void testGetFromCMod() {
rfacet.set(id, new Race());
CompanionMod c = new CompanionMod();
c.put(ObjectKey.RACETYPE, TEST_RACE_TYPE);
cfacet.add(id, c);
assertSame(TEST_RACE_TYPE, facet.getRaceType(id));
cfacet.remove(id, c);
assertNull(facet.getRaceType(id));
}
Aggregations