示例#1
0
 @Override
 public final boolean isLearnable(ICharm charm) {
   if (isAlienCharm(charm)) {
     ICasteType casteType = context.getBasicCharacterContext().getCasteType();
     if (!getCharmTemplateForCharacterType().isAllowedAlienCharms(casteType)) {
       return false;
     }
     if (charm.hasAttribute(ICharmData.NATIVE)) {
       return false;
     }
   }
   if (charm.isBlockedByAlternative(context.getMagicCollection())) {
     return false;
   }
   if (isMartialArtsCharm(charm)) {
     boolean isSiderealFormCharm = isFormCharm(charm) && hasLevel(Sidereal, charm);
     MartialArtsCharmConfiguration martialArtsConfiguration =
         new DefaultMartialArtsCharmConfiguration(
             this, context.getMagicCollection(), context.getBasicCharacterContext());
     if (isSiderealFormCharm && !martialArtsConfiguration.isAnyCelestialStyleCompleted()) {
       return false;
     }
     if (!getMartialArtsRulesForCharacterType()
         .isCharmAllowed(charm, martialArtsConfiguration, isExperienced())) {
       return false;
     }
   }
   ICharm[] learnedCharms = getLearnedCharms(true);
   for (IndirectCharmRequirement requirement : charm.getAttributeRequirements()) {
     if (!requirement.isFulfilled(learnedCharms)) {
       return false;
     }
   }
   if (!(new CharmTraitRequirementChecker(getPrerequisiteModifyingCharms(), context, this)
       .areTraitMinimumsSatisfied(charm))) {
     return false;
   }
   for (ICharm parentCharm : charm.getLearnPrerequisitesCharms(this)) {
     if (!isLearnable(parentCharm)) {
       return false;
     }
   }
   return true;
 }
 @Override
 public void setPrerequisiteVisuals(IndirectCharmRequirement requirement) {
   view.setCharmVisuals(requirement.getStringRepresentation(), RGBColor.White);
 }