Search in sources :

Example 1 with SkillCost

use of pcgen.cdom.enumeration.SkillCost 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 2 with SkillCost

use of pcgen.cdom.enumeration.SkillCost 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)

Example 3 with SkillCost

use of pcgen.cdom.enumeration.SkillCost in project pcgen by PCGen.

the class GlobalToSkillCostFacet method dataAdded.

@Override
public void dataAdded(DataFacetChangeEvent<CharID, PCClass> dfce) {
    CharID id = dfce.getCharID();
    PCClass cl = dfce.getCDOMObject();
    DataSetID dsID = id.getDatasetID();
    for (Skill sk : masterUsableSkillFacet.getSet(dsID)) {
        add(id, cl, SkillCost.CROSS_CLASS, sk, masterUsableSkillFacet);
    }
    for (SkillCost cost : globalSkillCostFacet.getScopes(id)) {
        for (Skill sk : globalSkillCostFacet.getSet(id, cost)) {
            add(id, cl, cost, sk, globalSkillCostFacet);
        }
    }
    for (SkillCost cost : globalAddedSkillCostFacet.getScopes(id)) {
        for (Skill sk : globalAddedSkillCostFacet.getSet(id, cost)) {
            add(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 4 with SkillCost

use of pcgen.cdom.enumeration.SkillCost in project pcgen by PCGen.

the class ListSkillCostFacet method dataAdded.

/**
	 * Adds the SkillCost objects granted by CDOMObjects, as applied directly to
	 * a ClassSkillList, when a CDOMObject is added to a Player Character.
	 * 
	 * Triggered when one of the Facets to which ListSkillCostFacet 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 ref : cdo.getModifiedLists()) {
        List<ClassSkillList> useList = new ArrayList<>();
        for (Object list : ref.getContainedObjects()) {
            if (list instanceof ClassSkillList) {
                useList.add((ClassSkillList) list);
            }
        }
        if (!useList.isEmpty()) {
            Collection<CDOMReference<Skill>> mods = cdo.getListMods(ref);
            for (CDOMReference<Skill> skRef : mods) {
                for (AssociatedPrereqObject apo : (Iterable<AssociatedPrereqObject>) cdo.getListAssociations(ref, skRef)) {
                    SkillCost sc = apo.getAssociation(AssociationKey.SKILL_COST);
                    for (ClassSkillList csl : useList) {
                        for (Skill skill : skRef.getContainedObjects()) {
                            add(id, csl, sc, skill, cdo);
                        }
                    }
                }
            }
        }
    }
}
Also used : SkillCost(pcgen.cdom.enumeration.SkillCost) ArrayList(java.util.ArrayList) CharID(pcgen.cdom.enumeration.CharID) ClassSkillList(pcgen.cdom.list.ClassSkillList) Skill(pcgen.core.Skill) CDOMObject(pcgen.cdom.base.CDOMObject) CDOMObject(pcgen.cdom.base.CDOMObject) AssociatedPrereqObject(pcgen.cdom.base.AssociatedPrereqObject) CDOMReference(pcgen.cdom.base.CDOMReference) AssociatedPrereqObject(pcgen.cdom.base.AssociatedPrereqObject)

Example 5 with SkillCost

use of pcgen.cdom.enumeration.SkillCost in project pcgen by PCGen.

the class ListToSkillCostFacet method dataRemoved.

@Override
public void dataRemoved(SubScopeFacetChangeEvent<ClassSkillList, SkillCost, Skill> dfce) {
    CharID id = dfce.getCharID();
    ClassSkillList skilllist = dfce.getScope1();
    SkillCost cost = dfce.getScope2();
    Skill sk = dfce.getCDOMObject();
    for (PCClass cl : skillListFacet.getScopes(id)) {
        if (skillListFacet.contains(id, cl, skilllist)) {
            remove(id, cl, cost, sk, cl);
        }
    }
}
Also used : Skill(pcgen.core.Skill) SkillCost(pcgen.cdom.enumeration.SkillCost) PCClass(pcgen.core.PCClass) CharID(pcgen.cdom.enumeration.CharID) ClassSkillList(pcgen.cdom.list.ClassSkillList)

Aggregations

SkillCost (pcgen.cdom.enumeration.SkillCost)22 Skill (pcgen.core.Skill)16 PCClass (pcgen.core.PCClass)15 CharID (pcgen.cdom.enumeration.CharID)11 CharacterLevelFacade (pcgen.facade.core.CharacterLevelFacade)4 ArrayList (java.util.ArrayList)3 ClassSkillList (pcgen.cdom.list.ClassSkillList)3 DataSetID (pcgen.cdom.enumeration.DataSetID)2 AssociatedPrereqObject (pcgen.cdom.base.AssociatedPrereqObject)1 CDOMObject (pcgen.cdom.base.CDOMObject)1 CDOMReference (pcgen.cdom.base.CDOMReference)1 SkillSituation (pcgen.cdom.helper.SkillSituation)1 CharacterDisplay (pcgen.core.display.CharacterDisplay)1 PCLevelInfo (pcgen.core.pclevelinfo.PCLevelInfo)1