Esempio n. 1
0
        public int GetExperienceFromMessage(Character character, int messageLength)
        {
            double expValue = Math.Max(1.0, (double)messageLength / _expOptions.MessageLengthDivisor);

            int intStat = _statService.GetStatistic(character, Globals.StatisticFlag.Intelligence);

            if (intStat > 0)
            {
                expValue *= 1 + intStat * _expOptions.IntelligenceMultiplier;
            }

            return((int)Math.Round(expValue));
        }
Esempio n. 2
0
        private int GetNumberOfDice(IList <StatisticValue> stats, Statistic stat)
        {
            var statValue = _statService.GetStatistic(stats, stat);

            int numOfDie = statValue;

            if (stat is Skill skill)
            {
                var specValue = _statService.GetStatistic(stats, skill.Special);

                numOfDie += specValue;
            }

            return(numOfDie);
        }
Esempio n. 3
0
        public IList <StatisticValue> GetEffectiveStatistics(Character character)
        {
            var newStats = _statService.CloneStatistics(character.Statistics);

            // Loop through all applied effects, then loop through every StatisticValue in the effect,
            // then actually apply them
            foreach (var effect in character.EffectCharacters.Select(x => x.Effect))
            {
                foreach (var statEffect in effect.StatisticEffects)
                {
                    var newValue = _statService.GetStatistic(newStats, statEffect.Statistic) + statEffect.Value;

                    if (statEffect.Statistic is Special && newValue < 1)
                    {
                        newValue = 1;
                    }

                    _statService.SetStatistic(newStats, statEffect.Statistic, newValue);
                }
            }

            return(newStats);
        }