Пример #1
0
 @Override
 public void initialize(HeroEnvironment environment, Hero hero) {
   StatsModelFetcher.fetch(hero).addModifierFactory(this);
   Path dataBaseDirectory =
       environment.getDataFileProvider().getDataBaseDirectory(DATABASE_FOLDER);
   EquipmentDirectAccess access = new EquipmentDirectAccess(dataBaseDirectory);
   ObjectFactory objectFactory = environment.getObjectFactory();
   MaterialRules materialRules = new ReflectionMaterialRules(objectFactory);
   CharacterType characterType = hero.getTemplate().getTemplateType().getCharacterType();
   Trait stamina = TraitModelFetcher.fetch(hero).getTrait(AttributeType.Stamina);
   this.naturalArmor = new DefaultNaturalSoak(stamina, characterType);
   EquipmentHeroEvaluatorImpl dataProvider = new EquipmentHeroEvaluatorImpl(hero, materialRules);
   this.characterType = hero.getTemplate().getTemplateType().getCharacterType();
   this.defaultMaterial = evaluateDefaultMaterial(materialRules);
   this.equipmentTemplateProvider = new GsonEquipmentDatabase(access);
   this.dataProvider = dataProvider;
   IEquipmentItem item = createItem(new NaturalWeaponTemplate(), null);
   naturalWeaponItems.add(item);
   new SpecialtiesCollectionImpl(hero)
       .addSpecialtyListChangeListener(new SpecialtyPrintRemover(dataProvider));
   EssencePoolModelFetcher.fetch(hero).addEssencePoolModifier(this);
 }
 @Override
 public ITemplateType getTemplateType() {
   Hero hero = (Hero) characterItem.getItemData();
   return hero.getTemplate().getTemplateType();
 }
 public static SpecialtiesModel fetch(Hero hero) {
   return hero.getModel(SpecialtiesModel.ID);
 }