Search in sources :

Example 66 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class PreTemplateTest method test990007_5.

/**
	 * Ensure a character with the requested template correctly passes
	 * a wildcard test
	 */
public void test990007_5() {
    final PlayerCharacter character = getCharacter();
    final PCTemplate template = new PCTemplate();
    template.setName("Half-Dragon");
    Globals.getContext().getReferenceContext().importObject(template);
    character.addTemplate(template);
    final PCTemplate template2 = new PCTemplate();
    template2.setName("Half-Celestial");
    Globals.getContext().getReferenceContext().importObject(template2);
    character.addTemplate(template2);
    final Prerequisite prereq = new Prerequisite();
    prereq.setKind("template");
    prereq.setKey("half%");
    prereq.setOperator(PrerequisiteOperator.GTEQ);
    prereq.setOperand("1");
    final boolean passes = PrereqHandler.passes(prereq, character, null);
    assertTrue(passes);
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) PCTemplate(pcgen.core.PCTemplate)

Example 67 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class PreTypeTest method test996803_4.

public void test996803_4() {
    final PlayerCharacter character = getCharacter();
    final PCTemplate template = new PCTemplate();
    template.setName("Fiendish");
    template.addToListFor(ListKey.TYPE, Type.getConstant("Magical-Beast"));
    character.addTemplate(template);
    final Prerequisite prereq = new Prerequisite();
    prereq.setKind("type");
    prereq.setKey("Outsider");
    prereq.setOperand("1");
    prereq.setOperator(PrerequisiteOperator.NEQ);
    final boolean passes = PrereqHandler.passes(prereq, character, null);
    assertTrue(passes);
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) PCTemplate(pcgen.core.PCTemplate)

Example 68 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class PreTypeTest method test996803_1.

/**
	 * Ensure a character with a template correctly passes
	 * PRETEMPLATE
	 */
public void test996803_1() {
    final PlayerCharacter character = getCharacter();
    final PCTemplate template = new PCTemplate();
    template.setName("Half-Celestial");
    template.addToListFor(ListKey.TYPE, Type.getConstant("Outsider"));
    character.addTemplate(template);
    final Prerequisite prereq = new Prerequisite();
    prereq.setKind("type");
    prereq.setKey("Outsider");
    prereq.setOperand("1");
    prereq.setOperator(PrerequisiteOperator.EQ);
    final boolean passes = PrereqHandler.passes(prereq, character, null);
    assertTrue(passes);
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) PCTemplate(pcgen.core.PCTemplate)

Example 69 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class ReachFacetTest method testGetFromTemplateLowerOverridesRace.

@Test
public void testGetFromTemplateLowerOverridesRace() {
    Race r = new Race();
    r.put(IntegerKey.REACH, 5);
    rfacet.set(id, r);
    PCTemplate t = new PCTemplate();
    t.put(IntegerKey.REACH, 3);
    tfacet.add(id, t, this);
    assertEquals(3, facet.getReach(id));
    tfacet.remove(id, t, this);
    assertEquals(5, facet.getReach(id));
}
Also used : Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Example 70 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class SubRaceFacetTest method testUseTemplateNameFalse.

@Test
public void testUseTemplateNameFalse() {
    PCTemplate pct = new PCTemplate();
    pct.setName("TestTemplate");
    pct.put(ObjectKey.USETEMPLATENAMEFORSUBRACE, false);
    tfacet.add(id, pct, this);
    assertNull(facet.getSubRace(id));
    tfacet.remove(id, pct, this);
    assertNull(facet.getSubRace(altid));
}
Also used : PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Aggregations

PCTemplate (pcgen.core.PCTemplate)215 Test (org.junit.Test)105 Race (pcgen.core.Race)66 PlayerCharacter (pcgen.core.PlayerCharacter)38 CDOMObject (pcgen.cdom.base.CDOMObject)31 ArrayList (java.util.ArrayList)19 CharID (pcgen.cdom.enumeration.CharID)18 ParseResult (pcgen.rules.persistence.token.ParseResult)14 SimpleAssociatedObject (pcgen.cdom.base.SimpleAssociatedObject)13 Vision (pcgen.core.Vision)12 LoadContext (pcgen.rules.context.LoadContext)12 PCClass (pcgen.core.PCClass)11 StringTokenizer (java.util.StringTokenizer)10 VariableKey (pcgen.cdom.enumeration.VariableKey)8 DataFacetChangeEvent (pcgen.cdom.facet.event.DataFacetChangeEvent)8 Ability (pcgen.core.Ability)8 Formula (pcgen.base.formula.Formula)6 Equipment (pcgen.core.Equipment)6 PCStat (pcgen.core.PCStat)6 AbstractTokenModelTest (tokenmodel.testsupport.AbstractTokenModelTest)6