Search in sources :

Example 16 with Skill

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);
}
Also used : Skill(pcgen.core.Skill)

Example 17 with Skill

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;
}
Also used : Skill(pcgen.core.Skill) SkillCost(pcgen.cdom.enumeration.SkillCost) PCClass(pcgen.core.PCClass)

Example 18 with Skill

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);
        }
    }
}
Also used : Skill(pcgen.core.Skill) CDOMObject(pcgen.cdom.base.CDOMObject) CharID(pcgen.cdom.enumeration.CharID)

Example 19 with Skill

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);
        }
    }
}
Also used : Skill(pcgen.core.Skill) SkillCost(pcgen.cdom.enumeration.SkillCost) DataSetID(pcgen.cdom.enumeration.DataSetID) PCClass(pcgen.core.PCClass) CharID(pcgen.cdom.enumeration.CharID)

Example 20 with Skill

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);
    }
}
Also used : Skill(pcgen.core.Skill) SkillCost(pcgen.cdom.enumeration.SkillCost) PCClass(pcgen.core.PCClass) CharID(pcgen.cdom.enumeration.CharID)

Aggregations

Skill (pcgen.core.Skill)165 Test (org.junit.Test)60 PCClass (pcgen.core.PCClass)55 ArrayList (java.util.ArrayList)29 CDOMReference (pcgen.cdom.base.CDOMReference)24 CharID (pcgen.cdom.enumeration.CharID)23 SkillCost (pcgen.cdom.enumeration.SkillCost)16 CDOMObject (pcgen.cdom.base.CDOMObject)15 PlayerCharacter (pcgen.core.PlayerCharacter)14 ChoiceSet (pcgen.cdom.base.ChoiceSet)13 ConcretePersistentTransitionChoice (pcgen.cdom.base.ConcretePersistentTransitionChoice)13 ReferenceChoiceSet (pcgen.cdom.choiceset.ReferenceChoiceSet)13 ClassSkillChoiceActor (pcgen.cdom.helper.ClassSkillChoiceActor)13 StringTokenizer (java.util.StringTokenizer)10 ObjectMatchingReference (pcgen.cdom.reference.ObjectMatchingReference)10 Ability (pcgen.core.Ability)10 LoadContext (pcgen.rules.context.LoadContext)9 ClassSkillList (pcgen.cdom.list.ClassSkillList)8 HashSet (java.util.HashSet)7 CNAbility (pcgen.cdom.content.CNAbility)7