コード例 #1
0
        public Character(
            SerializableCharacter serializableCharacter,
            ITalentsManager manager,
            IRacesManager racesManager = null,
            IClassManager classManager = null
            )
            : this(serializableCharacter.Name, manager)
        {
            if (racesManager == null)
                racesManager = RacesManager.Instance;
            if (classManager == null)
                classManager = ClassManager.Instance;

            if (serializableCharacter.Talents != null)
            {
                foreach (var item in serializableCharacter.Talents)
                {
                    try
                    {
                        Talent talent = GetTalent(item.id);

                        if (item.bonus)
                        {
                            talent.Increment(item.level - 1);
                        }
                        else
                        {
                            talent.Increment(item.level);
                        }
                        talent.HaveBonus = item.bonus;
                        talent.SpeLevel = item.speLevel;
                    }
                    catch
                    {
                        continue;
                    }
                }
            }
            _aspectBonus = serializableCharacter.AspectBonus;
            _aspectMalus = serializableCharacter.AspectMalus;
            _race = racesManager.GetRace(serializableCharacter.Race);
            if (serializableCharacter.Classe != null && !serializableCharacter.Classe.Equals(""))
                classeChar = classManager.getFormName(serializableCharacter.Classe);
            else
                classeChar = null;
            ExperienceAvailable = serializableCharacter.Experience;
            Inventaire = serializableCharacter.Inventaire;
            if (_race != null)
                _bonusAspect = _race.AspectBonus;
            penPoid = serializableCharacter.penPoid;
            inventory = serializableCharacter.Inventory ?? new Inventory();
            RecomputePA();
        }
コード例 #2
0
 public void SetBonus(Dictionary<Aspect, int> bonAspect, IEnumerable<Talent> talbonus, Race r)
 {
     foreach (var talent in talbonus)
     {
         _talents[talent.Id].HaveBonus = true;
     }
     _race = r;
     _bonusAspect = bonAspect;
     OnPAchanged();
     OnExperienceChanged();
 }