use of pcgen.core.PCClass in project pcgen by PCGen.
the class DomainSpellsFacet method dataAdded.
/**
* Adds Domain Spells allowed / granted to the Player Character due to the
* Domain selections of the Player Character.
*
* Triggered when one of the Facets to which DomainSpellsFacet listens fires
* a DataFacetChangeEvent to indicate a Domain was added to a Player
* Character.
*
* @param dfce
* The DataFacetChangeEvent containing the information about the
* change
*
* @see pcgen.cdom.facet.event.DataFacetChangeListener#dataAdded(pcgen.cdom.facet.event.DataFacetChangeEvent)
*/
@Override
public void dataAdded(DataFacetChangeEvent<CharID, Domain> dfce) {
Domain domain = dfce.getCDOMObject();
CharID id = dfce.getCharID();
ClassSource source = domainFacet.getSource(id, domain);
if (source != null) {
String classKey = source.getPcclass().getKeyName();
PCClass domainClass = getClassKeyed(id, classKey);
if (domainClass != null) {
PlayerCharacter pc = trackingFacet.getPC(id);
final int maxLevel = pc.getSpellSupport(domainClass).getMaxCastLevel();
DomainApplication.addSpellsToClassForLevels(pc, domain, domainClass, 0, maxLevel);
}
}
}
use of pcgen.core.PCClass 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.PCClass in project pcgen by PCGen.
the class PCMaxCastableDomainTermEvaluator method resolve.
@Override
public Float resolve(PlayerCharacter pc) {
Domain domain = Globals.getContext().getReferenceContext().silentlyGetConstructedCDOMObject(Domain.class, domainKey);
if (domain == null) {
return 0.0f;
}
ClassSource source = pc.getDomainSource(domain);
if (source == null) {
return 0.0f;
}
String classKey = source.getPcclass().getKeyName();
PCClass spClass = pc.getClassKeyed(classKey);
int cutoff = pc.getSpellSupport(spClass).getHighestLevelSpell();
Float max = 0.0f;
if (pc.getSpellSupport(spClass).hasCastList()) {
for (int i = 0; i < cutoff; i++) {
if (pc.getSpellSupport(spClass).getCastForLevel(i, pc) != 0) {
max = Math.max(max, i);
}
}
} else {
for (int i = 0; i < cutoff; i++) {
if (pc.getSpellSupport(spClass).getKnownForLevel(i, pc) != 0) {
max = Math.max(max, i);
}
}
}
return max;
}
use of pcgen.core.PCClass in project pcgen by PCGen.
the class PCMaxLevelTermEvaluator method resolve.
@Override
public Float resolve(PlayerCharacter pc) {
if (classKey.isEmpty()) {
return 0.0f;
}
PCClass aClass = pc.getClassKeyed(classKey);
if (aClass == null) {
//PC Doesn't have class
return 0.0f;
}
int level = pc.getSpellSupport(aClass).getMaxSpellLevelForClassLevel(pc.getDisplay().getLevel(aClass));
return Integer.valueOf(level).floatValue();
}
use of pcgen.core.PCClass in project pcgen by PCGen.
the class PCSPellBaseStatScoreEvaluatorTermEvaluator method resolve.
@Override
public Float resolve(PlayerCharacter pc) {
final PCClass aClass = pc.getClassKeyed(classKey);
if (aClass == null) {
return 0.0f;
}
CDOMSingleRef<PCStat> ss = aClass.get(ObjectKey.SPELL_STAT);
if (ss == null) {
return 10.0f;
}
return (float) pc.getDisplay().getStatModFor(ss.get());
}
Aggregations