use of pcgen.core.bonus.BonusObj 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.bonus.BonusObj in project pcgen by PCGen.
the class PCLevelInfo method getBonusSkillPool.
/**
* Calculate the number of bonus skill points added by this level.
*
* @return the number of bonus skill points added by this level
*/
private int getBonusSkillPool(PlayerCharacter aPC) {
int returnValue = 0;
final PCClass aClass = aPC.getClassKeyed(classKeyName);
final String purchaseName = SettingsHandler.getGame().getPurchaseModeMethodName();
if (purchaseName != null) {
PointBuyMethod pbm = SettingsHandler.getGame().getContext().getReferenceContext().silentlyGetConstructedCDOMObject(PointBuyMethod.class, purchaseName);
List<BonusObj> bonusList = BonusUtilities.getBonusFromList(pbm.getBonuses(), "SKILLPOOL", "NUMBER");
returnValue += (int) aPC.calcBonusFromList(bonusList, null);
}
if (aClass != null) {
// These bonuses apply to the level or higher. We have to add and then remove
// the previous to get the effective level bonus
returnValue += (int) aClass.getBonusTo("SKILLPOOL", "NUMBER", classLevel, aPC);
returnValue -= (int) aClass.getBonusTo("SKILLPOOL", "NUMBER", classLevel - 1, aPC);
}
if (classLevel == 1) {
returnValue += (int) aPC.getTotalBonusTo("SKILLPOOL", "CLASS." + classKeyName);
}
returnValue += (int) aPC.getTotalBonusTo("SKILLPOOL", "CLASS." + classKeyName + ";LEVEL." + Integer.toString(classLevel));
returnValue += (int) aPC.getTotalBonusTo("SKILLPOOL", "LEVEL." + aPC.getCharacterLevel(this));
return returnValue;
}
use of pcgen.core.bonus.BonusObj in project pcgen by PCGen.
the class PlayerCharacter method getPObjectWithCostBonusTo.
/**
* Returns a bonus.
*
* @param aList
* @param aType
* @param aName
* @return double
*/
private double getPObjectWithCostBonusTo(final Collection<? extends CDOMObject> aList, final String aType, final String aName) {
double iBonus = 0;
if (aList.isEmpty()) {
return iBonus;
}
for (CDOMObject anObj : aList) {
final List<BonusObj> tempList = BonusUtilities.getBonusFromList(anObj.getBonusList(this), aType, aName);
iBonus += calcBonusWithCostFromList(tempList);
}
return iBonus;
}
use of pcgen.core.bonus.BonusObj in project pcgen by PCGen.
the class BonusActivation method activateBonuses.
public static void activateBonuses(CDOMObject po, PlayerCharacter aPC) {
for (Iterator<BonusObj> ab = po.getRawBonusList(aPC).iterator(); ab.hasNext(); ) {
final BonusObj aBonus = ab.next();
aPC.setApplied(aBonus, aBonus.qualifies(aPC, po));
}
}
use of pcgen.core.bonus.BonusObj in project pcgen by PCGen.
the class TempBonusHelper method removeBonusFromCharacter.
static void removeBonusFromCharacter(PlayerCharacter pc, Equipment aEq, CDOMObject aCreator) {
for (Map.Entry<BonusObj, BonusManager.TempBonusInfo> me : pc.getTempBonusMap().entrySet()) {
BonusObj aBonus = me.getKey();
TempBonusInfo tbi = me.getValue();
Object aC = tbi.source;
if (aCreator != aC) {
continue;
}
Object aT = tbi.target;
if ((aT instanceof Equipment) && (aEq != null)) {
if (aEq.equals(aT)) {
pc.removeTempBonus(aBonus);
pc.removeTempBonusItemList((Equipment) aT);
((Equipment) aT).removeTempBonus(aBonus);
((Equipment) aT).setAppliedName(EMPTY_STRING);
}
} else if ((aT instanceof PlayerCharacter) && (aEq == null)) {
pc.removeTempBonus(aBonus);
}
}
}
Aggregations