コード例 #1
0
 @Override
 public int getMotesExpended() {
   int total = 0;
   for (IEquipmentItem item : equipmentItems) {
     for (IEquipmentStats stats : item.getStats())
       if (stats instanceof IArtifactStats
           && item.getAttunementState() == ((IArtifactStats) stats).getAttuneType())
         total += ((IArtifactStats) stats).getAttuneCost();
   }
   return total;
 }
コード例 #2
0
 @Override
 public void changeOccurred() {
   for (IEquipmentItem item : getEquipmentItems())
     for (IEquipmentStats stats : item.getStats()) {
       List<IEquipmentStatsOption> list = optionsTable.get(item, stats);
       if (list == null) {
         return;
       }
       List<IEquipmentStatsOption> optionsList = new ArrayList<IEquipmentStatsOption>(list);
       for (IEquipmentStatsOption option : optionsList) {
         if (!characterStillHasCorrespondingSpecialty(option)) {
           disableStatOption(item, stats, option);
         }
       }
     }
 }
コード例 #3
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;
 }
コード例 #4
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];
 }
コード例 #5
0
 public EquipmentPto createPto(IEquipmentItem item) {
   EquipmentPto pto = new EquipmentPto();
   pto.templateId = item.getTemplateId();
   pto.customTitle = item.getTitle();
   if (!item.getBaseDescription().equals(item.getDescription())) {
     pto.description = item.getDescription();
   }
   if (item.getMaterialComposition() == MaterialComposition.Variable) {
     pto.material = item.getMaterial().name();
   }
   for (IEquipmentStats stats : item.getStats()) {
     if (item.isPrintEnabled(stats)) {
       EquipmentStatsPto printPto = createStatsPto(item, stats);
       pto.printStats.add(printPto);
     }
   }
   return pto;
 }
コード例 #6
0
  @Override
  public boolean transferOptions(IEquipmentItem fromItem, IEquipmentItem toItem) {
    boolean transferred = false;
    if (fromItem != null && toItem != null) {
      for (IEquipmentStats fromStats : fromItem.getStats()) {
        List<IEquipmentStatsOption> specialtyList = optionsTable.remove(fromItem, fromStats);
        boolean printCheckboxEnabled = fromItem.isPrintEnabled(fromStats);
        IEquipmentStats toStats = toItem.getStat(fromStats.getId());

        if (toStats != null) {
          transferred = true;
          if (specialtyList != null) {
            optionsTable.put(toItem, toStats, specialtyList);
          }
          toItem.setPrintEnabled(toStats, printCheckboxEnabled);
        }
      }
    }
    return transferred;
  }
コード例 #7
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]);
  }