コード例 #1
0
 // TODO: Available dots limit max. value
 public SpiritFormAttribute(IGenericTrait baseTrait, final ICharacterModelContext charContext) {
   ITraitContext context = charContext.getTraitContext();
   ITraitTemplate template = SimpleTraitTemplate.createStaticLimitedTemplate(1, 12);
   TraitRules traitRules =
       new TraitRules(baseTrait.getType(), template, context.getLimitationContext());
   IValueChangeChecker incrementChecker =
       new IValueChangeChecker() {
         @Override
         public boolean isValidNewValue(int value) {
           return value != spiritTrait.getCurrentValue()
               && !charContext.getBasicCharacterContext().isExperienced();
         }
       };
   spiritTrait = new DefaultTrait(traitRules, context, incrementChecker);
   spiritTrait.addCurrentValueListener(
       new IIntValueChangedListener() {
         @Override
         public void valueChanged(int newValue) {
           SpiritFormAttribute.this.newValue = newValue;
         }
       });
 }
コード例 #2
0
 @Override
 public void recalculate() {
   spiritTrait.setCurrentValue(newValue);
 }