示例#1
0
 public ITraitType getTraitTypeById(String id) {
   ITraitType[] allTraits = getAllCoreTraitTypes();
   for (ITraitType type : allTraits) {
     if (id.equals(type.getId())) {
       return type;
     }
   }
   throw new IllegalArgumentException("No trait type with id: " + id); // $NON-NLS-1$
 }
 @Override
 public ITraitCostModifier getCostModifier(ITraitType type) {
   final ITraitCostModifier[] modifier = new ITraitCostModifier[1];
   type.accept(
       new TraitTypeAdapter() {
         @Override
         public void visitBackground(IBackgroundTemplate template) {
           modifier[0] =
               Functions.forMap(backgroundCostModifiers, new DefaultTraitCostModifier())
                   .apply(template.getId());
         }
       });
   return modifier[0];
 }
 public boolean[] hasExcellenciesLearned(ITraitType traitType) {
   IMagicStats[] excellencies = getExcellencies();
   List<IMagic> allLearnedMagic = character.getAllLearnedMagic();
   boolean[] excellencyLearned = new boolean[excellencies.length];
   for (int i = 0; i < excellencies.length; i++) {
     final String charmId =
         excellencies[i].getName().getId() + "." + traitType.getId(); // $NON-NLS-1$
     excellencyLearned[i] =
         CollectionUtilities.getFirst(
                 allLearnedMagic,
                 new IPredicate<IMagic>() {
                   @Override
                   public boolean evaluate(IMagic value) {
                     return charmId.equals(value.getId());
                   }
                 })
             != null;
   }
   return excellencyLearned;
 }
 public String getTraitLabel(ITraitType traitType) {
   return getString(getTraitTypePrefix() + traitType.getId());
 }