protected override void SetBoonStatusCleanseWasteData(ParsedLog log, BoonSimulator simulator, long boonid, bool updateCondiPresence)
        {
            List <PhaseData> phases = log.FightData.GetPhases(log);
            List <AbstractBoonSimulationItem> extraSimulations = new List <AbstractBoonSimulationItem>(simulator.OverstackSimulationResult);

            extraSimulations.AddRange(simulator.WasteSimulationResult);
            foreach (AbstractBoonSimulationItem simul in extraSimulations)
            {
                for (int i = 0; i < phases.Count; i++)
                {
                    PhaseData phase = phases[i];
                    simul.SetBoonDistributionItem(_boonDistribution[i], phase.Start, phase.End, boonid, log);
                }
            }

            if (updateCondiPresence)
            {
                foreach (BoonSimulationItemCleanse simul in simulator.CleanseSimulationResult)
                {
                    for (int i = 0; i < phases.Count; i++)
                    {
                        PhaseData phase = phases[i];
                        simul.SetCleanseItem(_condiCleanse[i], phase.Start, phase.End, boonid, log);
                    }
                }
            }
        }
        protected void SetBoonStatus(ParsedLog log)
        {
            BoonMap         toUse              = GetBoonMap(log);
            long            dur                = log.FightData.FightDuration;
            int             fightDuration      = (int)(dur) / 1000;
            BoonsGraphModel boonPresenceGraph  = new BoonsGraphModel(Boon.BoonsByIds[Boon.NumberOfBoonsID]);
            BoonsGraphModel condiPresenceGraph = new BoonsGraphModel(Boon.BoonsByIds[Boon.NumberOfConditionsID]);
            HashSet <long>  boonIds            = new HashSet <long>(Boon.GetBoonList().Select(x => x.ID));
            HashSet <long>  condiIds           = new HashSet <long>(Boon.GetCondiBoonList().Select(x => x.ID));

            InitBoonStatusData(log);

            long death = GetDeath(log, 0, dur);

            foreach (Boon boon in TrackedBoons)
            {
                long boonid = boon.ID;
                if (toUse.TryGetValue(boonid, out List <BoonLog> logs) && logs.Count != 0)
                {
                    if (BoonPoints.ContainsKey(boonid))
                    {
                        continue;
                    }
                    BoonSimulator simulator = boon.CreateSimulator(log);
                    simulator.Simulate(logs, dur);
                    if (death > 0 && GetCastLogs(log, death + 5000, dur).Count == 0)
                    {
                        simulator.Trim(death);
                    }
                    else
                    {
                        simulator.Trim(dur);
                    }
                    bool updateBoonPresence  = boonIds.Contains(boonid);
                    bool updateCondiPresence = condiIds.Contains(boonid);
                    List <BoonsGraphModel.Segment> graphSegments = new List <BoonsGraphModel.Segment>();
                    foreach (BoonSimulationItem simul in simulator.GenerationSimulation)
                    {
                        SetBoonStatusGenerationData(log, simul, boonid, updateBoonPresence, updateCondiPresence);
                        BoonsGraphModel.Segment segment = simul.ToSegment();
                        if (graphSegments.Count == 0)
                        {
                            graphSegments.Add(new BoonsGraphModel.Segment(0, segment.Start, 0));
                        }
                        else if (graphSegments.Last().End != segment.Start)
                        {
                            graphSegments.Add(new BoonsGraphModel.Segment(graphSegments.Last().End, segment.Start, 0));
                        }
                        graphSegments.Add(segment);
                    }
                    SetExtraBoonStatusGenerationData(log, simulator, boonid, updateCondiPresence);
                    if (graphSegments.Count > 0)
                    {
                        graphSegments.Add(new BoonsGraphModel.Segment(graphSegments.Last().End, dur, 0));
                    }
                    else
                    {
                        graphSegments.Add(new BoonsGraphModel.Segment(0, dur, 0));
                    }
                    BoonPoints[boonid] = new BoonsGraphModel(boon, graphSegments);
                    if (updateBoonPresence || updateCondiPresence)
                    {
                        List <BoonsGraphModel.Segment> segmentsToFill = updateBoonPresence ? boonPresenceGraph.BoonChart : condiPresenceGraph.BoonChart;
                        bool firstPass = segmentsToFill.Count == 0;
                        foreach (BoonsGraphModel.Segment seg in BoonPoints[boonid].BoonChart)
                        {
                            long start = seg.Start;
                            long end   = seg.End;
                            int  value = seg.Value > 0 ? 1 : 0;
                            if (firstPass)
                            {
                                segmentsToFill.Add(new BoonsGraphModel.Segment(start, end, value));
                            }
                            else
                            {
                                for (int i = 0; i < segmentsToFill.Count; i++)
                                {
                                    BoonsGraphModel.Segment curSeg = segmentsToFill[i];
                                    long curEnd   = curSeg.End;
                                    long curStart = curSeg.Start;
                                    int  curVal   = curSeg.Value;
                                    if (curStart > end)
                                    {
                                        break;
                                    }
                                    if (curEnd < start)
                                    {
                                        continue;
                                    }
                                    if (end <= curEnd)
                                    {
                                        curSeg.End = start;
                                        segmentsToFill.Insert(i + 1, new BoonsGraphModel.Segment(start, end, curVal + value));
                                        segmentsToFill.Insert(i + 2, new BoonsGraphModel.Segment(end, curEnd, curVal));
                                        break;
                                    }
                                    else
                                    {
                                        curSeg.End = start;
                                        segmentsToFill.Insert(i + 1, new BoonsGraphModel.Segment(start, curEnd, curVal + value));
                                        start = curEnd;
                                        i++;
                                    }
                                }
                            }
                        }
                        if (updateBoonPresence)
                        {
                            boonPresenceGraph.FuseSegments();
                        }
                        else
                        {
                            condiPresenceGraph.FuseSegments();
                        }
                    }
                }
            }
            BoonPoints[Boon.NumberOfBoonsID]      = boonPresenceGraph;
            BoonPoints[Boon.NumberOfConditionsID] = condiPresenceGraph;
            SetExtraBoonStatusData(log);
        }
 protected abstract void SetExtraBoonStatusGenerationData(ParsedLog log, BoonSimulator simulator, long boonid, bool updateCondiPresence);
 public override void UpdateSimulator(BoonSimulator simulator)
 {
     simulator.Extend(Value, _oldValue, Src, Time);
 }
 public override void UpdateSimulator(BoonSimulator simulator)
 {
     simulator.Add(Value, SrcInstid, SrcInstid, Time);
 }
 public abstract void UpdateSimulator(BoonSimulator simulator);
 protected override void SetBoonStatusCleanseWasteData(ParsedLog log, BoonSimulator simulator, long boonid, bool updateCondiPresence)
 {
 }
Beispiel #8
0
 public override void UpdateSimulator(BoonSimulator simulator)
 {
     simulator.Remove(Src, Value, Time, _removeType);
 }