Search in sources :

Example 1 with SAProcessor

use of pcgen.cdom.helper.SAProcessor in project pcgen by PCGen.

the class SpecialAbilityFacet method getResolved.

/**
	 * Returns a non-null copy of the List of resolved SpecialAbility objects
	 * for the given source CDOMObject and the Player Character represented by
	 * the given CharID. The Player Character must qualify for the Special
	 * Ability (if it has prerequisites) in order for the resolved
	 * SpecialAbility to be returned by this method. This method returns an
	 * empty List if no SpecialAbility objects are in this SpecialAbilityFacet
	 * for the given source CDOMObject and the Player Character identified by
	 * the given CharID.
	 * 
	 * This method is value-semantic in that ownership of the returned List is
	 * transferred to the class calling this method. Modification of the
	 * returned List will not modify this SpecialAbilityFacet and modification
	 * of this SpecialAbilityFacet will not modify the returned List.
	 * Modifications to the returned List will also not modify any future or
	 * previous objects returned by this (or other) methods on
	 * SpecialAbilityFacet. If you wish to modify the information stored in this
	 * SpecialAbilityFacet, you must use the add*() and remove*() methods of
	 * SpecialAbilityFacet.
	 * 
	 * @param id
	 *            The CharID representing the Player Character for which a copy
	 *            of the resolved items in this SpecialAbilityFacet should be
	 *            returned
	 * @param source
	 *            The source of the SpecialAbility objects for this
	 *            SpecialAbilityFacet to be used for the resolution of the
	 *            SpecialAbility objects in the Player Character
	 * @return A non-null List of resolved SpecialAbility objects from this
	 *         SpecialAbilityFacet for the Player Character represented by the
	 *         given CharID
	 */
public List<SpecialAbility> getResolved(CharID id, Object source) {
    List<SpecialAbility> returnList = new ArrayList<>();
    SAProcessor proc = new SAProcessor(trackingFacet.getPC(id));
    for (SpecialAbility sa : getQualifiedSet(id, source)) {
        returnList.add(proc.act(sa, source));
    }
    return returnList;
}
Also used : ArrayList(java.util.ArrayList) SpecialAbility(pcgen.core.SpecialAbility) SAProcessor(pcgen.cdom.helper.SAProcessor)

Example 2 with SAProcessor

use of pcgen.cdom.helper.SAProcessor in project pcgen by PCGen.

the class UserSpecialAbilityFacet method getResolved.

/**
	 * Returns a non-null copy of the List of resolved SpecialAbility objects
	 * for the given source CDOMObject and the Player Character represented by
	 * the given CharID. The Player Character must qualify for the Special
	 * Ability (if it has prerequisites) in order for the resolved
	 * SpecialAbility to be returned by this method. This method returns an
	 * empty List if no SpecialAbility objects are in this
	 * UserSpecialAbilityFacet for the given source CDOMObject and the Player
	 * Character identified by the given CharID.
	 * 
	 * This method is value-semantic in that ownership of the returned List is
	 * transferred to the class calling this method. Modification of the
	 * returned List will not modify this UserSpecialAbilityFacet and
	 * modification of this UserSpecialAbilityFacet will not modify the returned
	 * List. Modifications to the returned List will also not modify any future
	 * or previous objects returned by this (or other) methods on
	 * UserSpecialAbilityFacet. If you wish to modify the information stored in
	 * this UserSpecialAbilityFacet, you must use the add*() and remove*()
	 * methods of UserSpecialAbilityFacet.
	 * 
	 * @param id
	 *            The CharID representing the Player Character for which a copy
	 *            of the resolved items in this UserSpecialAbilityFacet should
	 *            be returned
	 * @param source
	 *            The source of the SpecialAbility objects for this
	 *            UserSpecialAbilityFacet to be used for the resolution of the
	 *            SpecialAbility objects in the Player Character
	 * @return A non-null List of resolved SpecialAbility objects from this
	 *         UserSpecialAbilityFacet for the Player Character represented by
	 *         the given CharID
	 */
public List<SpecialAbility> getResolved(CharID id, Object source) {
    List<SpecialAbility> returnList = new ArrayList<>();
    SAProcessor proc = new SAProcessor(trackingFacet.getPC(id));
    for (SpecialAbility sa : getQualifiedSet(id, source)) {
        returnList.add(proc.act(sa, source));
    }
    return returnList;
}
Also used : ArrayList(java.util.ArrayList) SpecialAbility(pcgen.core.SpecialAbility) SAProcessor(pcgen.cdom.helper.SAProcessor)

Aggregations

ArrayList (java.util.ArrayList)2 SAProcessor (pcgen.cdom.helper.SAProcessor)2 SpecialAbility (pcgen.core.SpecialAbility)2