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);
}
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;
}
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());
}
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);
}
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);
}
Aggregations