/// <summary>
        /// Changes talent level
        /// </summary>
        /// <param name="talent">Talent instance</param>
        public void Change(Talent talent)
        {
            if (talent == null)
                throw new ArgumentNullException("talent");

            talent.ApplyCondition(context);
        }
        /// <summary>
        /// Change level for talent
        /// </summary>
        /// <param name="talent">Talent instance</param>
        /// <param name="newLevel">Required level</param>
        public void Change(Talent talent, byte newLevel)
        {
            if (talent == null)
                throw new ArgumentNullException("talent");
            if (newLevel < MinLevel || newLevel > MaxLevel)
                throw new ArgumentOutOfRangeException("newLevel");

            talent.ApplyLevel(newLevel);
        }
Beispiel #3
0
        /// <summary>
        /// Get new talent instance from Xml
        /// </summary>
        /// <param name="document">Xml configuration</param>
        /// <returns>Talent instance</returns>
        public Talent ParseTalent(XDocument document)
        {
            if (document == null)
                throw new ArgumentNullException("document");

            var element = document.Root;
            var result = new Talent();

            var value = element.Attribute("id").Value;
            result.Id = Guid.Parse(value);

            value = element.Element("mightInitial").Value;
            result.MightInitial = int.Parse(value);

            value = element.Element("tier").Value;
            result.Tier = int.Parse(value);

            result.Stats = new List<Stat>();
            var statParser = new StatParser();
            var statElements = element.Element("stats").Elements().ToList();
            statElements.ForEach(x => result.Stats.Add(statParser.ParseTalentStat(x)));

            return result;
        }