示例#1
0
文件: Pets.cs 项目: tsebalj1/rawr
        private float GetHasteWithProcs(StatExtractor statExtractor)
        {
            Dictionary <int, float> periods = new Dictionary <int, float>();
            Dictionary <int, float> chances = new Dictionary <int, float>();

            periods.Add((int)Trigger.Use, 0f);
            chances.Add((int)Trigger.Use, 1f);
            WeightedStat[] hasteProcs
                = Mommy.GetUptimes(
                      Stats,
                      periods,
                      chances,
                      statExtractor,
                      (a, b, c, d, e, f, g, h)
                      => SpecialEffect
                      .GetAverageCombinedUptimeCombinationsMultiplicative(
                          a, b, c, d, e, f, g, h));
            float avgProcHaste = 0f;

            foreach (WeightedStat proc in hasteProcs)
            {
                avgProcHaste += proc.Chance * proc.Value;
            }
            return((1f + statExtractor(Stats)) * (1f + avgProcHaste) - 1f);
        }
示例#2
0
        public static float GetBuffEffect(
            List <Buff> activeBuffs,
            float candidateBuff,
            string group,
            StatExtractor extractor)
        {
            float active = GetActiveBuff(activeBuffs, group, extractor);

            return(Math.Max(0f, candidateBuff - active));
        }
示例#3
0
 public static float GetActiveBuff(List<Buff> activeBuffs, string group, StatExtractor extractor)
 {
     float active = 0f;
     foreach (Buff buff in activeBuffs)
     {
         if (buff.ConflictingBuffs.Contains(group))
         {
             active += extractor(buff.Stats);
             foreach (Buff improvement in buff.Improvements)
             {
                 if (activeBuffs.Contains(improvement))
                 {
                     active += extractor(improvement.Stats);
                 }
             }
         }
     }
     return active;
 }
        public WeightedStat[] GetUptimes(
            Stats stats,
            Dictionary <int, float> periods,
            Dictionary <int, float> chances,
            StatExtractor statExtractor,
            UptimeCombiner uptimeCombiner)
        {
            List <SpecialEffect> hasteEffects   = new List <SpecialEffect>();
            List <float>         hasteIntervals = new List <float>();
            List <float>         hasteChances   = new List <float>();
            List <float>         hasteOffsets   = new List <float>();
            List <float>         hasteScales    = new List <float>();
            List <float>         hasteValues    = new List <float>();

            foreach (SpecialEffect effect in stats.SpecialEffects())
            {
                if (!periods.ContainsKey((int)effect.Trigger))
                {
                    continue;
                }

                float value = statExtractor(effect.Stats);
                if (value > 0)
                {
                    hasteEffects.Add(effect);
                    hasteIntervals.Add(periods[(int)effect.Trigger]);
                    hasteChances.Add(chances[(int)effect.Trigger]);
                    hasteOffsets.Add(0f);
                    hasteScales.Add(1f);
                    hasteValues.Add(value);
                }
            }
            return(uptimeCombiner(
                       hasteEffects.ToArray(),
                       hasteIntervals.ToArray(),
                       hasteChances.ToArray(),
                       hasteOffsets.ToArray(),
                       hasteScales.ToArray(),
                       CalculationsWarlock.AVG_UNHASTED_CAST_TIME,
                       Options.Duration,
                       hasteValues.ToArray()));
        }
示例#5
0
文件: StatUtils.cs 项目: rakot/rawr
        public static float GetActiveBuff(List <Buff> activeBuffs, string group, StatExtractor extractor)
        {
            float active = 0f;

            foreach (Buff buff in activeBuffs)
            {
                if (buff.ConflictingBuffs.Contains(group))
                {
                    active += extractor(buff.Stats);
                    foreach (Buff improvement in buff.Improvements)
                    {
                        if (activeBuffs.Contains(improvement))
                        {
                            active += extractor(improvement.Stats);
                        }
                    }
                }
            }
            return(active);
        }
        public WeightedStat[] GetUptimes(Stats stats, Dictionary<int, float> periods, Dictionary<int, float> chances, StatExtractor statExtractor, UptimeCombiner uptimeCombiner)
        {
            List<SpecialEffect> hasteEffects = new List<SpecialEffect>();
            List<float> hasteIntervals = new List<float>();
            List<float> hasteChances = new List<float>();
            List<float> hasteOffsets = new List<float>();
            List<float> hasteScales = new List<float>();
            List<float> hasteValues = new List<float>();
            foreach (SpecialEffect effect in stats.SpecialEffects())
            {
                if (!periods.ContainsKey((int)effect.Trigger))
                {
                    continue;
                }

                float value = statExtractor(effect.Stats);
                if (value > 0)
                {
                    hasteEffects.Add(effect);
                    hasteIntervals.Add(periods[(int)effect.Trigger]);
                    hasteChances.Add(chances[(int)effect.Trigger]);
                    hasteOffsets.Add(0f);
                    hasteScales.Add(1f);
                    hasteValues.Add(value);
                }
            }
            return uptimeCombiner(
                    hasteEffects.ToArray(),
                    hasteIntervals.ToArray(),
                    hasteChances.ToArray(),
                    hasteOffsets.ToArray(),
                    hasteScales.ToArray(),
                    CalculationsWarlock.AVG_UNHASTED_CAST_TIME,
                    BossOpts.BerserkTimer,
                    hasteValues.ToArray());
        }
示例#7
0
 private float GetHasteWithProcs(StatExtractor statExtractor)
 {
     Dictionary<int, float> periods = new Dictionary<int, float>();
     Dictionary<int, float> chances = new Dictionary<int, float>();
     periods.Add((int)Trigger.Use, 0f);
     chances.Add((int)Trigger.Use, 1f);
     WeightedStat[] hasteProcs = Mommy.GetUptimes(Stats, periods, chances, statExtractor,
             (a, b, c, d, e, f, g, h) => SpecialEffect.GetAverageCombinedUptimeCombinationsMultiplicative(a, b, c, d, e, f, g, h));
     float avgProcHaste = 0f;
     foreach (WeightedStat proc in hasteProcs)
     {
         avgProcHaste += proc.Chance * proc.Value;
     }
     return (1f + statExtractor(Stats)) * (1f + avgProcHaste) - 1f;
 }
示例#8
0
 public static float GetBuffEffect(List<Buff> activeBuffs, float candidateBuff, string group, StatExtractor extractor)
 {
     float active = GetActiveBuff(activeBuffs, group, extractor);
     return Math.Max(0f, candidateBuff - active);
 }