use of pcgen.core.Skill in project pcgen by PCGen.
the class SkillToken method getToken.
/**
* @see pcgen.io.exporttoken.Token#getToken(java.lang.String, pcgen.core.PlayerCharacter, pcgen.io.ExportHandler)
*/
@Override
public String getToken(String tokenSource, PlayerCharacter pc, ExportHandler eh) {
SkillDetails details = buildSkillDetails(tokenSource);
Skill aSkill = getSkill(pc, details, eh);
return getSkillProperty(aSkill, details.getProperty(0), pc);
}
use of pcgen.core.Skill in project pcgen by PCGen.
the class SkillpointsToken method getUsedSkillPoints.
/**
* Get the used skill points for the PC
* @param pc
* @return the used skill points for the PC
*/
public static int getUsedSkillPoints(PlayerCharacter pc) {
float usedPoints = 0;
for (Skill aSkill : pc.getDisplay().getSkillSet()) {
for (PCClass pcc : pc.getSkillRankClasses(aSkill)) {
Double rank = pc.getSkillRankForClass(aSkill, pcc);
if (rank == null) {
rank = 0.0d;
}
SkillCost skillCost = pc.getSkillCostForClass(aSkill, pcc);
usedPoints += (rank * skillCost.getCost());
}
}
return (int) usedPoints;
}
use of pcgen.core.Skill in project pcgen by PCGen.
the class GlobalSkillCostFacet method dataAdded.
/**
* Adds the SkillCost objects granted by CDOMObjects added to the Player
* Character to this GlobalSkillCostFacet.
*
* Triggered when one of the Facets to which GlobalSkillCostFacet listens
* fires a DataFacetChangeEvent to indicate a CDOMObject 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, CDOMObject> dfce) {
CDOMObject cdo = dfce.getCDOMObject();
CharID id = dfce.getCharID();
for (CDOMReference<Skill> ref : cdo.getSafeListFor(ListKey.CSKILL)) {
for (Skill sk : ref.getContainedObjects()) {
add(id, SkillCost.CLASS, sk, cdo);
}
}
for (CDOMReference<Skill> ref : cdo.getSafeListFor(ListKey.CCSKILL)) {
for (Skill sk : ref.getContainedObjects()) {
add(id, SkillCost.CROSS_CLASS, sk, cdo);
}
}
}
use of pcgen.core.Skill in project pcgen by PCGen.
the class GlobalToSkillCostFacet method dataRemoved.
@Override
public void dataRemoved(DataFacetChangeEvent<CharID, PCClass> dfce) {
CharID id = dfce.getCharID();
PCClass cl = dfce.getCDOMObject();
DataSetID dsID = id.getDatasetID();
for (Skill sk : masterUsableSkillFacet.getSet(dsID)) {
remove(id, cl, SkillCost.CROSS_CLASS, sk, masterUsableSkillFacet);
}
for (SkillCost cost : globalSkillCostFacet.getScopes(id)) {
for (Skill sk : globalSkillCostFacet.getSet(id, cost)) {
remove(id, cl, cost, sk, globalSkillCostFacet);
}
}
for (SkillCost cost : globalAddedSkillCostFacet.getScopes(id)) {
for (Skill sk : globalAddedSkillCostFacet.getSet(id, cost)) {
remove(id, cl, cost, sk, globalAddedSkillCostFacet);
}
}
}
use of pcgen.core.Skill in project pcgen by PCGen.
the class GlobalToSkillCostFacet method dataRemoved.
@Override
public void dataRemoved(ScopeFacetChangeEvent<CharID, SkillCost, Skill> dfce) {
CharID id = dfce.getCharID();
SkillCost cost = dfce.getScope();
Skill sk = dfce.getCDOMObject();
Object source = dfce.getSource();
for (PCClass cl : classFacet.getSet(id)) {
remove(id, cl, cost, sk, source);
}
}
Aggregations