Ejemplo n.º 1
0
 @Override
 public boolean transferOptions(IEquipmentItem fromItem, IEquipmentItem toItem) {
   if (fromItem == null || toItem == null) {
     return false;
   }
   boolean transferred = false;
   for (IEquipmentStats fromStats : fromItem.getStats()) {
     List<IEquipmentStatsOption> optionList = optionsTable.get(fromItem, fromStats);
     optionsTable.add(fromItem, fromStats, null);
     IEquipmentStats toStats = toItem.getStat(fromStats.getId());
     if (toStats != null && optionList != null) {
       optionsTable.add(toItem, toStats, optionList);
       transferred = true;
     }
   }
   return transferred;
 }
Ejemplo n.º 2
0
 @Override
 public IEquipmentStatsOption[] getEnabledStatOptions(IEquipmentStats stats) {
   if (stats == null) {
     return new IEquipmentStatsOption[0];
   }
   List<IEquipmentItem> itemList = new ArrayList<IEquipmentItem>();
   itemList.addAll(naturalWeaponItems);
   Collections.addAll(itemList, getEquipmentItems());
   for (IEquipmentItem item : itemList) {
     for (IEquipmentStats stat : item.getStats()) {
       if (stats.equals(stat)) {
         return getEnabledStatOptions(item, stat);
       }
     }
   }
   return new IEquipmentStatsOption[0];
 }
  @Override
  public ICardData[] getCards(ICharacter character, ICardReportResourceProvider resourceProvider) {
    IEquipmentAdditionalModel model =
        (IEquipmentAdditionalModel)
            character
                .getStatistics()
                .getCharacterContext()
                .getAdditionalModel(IEquipmentAdditionalModelTemplate.ID);
    List<ICardData> data = new ArrayList<ICardData>();
    for (IEquipmentItem item : model.getEquipmentItems()) {
      String title = item.getTitle();
      Paragraph headerText = new Paragraph();
      if (hasCustomTitle(item)) {
        headerText.add(new Phrase(item.getTemplateId(), resourceProvider.getNormalFont()));
      }
      if (item.getMaterialComposition() == MaterialComposition.Variable) {
        String itemMaterial = "";
        if (hasCustomTitle(item)) itemMaterial += " (";
        itemMaterial += item.getMaterial().getId();
        if (hasCustomTitle(item)) itemMaterial += ")";
        headerText.add(new Phrase(itemMaterial + "\n", resourceProvider.getNormalFont()));
      }
      if (item.getCost() != null) {
        headerText.add(new Phrase(item.getCost().toString(), resourceProvider.getNormalFont()));
      }

      List<Phrase> bodyText = new ArrayList<Phrase>();

      String description = item.getDescription();
      if (description != null && !description.isEmpty()) {
        bodyText.add(new Phrase(description, resourceProvider.getNormalFont()));
        bodyText.add(new Phrase("\n", resourceProvider.getNormalFont()));
      }
      for (IEquipmentStats stats : item.getStats()) {
        Paragraph statsParagraph = new Paragraph();
        if (stats instanceof IArtifactStats) {
          IArtifactStats artifactStats = (IArtifactStats) stats;
          if (artifactStats.getAttuneType() != ArtifactAttuneType.FullyAttuned) {
            continue;
          }
          statsParagraph.add(
              new Phrase(
                  resources.getString("Equipment.Stats.Short.AttuneCost").trim() + ": ",
                  resourceProvider.getBoldFont()));
          statsParagraph.add(
              new Phrase(artifactStats.getAttuneCost() + "m", resourceProvider.getNormalFont()));
        } else {
          String statsString = stringBuilder.createString(item, stats);
          statsParagraph.add(new Phrase(stats.getId() + ": ", resourceProvider.getBoldFont()));
          statsParagraph.add(
              new Phrase(
                  statsString.substring(statsString.indexOf(':') + 2),
                  resourceProvider.getNormalFont()));
        }

        bodyText.add(statsParagraph);
      }

      data.add(
          new EquipmentCardData(
              title, headerText, bodyText.toArray(new Phrase[0]), resourceProvider.getNullIcon()));
    }
    return data.toArray(new ICardData[0]);
  }