Exemplo n.º 1
0
 private int calculateCharmCost(
     ICharmConfiguration charmConfiguration, ICharm charm, Set<ICharm> charmsCalculated) {
   ISpecialCharmConfiguration specialCharm =
       charmConfiguration.getSpecialCharmConfiguration(charm);
   int charmCost =
       calculator.getCharmCosts(
           charm,
           basicCharacter,
           traitConfiguration,
           character.getCharacterTemplate().getMagicTemplate().getFavoringTraitType());
   if (specialCharm != null) {
     int timesLearnedWithExperience =
         specialCharm.getCurrentLearnCount() - specialCharm.getCreationLearnCount();
     int specialCharmCost = timesLearnedWithExperience * charmCost;
     if (specialCharm instanceof IUpgradableCharmConfiguration) {
       return (costsExperience(charmConfiguration, charm, charmsCalculated) ? charmCost : 0)
           + ((IUpgradableCharmConfiguration) specialCharm).getUpgradeXPCost();
     }
     if (!(specialCharm instanceof ISubeffectCharmConfiguration)) {
       return specialCharmCost;
     }
     ISubeffectCharmConfiguration subeffectCharmConfiguration =
         (ISubeffectCharmConfiguration) specialCharm;
     int count =
         Math.max(
             0,
             (subeffectCharmConfiguration.getExperienceLearnedSubeffectCount()
                 - (subeffectCharmConfiguration.getCreationLearnedSubeffectCount() == 0 ? 1 : 0)));
     int subeffectCost =
         (int) Math.ceil(count * subeffectCharmConfiguration.getPointCostPerEffect() * 2);
     return subeffectCost + specialCharmCost;
   }
   return costsExperience(charmConfiguration, charm, charmsCalculated) ? charmCost : 0;
 }
Exemplo n.º 2
0
 private IFavorableTrait[] getAllAbilities() {
   List<ITraitType> abilityTypes = new ArrayList<>();
   for (GroupedTraitType type : character.getCharacterTemplate().getAbilityGroups()) {
     abilityTypes.add(type.getTraitType());
   }
   return traitConfiguration.getFavorableTraits(
       abilityTypes.toArray(new ITraitType[abilityTypes.size()]));
 }