예제 #1
0
  private void updateTemplateType(Element element, GenericCharacterTemplate characterTemplate)
      throws PersistenceException {
    ITemplateType templateType = new TemplateTypeParser().parse(element);
    characterTemplate.setTemplateType(templateType);

    boolean isLegacy = ElementUtilities.getBooleanAttribute(element, TAG_LEGACY, false);
    characterTemplate.setLegacy(isLegacy);

    ICasteCollection casteCollection = casteCollectionRegistry.get(templateType.getCharacterType());
    if (casteCollection != null) characterTemplate.setCasteCollection(casteCollection);
  }
예제 #2
0
 @Override
 public IComboRestrictions buildComboRules(Element rulesElement) throws CharmException {
   Element comboElement = rulesElement.element(TAG_COMBO);
   if (comboElement == null) {
     return new ComboRestrictions();
   }
   Boolean allAbilities =
       ElementUtilities.getBooleanAttribute(comboElement, ATTRIB_ALL_ABILITIES, false);
   String selectAbilities = comboElement.attributeValue(ATTRIB_SELECT_ABILITIES, "");
   ComboRestrictions comboRules = new ComboRestrictions(allAbilities, selectAbilities);
   Element restrictionElement = comboElement.element(TAG_RESTRICTIONS);
   if (restrictionElement != null) {
     buildRestrictionList(comboRules, restrictionElement);
   }
   return comboRules;
 }
  public GenericRestrictedTraitTemplate[] parseCasteMinimumTraits(
      Element element, List<AllocationMinimumRestriction> list) {
    GenericRestrictedTraitTemplate[] templates;
    List<GenericRestrictedTraitTemplate> limits = new ArrayList<>();
    try {
      caste = element.attributeValue(ATTRIB_CASTE);
      isFreebie = ElementUtilities.getBooleanAttribute(element, TAG_FREEBIE, false);
      parseSpecialTraitTemplates(limits, element);
      parseAllocationMinimumTraitTemplates(limits, element, list);
      parseAlternateMinimumTraitTemplates(limits, element);

      templates = new GenericRestrictedTraitTemplate[limits.size()];
      limits.toArray(templates);
    } catch (PersistenceException e) {
      return new GenericRestrictedTraitTemplate[0];
    }
    return templates;
  }