Esempio 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);
   }
 }
Esempio 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));
 }
Esempio 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);
   }
 }
Esempio 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);
   }
 }
Esempio 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);
     }
   }
 }
Esempio n. 6
0
 /**
  * Drives the selection of the AgeSet Kit for a Player Character when relevant changes (change to
  * an AgeSet) are made to a Player Character.
  *
  * <p>Triggered when one of the Facets to which AgeSetKitFacet 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, Integer> dfce) {
   CharID id = dfce.getCharID();
   AgeSet ageSet = ageSetFacet.get(id);
   PlayerCharacter pc = trackingFacet.getPC(id);
   // TODO Is ageSet null check necessary?
   if (ageSet == null || pc.isImporting()) {
     return;
   }
   int ageSetIndex = ageSetFacet.getAgeSetIndex(id);
   /*
    * TODO The method of storing what AgeSets have had kit selections made
    * should be converted to store the actual AgeSet rather than the index,
    * in order to reduce the number of calls to ageSetFacet.getAgeSetIndex.
    * This (of course) drives the move of the AgeSets for which a kit
    * selection has been made into a Facet. It is possible that the
    * CacheInfo of AgeSetKitFacet is actually a good place to store that
    * information (or it may be implicit with the information already
    * stored there??)
    */
   if (!pc.hasMadeKitSelectionForAgeSet(ageSetIndex)) {
     CacheInfo cache = getConstructingClassInfo(id);
     List<Kit> kits = cache.get(ageSet);
     if (kits != null) {
       // Need to do selection
       BioSet bioSet = bioSetFacet.get(id);
       for (TransitionChoice<Kit> kit : ageSet.getKits()) {
         Collection<? extends Kit> choice = kit.driveChoice(pc);
         cache.put(ageSet, choice);
         kit.act(choice, bioSet, pc);
       }
     }
     pc.setHasMadeKitSelectionForAgeSet(ageSetIndex, true);
   }
 }
 @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);
             }
           }
         }
       }
     }
   }
 }
Esempio n. 8
0
 /**
  * Drives the identification of the active AgeSet for a Player Character when certain changes are
  * made to a Player Character.
  *
  * <p>Triggered when one of the Facets to which AgeSetFacet 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, Object> dfce) {
   update(dfce.getCharID());
 }
Esempio n. 9
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());
 }