Esempio n. 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);
            }
        }
        // Public Methods

        public override void update(long time_passed)
        {
            if (boon_stack.Count > 0)
            {
                var toAdd = new BoonSimulationItemIntensity(boon_stack);
                if (simulation.Count > 0)
                {
                    BoonSimulationItem last = simulation.Last();
                    if (last.getEnd() > toAdd.getStart())
                    {
                        last.setEnd(toAdd.getStart());
                    }
                }
                simulation.Add(toAdd);
                // Subtract from each
                for (int i = boon_stack.Count - 1; i >= 0; i--)
                {
                    var item = new BoonStackItem(boon_stack[i], time_passed, -time_passed);
                    if (item.boon_duration <= 0)
                    {
                        boon_stack.RemoveAt(i);
                    }
                    else
                    {
                        boon_stack[i] = item;
                    }
                }
            }
        }
        protected override void SetBoonStatusGenerationData(ParsedLog log, BoonSimulationItem simul, long boonid)
        {
            List <PhaseData> phases = log.FightData.GetPhases(log);
            Boon             boon   = log.Boons.BoonsByIds[boonid];

            for (int i = 0; i < phases.Count; i++)
            {
                PhaseData phase = phases[i];
                Add(_buffPresence[i], boonid, simul.GetClampedDuration(phase.Start, phase.End));
                simul.SetBoonDistributionItem(_boonDistribution[i], phase.Start, phase.End, boonid, log);
            }
        }
 // Abstract Methods
 /// <summary>
 /// Make sure the last element does not overflow the fight
 /// </summary>
 /// <param name="fight_duration">Duration of the fight</param>
 public void trim(long fight_duration)
 {
     for (int i = simulation.Count - 1; i >= 0; i--)
     {
         BoonSimulationItem data = simulation[i];
         if (data.getEnd() > fight_duration)
         {
             data.setEnd(fight_duration);
         }
         else
         {
             break;
         }
     }
     simulation.RemoveAll(x => x.getDuration(0) <= 0);
 }
Esempio n. 5
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);
 }
        protected override void SetBoonStatusGenerationData(ParsedLog log, BoonSimulationItem simul, long boonid, bool updateBoonPresence, bool updateCondiPresence)
        {
            List <PhaseData> phases = log.FightData.GetPhases(log);

            for (int i = 0; i < phases.Count; i++)
            {
                PhaseData phase = phases[i];
                if (updateBoonPresence)
                {
                    Add(_boonPresence[i], boonid, simul.GetClampedDuration(phase.Start, phase.End));
                }
                if (updateCondiPresence)
                {
                    Add(_condiPresence[i], boonid, simul.GetClampedDuration(phase.Start, phase.End));
                }
                simul.SetBoonDistributionItem(_boonDistribution[i], phase.Start, phase.End, boonid, log);
            }
        }
Esempio n. 7
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);
        }
        // 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);
            }
        }
 protected abstract void SetBoonStatusGenerationData(ParsedLog log, BoonSimulationItem simul, long boonid, bool updateBoonPresence, bool updateCondiPresence);
Esempio n. 10
0
 protected override void SetBoonStatusGenerationData(ParsedLog log, BoonSimulationItem simul, long boonid)
 {
 }
Esempio n. 11
0
 protected abstract void SetBoonStatusGenerationData(ParsedLog log, BoonSimulationItem simul, long boonid);