Search in sources :

Example 11 with CompanionMod

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;
}
Also used : CompanionMod(pcgen.core.character.CompanionMod)

Example 12 with CompanionMod

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;
}
Also used : CompanionMod(pcgen.core.character.CompanionMod)

Example 13 with CompanionMod

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;
}
Also used : CompanionMod(pcgen.core.character.CompanionMod)

Example 14 with CompanionMod

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;
}
Also used : Race(pcgen.core.Race) RaceType(pcgen.cdom.enumeration.RaceType) PCTemplate(pcgen.core.PCTemplate) CompanionMod(pcgen.core.character.CompanionMod)

Example 15 with CompanionMod

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));
}
Also used : Race(pcgen.core.Race) CompanionMod(pcgen.core.character.CompanionMod) Test(org.junit.Test)

Aggregations

CompanionMod (pcgen.core.character.CompanionMod)16 Test (org.junit.Test)6 Race (pcgen.core.Race)4 HashMap (java.util.HashMap)2 Map (java.util.Map)2 CDOMSingleRef (pcgen.cdom.reference.CDOMSingleRef)2 PCTemplate (pcgen.core.PCTemplate)2 ArrayList (java.util.ArrayList)1 ChooseInformation (pcgen.cdom.base.ChooseInformation)1 LevelCommandFactory (pcgen.cdom.content.LevelCommandFactory)1 RaceType (pcgen.cdom.enumeration.RaceType)1 Type (pcgen.cdom.enumeration.Type)1 CompanionList (pcgen.cdom.list.CompanionList)1 Follower (pcgen.core.character.Follower)1 ParseResult (pcgen.rules.persistence.token.ParseResult)1 AbstractContentTokenTest (tokencontent.testsupport.AbstractContentTokenTest)1 AbstractTokenModelTest (tokenmodel.testsupport.AbstractTokenModelTest)1