Exemple #1
0
        private double BoonIntensityStacks(Boon b, List <BoonEvent> boonEvents)
        {
            if (boonEvents.Count == 0)
            {
                return(0.0);
            }
            var prev = 0;
            var curr = 0;
            var s    = new List <int> {
                0
            };

            var bs = new BoonStackIntensity(b.Capacity);

            foreach (var be in boonEvents)
            {
                curr = be.Time;
                bs.SimulateTimePassed(curr - prev, s);
                bs.Update(curr - prev);
                bs.Add(be.Duration);
                if (prev != curr)
                {
                    s.Add(bs.CalculateValue());
                }
                else
                {
                    s[s.Count - 1] = bs.CalculateValue();
                }
                prev = curr;
            }
            bs.SimulateTimePassed(_time - prev, s);
            bs.Update(1);
            s.Add(bs.CalculateValue());
            return(s.Average());
        }
        public void SimulateTimePassed(int totalTimePassed, List <int> timeLine)
        {
            BoonStack  b = new BoonStackIntensity(_capacity);
            List <int> s = new List <int>(_stack);

            b.Stack = s;

            if (s.Count > 0)
            {
                int tt  = 0;
                int min = s.Min();

                for (int i = 1; i < totalTimePassed; i++)
                {
                    if ((i - tt) >= min)
                    {
                        b.Update(i - tt);
                        if (s.Count > 0)
                        {
                            min = s.Min();
                        }
                        tt = i;
                    }
                    timeLine.Add(b.CalculateValue());
                }
            }
            else
            {
                for (int i = 1; i < totalTimePassed; i++)
                {
                    timeLine.Add(0);
                }
            }
        }