コード例 #1
0
        // Public Methods

        protected override void Update(long timePassed)
        {
            if (BoonStack.Count > 0 && timePassed > 0)
            {
                _lastSrcRemoves.Clear();
                var toAdd = new BoonSimulationItemIntensity(BoonStack);
                if (GenerationSimulation.Count > 0)
                {
                    BoonSimulationItem last = GenerationSimulation.Last();
                    if (last.End > toAdd.Start)
                    {
                        last.SetEnd(toAdd.Start);
                    }
                }
                GenerationSimulation.Add(toAdd);
                long diff     = Math.Min(BoonStack.Min(x => x.BoonDuration), timePassed);
                long leftOver = timePassed - diff;
                // Subtract from each
                for (int i = BoonStack.Count - 1; i >= 0; i--)
                {
                    var item = new BoonStackItem(BoonStack[i], diff, diff);
                    BoonStack[i] = item;
                    if (item.BoonDuration == 0)
                    {
                        _lastSrcRemoves.Add(item.SeedSrc);
                    }
                }
                BoonStack.RemoveAll(x => x.BoonDuration == 0);
                Update(leftOver);
            }
        }
コード例 #2
0
 // Abstract Methods
 /// <summary>
 /// Make sure the last element does not overflow the fight
 /// </summary>
 /// <param name="fightDuration">Duration of the fight</param>
 public void Trim(long fightDuration)
 {
     for (int i = GenerationSimulation.Count - 1; i >= 0; i--)
     {
         BoonSimulationItem data = GenerationSimulation[i];
         if (data.End > fightDuration)
         {
             data.SetEnd(fightDuration);
         }
         else
         {
             break;
         }
     }
     GenerationSimulation.RemoveAll(x => x.GetTotalDuration() <= 0);
 }
コード例 #3
0
        private void Remove(ushort provokedBy, long boonDuration, long start, ParseEnum.BuffRemove removeType)
        {
            if (GenerationSimulation.Count > 0)
            {
                BoonSimulationItem last = GenerationSimulation.Last();
                if (last.End > start)
                {
                    last.SetEnd(start);
                }
            }
            switch (removeType)
            {
            case ParseEnum.BuffRemove.All:
                foreach (BoonStackItem stackItem in BoonStack)
                {
                    OverstackSimulationResult.Add(new BoonSimulationOverstackItem(stackItem.Src, stackItem.BoonDuration, start));
                    CleanseSimulationResult.Add(new BoonSimulationCleanseItem(provokedBy, stackItem.BoonDuration, start));
                }
                BoonStack.Clear();
                break;

            case ParseEnum.BuffRemove.Single:
            case ParseEnum.BuffRemove.Manual:
                for (int i = 0; i < BoonStack.Count; i++)
                {
                    BoonStackItem stackItem = BoonStack[i];
                    if (Math.Abs(boonDuration - stackItem.BoonDuration) < 10)
                    {
                        OverstackSimulationResult.Add(new BoonSimulationOverstackItem(stackItem.Src, stackItem.BoonDuration, start));
                        CleanseSimulationResult.Add(new BoonSimulationCleanseItem(provokedBy, stackItem.BoonDuration, start));
                        BoonStack.RemoveAt(i);
                        break;
                    }
                }
                break;

            default:
                break;
            }
            _logic.Sort(_log, BoonStack);
            Update(0);
        }
コード例 #4
0
        // Public Methods

        protected override void Update(long timePassed)
        {
            if (BoonStack.Count > 0)
            {
                var toAdd = new BoonSimulationItemIntensity(BoonStack);
                if (GenerationSimulation.Count > 0)
                {
                    BoonSimulationItem last = GenerationSimulation.Last();
                    if (last.End > toAdd.Start)
                    {
                        last.SetEnd(toAdd.Start);
                    }
                }
                GenerationSimulation.Add(toAdd);
                // Subtract from each
                for (int i = BoonStack.Count - 1; i >= 0; i--)
                {
                    var item = new BoonStackItem(BoonStack[i], timePassed, timePassed);
                    BoonStack[i] = item;
                }
                BoonStack.RemoveAll(x => x.BoonDuration < 1);
            }
        }