Ejemplo n.º 1
0
 /**
  * Adds the FollowerLimit objects granted by CDOMObjects added to the Player Character to this
  * FollowerLimitFacet.
  *
  * <p>Triggered when one of the Facets to which FollowerOptionFacet listens fires a
  * DataFacetChangeEvent to indicate a FollowerOption 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<CDOMObject> dfce) {
   CDOMObject cdo = dfce.getCDOMObject();
   List<FollowerLimit> followers = cdo.getListFor(ListKey.FOLLOWERS);
   if (followers != null) {
     addAll(dfce.getCharID(), followers, cdo);
   }
 }
Ejemplo n.º 2
0
 /**
  * Removes all of the conditional Templates granted by the object removed from the Player
  * Character.
  *
  * <p>Triggered when one of the Facets to which ConditionalTemplateFacet listens fires a
  * DataFacetChangeEvent to indicate a PCTemplate was removed from a Player Character.
  *
  * @param dfce The DataFacetChangeEvent containing the information about the change
  * @see
  *     pcgen.cdom.facet.event.DataFacetChangeListener#dataRemoved(pcgen.cdom.facet.event.DataFacetChangeEvent)
  */
 @Override
 public void dataRemoved(DataFacetChangeEvent<CharID, PCTemplate> dfce) {
   CharID id = dfce.getCharID();
   int totalLevels = levelFacet.getTotalLevels(id);
   int totalHitDice = levelFacet.getMonsterLevelCount(id);
   PCTemplate source = dfce.getCDOMObject();
   removeAll(dfce.getCharID(), source.getConditionalTemplates(totalLevels, totalHitDice));
 }
Ejemplo n.º 3
0
 /**
  * Adds a PCStat to this facet if the PCStat was set to a non stat by a CDOMObject which has been
  * added to a Player Character.
  *
  * <p>Triggered when one of the Facets to which NonStatToStatFacet 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();
   List<PCStat> locks = cdo.getListFor(ListKey.NONSTAT_TO_STAT_STATS);
   if (locks != null) {
     addAll(dfce.getCharID(), locks, cdo);
   }
 }
Ejemplo n.º 4
0
 /**
  * Stores in this facet any Unarmed Damage information from a CDOMObject which has been added to a
  * Player Character.
  *
  * <p>Triggered when one of the Facets to which UnarmedDamageFacet 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();
   if (cdo instanceof PCClass || cdo instanceof PCClassLevel) {
     return;
   }
   List<String> damage = cdo.getListFor(ListKey.UNARMED_DAMAGE);
   if (damage != null) {
     add(dfce.getCharID(), damage, cdo);
   }
 }
Ejemplo n.º 5
0
 /**
  * Adds the SkillCost objects granted by CDOMObjects added to the Player Character to this
  * GlobalSkillCostFacet.
  *
  * <p>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);
     }
   }
 }
Ejemplo n.º 6
0
 @Override
 public void dataAdded(DataFacetChangeEvent<CharID, VarScoped> dfce) {
   CharID id = dfce.getCharID();
   VarScoped vs = dfce.getCDOMObject();
   /*
    * If this can have local variables, find what may have been modified by
    * previous objects
    */
   for (RemoteModifier<?> rm : getSet(id)) {
     VarScoped src = get(id, rm);
     ScopeInstance inst = scopeFacet.get(id, src);
     processAdd(id, rm, vs, inst);
     if (vs instanceof Equipment) {
       Equipment e = (Equipment) vs;
       for (EquipmentHead head : e.getEquipmentHeads()) {
         processAdd(id, rm, head, inst);
       }
     }
   }
   /*
    * Look at what newly added object can modify on others
    */
   if (vs instanceof CDOMObject) {
     ScopeInstance inst = scopeFacet.get(id, vs);
     List<RemoteModifier<?>> list = ((CDOMObject) vs).getListFor(ListKey.REMOTE_MODIFIER);
     if (list != null) {
       Set<? extends VarScoped> targets = varScopedFacet.getSet(id);
       for (RemoteModifier<?> rm : list) {
         set(id, rm, vs);
         // Apply to existing as necessary
         for (VarScoped obj : targets) {
           processAdd(id, rm, obj, inst);
           if (obj instanceof Equipment) {
             Equipment e = (Equipment) obj;
             for (EquipmentHead head : e.getEquipmentHeads()) {
               processAdd(id, rm, head, inst);
             }
           }
         }
       }
     }
   }
 }
Ejemplo n.º 7
0
 /**
  * Removes from this facet any Unarmed Damage information from a CDOMObject which has been removed
  * from a Player Character.
  *
  * <p>Triggered when one of the Facets to which UnarmedDamageFacet listens fires a
  * DataFacetChangeEvent to indicate a CDOMObject was removed from a Player Character.
  *
  * @param dfce The DataFacetChangeEvent containing the information about the change
  * @see
  *     pcgen.cdom.facet.event.DataFacetChangeListener#dataRemoved(pcgen.cdom.facet.event.DataFacetChangeEvent)
  */
 @Override
 public void dataRemoved(DataFacetChangeEvent<CharID, CDOMObject> dfce) {
   removeAll(dfce.getCharID(), dfce.getCDOMObject());
 }