use of pcgen.cdom.facet.BonusCheckingFacet in project pcgen by PCGen.
the class ReachFacetTest method getMockFacet.
public ReachFacet getMockFacet() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
ReachFacet f = new ReachFacet();
Field field = ReachFacet.class.getDeclaredField("bonusCheckingFacet");
field.setAccessible(true);
BonusCheckingFacet fakeFacet = new BonusCheckingFacet() {
@Override
public double getBonus(CharID cid, String bonusType, String bonusName) {
if ("COMBAT".equals(bonusType) && "REACH".equals(bonusName)) {
Double d = bonusInfo.get(cid);
return d == null ? 0 : d;
}
return 0;
}
};
field.set(f, fakeFacet);
return f;
}
use of pcgen.cdom.facet.BonusCheckingFacet in project pcgen by PCGen.
the class SizeFacetTest method getMockFacet.
public SizeFacet getMockFacet() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
SizeFacet f = new SizeFacet();
Field field = SizeFacet.class.getDeclaredField("bonusCheckingFacet");
field.setAccessible(true);
BonusCheckingFacet fakeFacet = new BonusCheckingFacet() {
@Override
public double getBonus(CharID cid, String bonusType, String bonusName) {
if ("SIZEMOD".equals(bonusType) && "NUMBER".equals(bonusName)) {
Double d = bonusInfo.get(cid);
return d == null ? 0 : d;
}
return 0;
}
};
field.set(f, fakeFacet);
field = SizeFacet.class.getDeclaredField("levelFacet");
field.setAccessible(true);
LevelFacet fakeLevelFacet = new LevelFacet() {
@Override
public int getMonsterLevelCount(CharID cid) {
return fakeLevels;
}
};
field.set(f, fakeLevelFacet);
return f;
}
use of pcgen.cdom.facet.BonusCheckingFacet in project pcgen by PCGen.
the class InitiativeFacetTest method getMockFacet.
public InitiativeFacet getMockFacet() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
InitiativeFacet f = new InitiativeFacet();
Field field = InitiativeFacet.class.getDeclaredField("bonusCheckingFacet");
field.setAccessible(true);
BonusCheckingFacet fakeFacet = new BonusCheckingFacet() {
@Override
public double getBonus(CharID cid, String bonusType, String bonusName) {
if ("COMBAT".equals(bonusType) && "Initiative".equals(bonusName)) {
Double d = bonusInfo.get(cid);
return d == null ? 0 : d;
}
return 0;
}
};
field.set(f, fakeFacet);
Field field2 = InitiativeFacet.class.getDeclaredField("initcomp");
field2.setAccessible(true);
field2.set(f, FormulaFactory.getFormulaFor("2"));
return f;
}
Aggregations