// 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; } }); }
public Specialty( AbstractSubTraitContainer container, ITraitReference reference, String specialtyName, ITraitContext context) { super( new TraitRules( new TraitType("Specialty"), // $NON-NLS-1$ SimpleTraitTemplate.createStaticLimitedTemplate(0, 3), context.getLimitationContext()), context, new FriendlyValueChangeChecker()); this.container = container; this.reference = reference; this.subTraitName = specialtyName; }