Esempio n. 1
0
        /// <summary>
        /// Parse Xml configuration
        /// </summary>
        /// <param name="element">Stat node from Xml configuration</param>
        /// <returns>Stat instance</returns>
        public ToonStat ParseToonStat(XElement element)
        {
            if (element == null)
                throw new ArgumentNullException("element");

            var stat = new ToonStat();
            FillStat(element, stat);
            FillStatToon(element, stat);

            return stat;
        }
Esempio n. 2
0
        /// <summary>
        /// Get toon specific coefficient value (coefficient "q" for might specific formula)
        /// </summary>
        /// <param name="initialStat">Current character initial stat</param>
        /// <returns>Might modifier for corresponding stat</returns>
        private double GetMightModifier(ToonStat initialStat)
        {
            if (initialStat == null)
                throw new ArgumentNullException("initialStat");

            double result;

            var growCoeff = initialStat.GrowMight / initialStat.Grow / 100;

            switch (initialStat.Type)
            {
                case StatTypeEnum.Agility:
                case StatTypeEnum.Cunning:
                case StatTypeEnum.Durability:
                case StatTypeEnum.Intelligence:
                case StatTypeEnum.Strength:
                case StatTypeEnum.Will:
                    {
                        result = 5 * growCoeff;
                        break;
                    }

                case StatTypeEnum.Health:
                case StatTypeEnum.Mana:
                    {
                        result = 25 * growCoeff;
                        break;
                    }

                default: throw new CalculationException(string.Format("Unsupported stat type found: {0}", initialStat.Type.ToString()));
            }

            return result;
        }
Esempio n. 3
0
        /// <summary>
        /// Gets toon specific characteristics given by might for maximal level (coefficient "M" in might specific formula for maximal level)
        /// </summary>
        /// <param name="initialStat">Current character initial stats</param>
        /// <param name="statModifier">Might modifier for stat</param>
        /// <param name="currentMight">Might provided by used talents</param>
        /// <returns>Might modifier list for corresponding stats</returns>
        private double GetMightContribution(ToonStat initialStat, double statModifier, double currentMight)
        {
            if (initialStat == null)
                throw new ArgumentNullException("initialStat");

            var m = initialStat.Grow * (0.6 * statModifier * (currentMight / 10 - 16) + 36);

            return m;
        }
Esempio n. 4
0
        /// <summary>
        /// Fill toon stat data
        /// </summary>
        /// <param name="element">Stat node from Xml configuration</param>
        /// <param name="stat">Stat instance</param>
        protected void FillStatToon(XElement element, ToonStat stat)
        {
            if (element == null)
                throw new ArgumentNullException("element");
            if (stat == null)
                throw new ArgumentNullException("stat");

            var value = element.Element("growMight").Value;
            stat.GrowMight = double.Parse(value, CultureInfo.InvariantCulture);
        }