Search in sources :

Example 1 with PCCheck

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

the class FreeMarkerTest method createChecks.

private void createChecks() {
    StringManager sm = new StringManager();
    FactKey<String> sn = FactKey.getConstant("ShortName", sm);
    PCCheck pcc = new PCCheck();
    pcc.setName("Willpower");
    pcc.put(sn, new BasicIndirect<>(sm, "Will"));
    cf.add(id, pcc);
    pcc = new PCCheck();
    pcc.setName("Reflex");
    pcc.put(sn, new BasicIndirect<>(sm, "Ref"));
    cf.add(id, pcc);
    pcc = new PCCheck();
    pcc.setName("Fortitude");
    pcc.put(sn, new BasicIndirect<>(sm, "Fort"));
    cf.add(id, pcc);
    FactKeyActor<?> fka = new FactKeyActor<>(sn);
    CDOMObjectWrapper.load(dsid, pcc.getClass(), "shortname", fka);
}
Also used : FactKeyActor(pcgen.output.actor.FactKeyActor) PCCheck(pcgen.core.PCCheck) StringManager(pcgen.base.format.StringManager)

Example 2 with PCCheck

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

the class CheckBonusFacet method getCheckBonusTo.

/**
	 * Returns the Bonus value provided solely by Checks, for a given Bonus type
	 * and Bonus name on the Player Character identified by the given CharID.
	 * 
	 * @param id
	 *            CharId identifying the Player Character for which the Bonus
	 *            value will be returned
	 * @param type
	 *            The Bonus type for which the Bonus value will be returned
	 * @param name
	 *            The Bonus name for which the Bonus value will be returned
	 * @return The Bonus value provided solely by Checks, for a given Bonus type
	 *         and Bonus name on the Player Character identified by the given
	 *         CharID
	 * @deprecated by STATMODSAVE Code Control
	 */
@Deprecated
public double getCheckBonusTo(CharID id, String type, String name) {
    double bonus = 0;
    String upperType = type.toUpperCase();
    String upperName = name.toUpperCase();
    for (PCCheck check : checkFacet.getSet(id)) {
        List<BonusObj> tempList = BonusUtilities.getBonusFromList(check.getListFor(ListKey.BONUS), upperType, upperName);
        if (!tempList.isEmpty()) {
            bonus += bonusCheckingFacet.getAllBonusValues(id, tempList, check.getQualifiedKey());
        }
    }
    return bonus;
}
Also used : BonusObj(pcgen.core.bonus.BonusObj) PCCheck(pcgen.core.PCCheck)

Example 3 with PCCheck

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

the class AbstractGrantedListTokenTest method testFromCheck.

@Test
public void testFromCheck() throws PersistenceLayerException {
    PCCheck source = create(PCCheck.class, "Source");
    T granted = createGrantedObject();
    processToken(source);
    /*
		 * We never get a chance to test zero since the Checks are added at
		 * Player Character Construction :)
		 */
    assertTrue(containsExpected(granted));
    assertEquals(1, getCount());
    checkFacet.remove(id, source);
    assertEquals(0, getCount());
    assertTrue(cleanedSideEffects());
}
Also used : PCCheck(pcgen.core.PCCheck) Test(org.junit.Test)

Example 4 with PCCheck

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

the class PreCheckTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    LoadContext context = Globals.getContext();
    PCCheck obj = new PCCheck();
    obj.setName("Fortitude");
    Globals.getContext().getReferenceContext().importObject(obj);
    obj = new PCCheck();
    obj.setName("Reflex");
    Globals.getContext().getReferenceContext().importObject(obj);
    obj = new PCCheck();
    obj.setName("Will");
    Globals.getContext().getReferenceContext().importObject(obj);
    myClass.setName("My Class");
    myClass.put(FormulaKey.START_SKILL_POINTS, FormulaFactory.getFormulaFor(3));
    final BonusObj fortRefBonus = Bonus.newBonus(context, "SAVE|BASE.Fortitude,BASE.Reflex|CL/3");
    myClass.getOriginalClassLevel(1).addToListFor(ListKey.BONUS, fortRefBonus);
    final BonusObj willBonus = Bonus.newBonus(context, "SAVE|BASE.Will|CL/2+2");
    myClass.getOriginalClassLevel(1).addToListFor(ListKey.BONUS, willBonus);
    Globals.getContext().getReferenceContext().importObject(myClass);
}
Also used : BonusObj(pcgen.core.bonus.BonusObj) LoadContext(pcgen.rules.context.LoadContext) PCCheck(pcgen.core.PCCheck)

Example 5 with PCCheck

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

the class PreCheckBaseTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    LoadContext context = Globals.getContext();
    PCCheck obj = new PCCheck();
    obj.setName("Fortitude");
    Globals.getContext().getReferenceContext().importObject(obj);
    obj = new PCCheck();
    obj.setName("Reflex");
    Globals.getContext().getReferenceContext().importObject(obj);
    obj = new PCCheck();
    obj.setName("Will");
    Globals.getContext().getReferenceContext().importObject(obj);
    myClass.setName("My Class");
    myClass.put(FormulaKey.START_SKILL_POINTS, FormulaFactory.getFormulaFor(3));
    final BonusObj fortRefBonus = Bonus.newBonus(context, "SAVE|BASE.Fortitude,BASE.Reflex|CL/3");
    myClass.getOriginalClassLevel(1).addToListFor(ListKey.BONUS, fortRefBonus);
    final BonusObj willBonus = Bonus.newBonus(context, "SAVE|BASE.Will|CL/2+2");
    myClass.getOriginalClassLevel(1).addToListFor(ListKey.BONUS, willBonus);
    Globals.getContext().getReferenceContext().importObject(myClass);
}
Also used : BonusObj(pcgen.core.bonus.BonusObj) LoadContext(pcgen.rules.context.LoadContext) PCCheck(pcgen.core.PCCheck)

Aggregations

PCCheck (pcgen.core.PCCheck)11 Test (org.junit.Test)3 BonusObj (pcgen.core.bonus.BonusObj)3 LoadContext (pcgen.rules.context.LoadContext)2 PcgCombatant (gmgen.plugin.PcgCombatant)1 PlayerCharacterOutput (gmgen.plugin.PlayerCharacterOutput)1 SystemAttribute (gmgen.plugin.SystemAttribute)1 StringManager (pcgen.base.format.StringManager)1 PlayerCharacter (pcgen.core.PlayerCharacter)1 FactKeyActor (pcgen.output.actor.FactKeyActor)1 ParseResult (pcgen.rules.persistence.token.ParseResult)1 XMLCombatant (plugin.initiative.XMLCombatant)1 AbstractContentTokenTest (tokencontent.testsupport.AbstractContentTokenTest)1 AbstractTokenModelTest (tokenmodel.testsupport.AbstractTokenModelTest)1