use of pcgen.cdom.base.BonusContainer in project pcgen by PCGen.
the class BonusManager method getAllActiveBonuses.
private Map<BonusObj, Object> getAllActiveBonuses() {
Map<BonusObj, Object> ret = new IdentityHashMap<>();
for (final BonusContainer pobj : pc.getBonusContainerList()) {
// the equipment they belong to.
if (pobj != null && !(pobj instanceof EquipmentModifier)) {
boolean use = true;
if (pobj instanceof PCClass) {
// Class bonuses are only included if the level is greater
// than 0
// This is because 0 levels of a class can be added to
// access spell casting etc
use = pc.getLevel(((PCClass) pobj)) > 0;
}
if (use) {
pobj.activateBonuses(pc);
List<BonusObj> abs = pobj.getActiveBonuses(pc);
for (BonusObj bo : abs) {
ret.put(bo, pobj);
}
}
}
}
if (pc.getUseTempMods()) {
ret.putAll(getTempBonuses());
}
return ret;
}
Aggregations