示例#1
0
        public int[] getCleanses(BossData bossData, List <CombatItem> combatList, AgentData agentData)
        {
            int time_start = bossData.getFirstAware();

            int[] cleanse = { 0, 0 };
            foreach (CombatItem c in combatList.Where(x => x.isStateChange().getID() == 0))
            {
                if (c.isActivation().getID() == 0)
                {
                    if (instid == c.getSrcInstid() && c.getIFF().getEnum() == "FRIEND" && c.isBuffremove().getID() == 1 /*|| instid == c.getSrcMasterInstid()*/)//selecting player as remover could be wrong
                    {
                        int time = c.getTime() - time_start;
                        if (time > 0)
                        {
                            if (Boon.getCondiList().Contains(c.getSkillID()))
                            {
                                cleanse[0]++;
                                cleanse[1] += c.getBuffDmg();
                            }
                        }
                    }
                }
            }
            return(cleanse);
        }
 public Consumable(Boon item, long time, int duration)
 {
     Item     = item;
     Time     = time;
     Duration = duration;
     Stack    = 1;
 }
        private void SetConsumablesList(ParsedLog log)
        {
            List <Boon> consumableList = Boon.GetConsumableList();
            long        fightDuration  = log.FightData.FightDuration;

            foreach (Boon consumable in consumableList)
            {
                foreach (CombatItem c in log.GetBoonData(consumable.ID))
                {
                    if (c.IsBuffRemove != ParseEnum.BuffRemove.None || (c.IsBuff != 18 && c.IsBuff != 1) || AgentItem.InstID != c.DstInstid)
                    {
                        continue;
                    }
                    long time = 0;
                    if (c.IsBuff != 18)
                    {
                        time = log.FightData.ToFightSpace(c.Time);
                    }
                    if (time <= fightDuration)
                    {
                        Consumable existing = _consumeList.Find(x => x.Time == time && x.Item.ID == consumable.ID);
                        if (existing != null)
                        {
                            existing.Stack++;
                        }
                        else
                        {
                            _consumeList.Add(new Consumable(consumable, time, c.Value));
                        }
                    }
                }
            }
            _consumeList.Sort((x, y) => x.Time.CompareTo(y.Time));
        }
        private void setConsumablesList(ParsedLog log)
        {
            List <Boon> foodBoon       = Boon.getFoodList();
            List <Boon> utilityBoon    = Boon.getUtilityList();
            long        time_start     = log.getBossData().getFirstAware();
            long        fight_duration = log.getBossData().getLastAware() - time_start;

            foreach (CombatItem c in log.getCombatList())
            {
                if (c.isBuff() != 18 && c.isBuff() != 1)
                {
                    continue;
                }

                if (foodBoon.FirstOrDefault(x => x.getID() == c.getSkillID()) == null && utilityBoon.FirstOrDefault(x => x.getID() == c.getSkillID()) == null)
                {
                    continue;
                }
                long time = c.getTime() - time_start;
                if (agent.getInstid() == c.getDstInstid())
                {
                    consumeList.Add(c);
                }
            }
        }
        // Public methods
        public int[] getCleanses(ParsedLog log, long start, long end)
        {
            long time_start = log.getBossData().getFirstAware();

            int[] cleanse = { 0, 0 };
            foreach (CombatItem c in log.getCombatList().Where(x => x.isStateChange() == ParseEnum.StateChange.Normal && x.isBuff() == 1 && x.getTime() >= (start + time_start) && x.getTime() <= (end + time_start)))
            {
                if (c.isActivation() == ParseEnum.Activation.None)
                {
                    if (agent.getInstid() == c.getDstInstid() && c.getIFF() == ParseEnum.IFF.Friend && (c.isBuffremove() != ParseEnum.BuffRemove.None))
                    {
                        long time = c.getTime() - time_start;
                        if (time > 0)
                        {
                            if (Boon.getCondiBoonList().Exists(x => x.getID() == c.getSkillID()))
                            {
                                cleanse[0]++;
                                cleanse[1] += c.getBuffDmg();
                            }
                        }
                    }
                }
            }
            return(cleanse);
        }
        private void SetConsumablesList(ParsedLog log)
        {
            List <Boon> consumableList = Boon.GetConsumableList();
            long        timeStart      = log.FightData.FightStart;
            long        fightDuration  = log.FightData.FightEnd - timeStart;

            foreach (Boon consumable in consumableList)
            {
                foreach (CombatItem c in log.GetBoonData(consumable.ID))
                {
                    if (c.IsBuffRemove != ParseEnum.BuffRemove.None || (c.IsBuff != 18 && c.IsBuff != 1) || AgentItem.InstID != c.DstInstid)
                    {
                        continue;
                    }
                    long time = 0;
                    if (c.IsBuff != 18)
                    {
                        time = c.Time - timeStart;
                    }
                    if (time <= fightDuration)
                    {
                        _consumeList.Add(new Tuple <Boon, long, int>(consumable, time, c.Value));
                    }
                }
            }
            _consumeList.Sort((x, y) => x.Item2.CompareTo(y.Item2));
        }
示例#7
0
        public List <BoonMap> getboonGen(BossData bossData, SkillData skillData, List <CombatItem> combatList, AgentData agentData, List <int> trgtPID)
        {
            List <BoonMap> boonGen = new List <BoonMap>();
            int            time_start = bossData.getFirstAware();
            int            fight_duration = bossData.getLastAware() - time_start;
            int            here = 0, there = 0, everywhere = 0, huh = 0;

            // Initialize Boon Map with every Boon
            foreach (Boon boon in Boon.getList())
            {
                BoonMap map = new BoonMap(boon.getName(), new List <BoonLog>());
                boonGen.Add(map);
                // boon_map.put(boon.getName(), new ArrayList<BoonLog>());
            }

            foreach (CombatItem c in combatList)
            {
                LuckParser.Models.ParseEnums.StateChange state = c.isStateChange();
                int time = c.getTime() - time_start;
                if (instid == c.getSrcInstid() && state.getEnum() == "NORMAL" && time > 0 && time < fight_duration /*|| instid == c.getSrcMasterInstid()*/)//selecting player or minion as caster
                {
                    here++;
                    foreach (AgentItem item in agentData.getPlayerAgentList())
                    {                                                                                     //selecting all
                        if (item.getInstid() == c.getDstInstid() /*&& c.getIFF().getEnum() == "FRIEND"*/) //Make sure target is friendly existing Agent
                        {
                            there++;
                            foreach (int id in trgtPID)  //Make sure trgt is within paramaters
                            {
                                if (id == c.getDstInstid())
                                {
                                    everywhere++;
                                    if (c.isBuffremove().getID() == 0 && c.isBuff() > 0 && c.getBuffDmg() == 0 && c.getValue() > 0)      //Buff application
                                    {
                                        huh++;
                                        String skill_name = skillData.getName(c.getSkillID());
                                        int    count      = 0;

                                        foreach (BoonMap bm in boonGen.ToList())
                                        {
                                            if (skill_name.Contains(bm.getName()))
                                            {
                                                List <BoonLog> loglist = bm.getBoonLog();
                                                loglist.Add(new BoonLog(time, c.getValue(), c.getOverstackValue()));
                                                bm.setBoonLog(loglist);

                                                boonGen[count] = bm;
                                            }
                                            count++;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(boonGen);
        }
 public void Add(Boon boon)
 {
     if (ContainsKey(boon.ID))
     {
         return;
     }
     this[boon.ID] = new List <BoonLog>();
 }
 public void add(Boon boon)
 {
     if (ContainsKey(boon.getID()))
     {
         return;
     }
     this[boon.getID()] = new List <BoonLog>();
 }
        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);
            }
        }
示例#11
0
 // Factory
 public static AbstractBoon makeBoon(Boon boon)
 {
     if (boon.getType() == "intensity")
     {
         return(new Intensity(boon.getCapacity()));
     }
     else if (boon.getType() == "duration")
     {
         return(new Duration(boon.getCapacity()));
     }
     else
     {
         return(null);
     }
 }
示例#12
0
        private void SetBoonDistribution(ParsedLog log)
        {
            List <PhaseData> phases      = log.FightData.GetPhases(log);
            BoonMap          toUse       = GetBoonMap(log);
            long             dur         = log.FightData.FightDuration;
            int            fightDuration = (int)(dur) / 1000;
            HashSet <long> extraDataID   = new HashSet <long>
            {
                50421,
                31803
            };
            BoonsGraphModel boonPresenceGraph  = new BoonsGraphModel("Number of Boons");
            BoonsGraphModel condiPresenceGraph = new BoonsGraphModel("Number of Conditions");
            HashSet <long>  boonIds            = new HashSet <long>(Boon.GetBoonList().Select(x => x.ID));
            HashSet <long>  condiIds           = new HashSet <long>(Boon.GetCondiBoonList().Select(x => x.ID));

            for (int i = 0; i < phases.Count; i++)
            {
                _boonDistribution.Add(new BoonDistribution());
                _boonPresence.Add(new Dictionary <long, long>());
                _condiPresence.Add(new Dictionary <long, long>());
                _condiCleanse.Add(new Dictionary <ushort, Dictionary <long, List <long> > >());
            }

            long death = GetDeath(log, 0, dur) - log.FightData.FightStart;

            foreach (Boon boon in BoonToTrack)
            {
                long boonid = boon.ID;
                if (toUse.TryGetValue(boonid, out var logs) && logs.Count != 0)
                {
                    if (_boonDistribution[0].ContainsKey(boonid))
                    {
                        continue;
                    }
                    bool requireExtraData = extraDataID.Contains(boonid);
                    var  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);
                    }
                    var updateBoonPresence   = boonIds.Contains(boonid);
                    var updateCondiPresence  = boonid != 873 && condiIds.Contains(boonid);
                    var generationSimulation = simulator.GenerationSimulationResult;
                    var graphSegments        = new List <BoonsGraphModel.Segment>();
                    foreach (var simul in generationSimulation.Items)
                    {
                        for (int i = 0; i < phases.Count; i++)
                        {
                            var phase = phases[i];
                            if (!_boonDistribution[i].TryGetValue(boonid, out var distrib))
                            {
                                distrib = new Dictionary <ushort, OverAndValue>();
                                _boonDistribution[i].Add(boonid, distrib);
                            }
                            if (updateBoonPresence)
                            {
                                Add(_boonPresence[i], boonid, simul.GetClampedDuration(phase.Start, phase.End));
                            }
                            if (updateCondiPresence)
                            {
                                Add(_condiPresence[i], boonid, simul.GetClampedDuration(phase.Start, phase.End));
                            }
                            foreach (ushort src in simul.GetSrc())
                            {
                                if (distrib.TryGetValue(src, out var toModify))
                                {
                                    toModify.Value += simul.GetSrcDuration(src, phase.Start, phase.End);
                                    distrib[src]    = toModify;
                                }
                                else
                                {
                                    distrib.Add(src, new OverAndValue(
                                                    simul.GetSrcDuration(src, phase.Start, phase.End),
                                                    0));
                                }
                            }
                        }
                        List <BoonsGraphModel.Segment> segments = simul.ToSegment();
                        if (segments.Count > 0)
                        {
                            if (graphSegments.Count == 0)
                            {
                                graphSegments.Add(new BoonsGraphModel.Segment(0, segments.First().Start, 0));
                            }
                            else if (graphSegments.Last().End != segments.First().Start)
                            {
                                graphSegments.Add(new BoonsGraphModel.Segment(graphSegments.Last().End, segments.First().Start, 0));
                            }
                            graphSegments.AddRange(simul.ToSegment());
                        }
                    }
                    foreach (var simul in simulator.OverstackSimulationResult)
                    {
                        for (int i = 0; i < phases.Count; i++)
                        {
                            var phase = phases[i];
                            if (!_boonDistribution[i].TryGetValue(boonid, out var distrib))
                            {
                                distrib = new Dictionary <ushort, OverAndValue>();
                                _boonDistribution[i].Add(boonid, distrib);
                            }
                            if (distrib.TryGetValue(simul.Src, out var toModify))
                            {
                                toModify.Overstack += simul.GetOverstack(phase.Start, phase.End);
                                distrib[simul.Src]  = toModify;
                            }
                            else
                            {
                                distrib.Add(simul.Src, new OverAndValue(
                                                0,
                                                simul.GetOverstack(phase.Start, phase.End)));
                            }
                        }
                    }

                    if (updateCondiPresence)
                    {
                        foreach (var simul in simulator.CleanseSimulationResult)
                        {
                            for (int i = 0; i < phases.Count; i++)
                            {
                                var  phase   = phases[i];
                                long cleanse = simul.GetCleanseDuration(phase.Start, phase.End);
                                if (cleanse > 0)
                                {
                                    if (!_condiCleanse[i].TryGetValue(simul.ProvokedBy, out var dict))
                                    {
                                        dict = new Dictionary <long, List <long> >();
                                        _condiCleanse[i].Add(simul.ProvokedBy, dict);
                                    }
                                    if (!dict.TryGetValue(boonid, out var list))
                                    {
                                        list = new List <long>();
                                        dict.Add(boonid, list);
                                    }
                                    list.Add(cleanse);
                                }
                            }
                        }
                    }
                    if (requireExtraData)
                    {
                        GenerateExtraBoonData(log, boonid, generationSimulation, phases);
                    }
                    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.Name, 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[-2] = boonPresenceGraph;
            _boonPoints[-3] = condiPresenceGraph;
        }
示例#13
0
 public BoonMap(Boon boon) : base()
 {
     this[boon.getID()] = new List <BoonLog>();
 }
示例#14
0
 public DamageLogDamageModifier(Boon boon, string tooltip, long id, DamageSource damageSource, DamageType srctype, DamageType compareType, ModifierSource src, GainComputer gainComputer, ulong maxBuild = ulong.MaxValue) : base(boon.Name, tooltip, damageSource, double.PositiveInfinity, srctype, compareType, src, boon.Link, gainComputer, (dl => dl.SkillId == id), maxBuild)
 {
 }
 public BuffDamageModifierTarget(Boon buff, string tooltip, DamageSource damageSource, double gainPerStack, DamageType srctype, DamageType compareType, ModifierSource src, GainComputer gainComputer, DamageLogChecker dlChecker, ulong maxBuild = ulong.MaxValue) : base(buff, tooltip, damageSource, gainPerStack, srctype, compareType, src, gainComputer, dlChecker, maxBuild)
 {
 }
 public BuffDamageModifierTarget(Boon buff, string name, string tooltip, DamageSource damageSource, double gainPerStack, DamageType srctype, DamageType compareType, ModifierSource src, GainComputer gainComputer, string url, DamageLogChecker dlChecker) : base(buff, name, tooltip, damageSource, gainPerStack, srctype, compareType, src, gainComputer, url, dlChecker)
 {
 }
示例#17
0
 public BuffsTrackerSingle(Boon buff)
 {
     _id = buff.ID;
 }
 public BoonsGraphModel(Boon boon, List <SegmentWithSources> boonChartWithSource)
 {
     Boon = boon;
     _boonChartWithSource = boonChartWithSource;
     FuseFromSegmentsWithSource();
 }
示例#19
0
        // private getters
        private BoonMap getBoonMap(ParsedLog log, List <Boon> to_track)
        {
            BoonMap boon_map = new BoonMap();

            boon_map.add(to_track);
            // Fill in Boon Map
            long time_start = log.getBossData().getFirstAware();

            foreach (CombatItem c in log.getBoonData())
            {
                if (!boon_map.ContainsKey(c.getSkillID()))
                {
                    continue;
                }
                long   time = c.getTime() - time_start;
                ushort dst  = c.isBuffremove() == ParseEnum.BuffRemove.None ? c.getDstInstid() : c.getSrcInstid();
                if (agent.getInstid() == dst && time > 0 && time < log.getBossData().getAwareDuration())
                {
                    ushort src = c.getSrcMasterInstid() > 0 ? c.getSrcMasterInstid() : c.getSrcInstid();
                    if (c.isBuffremove() == ParseEnum.BuffRemove.None)
                    {
                        boon_map[c.getSkillID()].Add(new BoonLog(time, src, c.getValue(), 0));
                    }
                    else if (Boon.removePermission(c.getSkillID(), c.isBuffremove(), c.getIFF()))
                    {
                        if (c.isBuffremove() == ParseEnum.BuffRemove.All)//All
                        {
                            List <BoonLog> loglist = boon_map[c.getSkillID()];
                            for (int cnt = loglist.Count() - 1; cnt >= 0; cnt--)
                            {
                                BoonLog curBL = loglist[cnt];
                                if (curBL.getTime() + curBL.getValue() > time)
                                {
                                    long subtract = (curBL.getTime() + curBL.getValue()) - time;
                                    loglist[cnt].addValue(-subtract);
                                    // add removed as overstack
                                    loglist[cnt].addOverstack((ushort)subtract);
                                }
                            }
                        }
                        else if (c.isBuffremove() == ParseEnum.BuffRemove.Single)//Single
                        {
                            List <BoonLog> loglist = boon_map[c.getSkillID()];
                            int            cnt     = loglist.Count() - 1;
                            BoonLog        curBL   = loglist[cnt];
                            if (curBL.getTime() + curBL.getValue() > time)
                            {
                                long subtract = (curBL.getTime() + curBL.getValue()) - time;
                                loglist[cnt].addValue(-subtract);
                                // add removed as overstack
                                loglist[cnt].addOverstack((ushort)subtract);
                            }
                        }
                        else if (c.isBuffremove() == ParseEnum.BuffRemove.Manual)//Manuel
                        {
                            List <BoonLog> loglist = boon_map[c.getSkillID()];
                            for (int cnt = loglist.Count() - 1; cnt >= 0; cnt--)
                            {
                                BoonLog curBL = loglist[cnt];
                                long    ctime = curBL.getTime() + curBL.getValue();
                                if (ctime > time)
                                {
                                    long subtract = (curBL.getTime() + curBL.getValue()) - time;
                                    loglist[cnt].addValue(-subtract);
                                    // add removed as overstack
                                    loglist[cnt].addOverstack((ushort)subtract);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            return(boon_map);
        }
示例#20
0
 // Constructor
 public BoonsGraphModel(Boon boon)
 {
     Boon = boon;
 }
 public BoonMap(Boon boon)
 {
     this[boon.ID] = new List <BoonLog>();
 }
示例#22
0
        public void setBoonMap(BossData bossData, SkillData skillData, List <CombatItem> combatList)
        {
            // Initialize Boon Map with every Boon
            foreach (Boon boon in Boon.getMainList())
            {
                BoonMap map = new BoonMap(boon.getName(), new List <BoonLog>());
                boon_map.Add(map);
                // boon_map.put(boon.getName(), new ArrayList<BoonLog>());
            }
            foreach (Boon boon in Boon.getAllProfList())
            {
                BoonMap map = new BoonMap(boon.getName(), new List <BoonLog>());
                boon_map.Add(map);
                // boon_map.put(boon.getName(), new ArrayList<BoonLog>());
            }

            // Fill in Boon Map
            int time_start     = bossData.getFirstAware();
            int fight_duration = bossData.getLastAware() - time_start;

            foreach (CombatItem c in combatList)
            {
                if (instid == c.getDstInstid())
                {
                    String skill_name = skillData.getName(c.getSkillID());

                    if (c.isBuff() == 1 && c.getValue() > 0 && c.isBuffremove().getID() == 0)
                    {
                        int count = 0;
                        foreach (BoonMap bm in boon_map.ToList())
                        {
                            if (skill_name.Contains(bm.getName()))
                            {
                                int time = c.getTime() - time_start;
                                if (time < fight_duration)
                                {
                                    List <BoonLog> loglist = bm.getBoonLog();
                                    loglist.Add(new BoonLog(time, c.getValue(), c.getOverstackValue()));
                                    bm.setBoonLog(loglist);

                                    boon_map[count] = bm;
                                }
                                else
                                {
                                    break;
                                }
                            }
                            count++;
                        }
                    }
                    else
                    if (c.isBuffremove().getID() == 1 && c.getValue() > 0)//All
                    {
                        //finding correct boonmap
                        int count = 0;
                        foreach (BoonMap bm in boon_map.ToList())
                        {
                            if (skill_name.Contains(bm.getName()))
                            {
                                //make sure log is within fight time
                                int time = c.getTime() - time_start;
                                if (time < fight_duration)
                                {
                                    List <BoonLog> loglist = bm.getBoonLog();

                                    for (int cnt = loglist.Count() - 1; cnt >= 0; cnt--)
                                    {
                                        BoonLog curBL = loglist[cnt];
                                        if (curBL.getTime() + curBL.getValue() > time)
                                        {
                                            int subtract = (curBL.getTime() + curBL.getValue()) - time;
                                            loglist[cnt] = new BoonLog(curBL.getTime(), curBL.getValue() - subtract, curBL.getOverstack() + subtract);
                                        }
                                    }
                                    // loglist.Add(new BoonLog(time, c.getValue(), c.getOverstackValue()));
                                    bm.setBoonLog(loglist);
                                    boon_map[count] = bm;
                                }
                                else
                                {
                                    break;
                                }
                            }
                            count++;
                        }
                    }
                    else if (c.isBuffremove().getID() == 2 && c.getValue() > 0)//Single
                    {
                        //finding correct boonmap
                        int count = 0;
                        foreach (BoonMap bm in boon_map.ToList())
                        {
                            if (skill_name.Contains(bm.getName()))
                            {
                                if (bm.getName().Contains("Fury"))
                                {
                                    int stop = 0;
                                }

                                //make sure log is within fight time
                                int time = c.getTime() - time_start;
                                if (time < fight_duration)
                                {
                                    List <BoonLog> loglist = bm.getBoonLog();

                                    for (int cnt = loglist.Count() - 1; cnt >= 0; cnt--)
                                    {
                                        BoonLog curBL = loglist[cnt];
                                        if (curBL.getTime() + curBL.getValue() > time)
                                        {
                                            int subtract = (curBL.getTime() + curBL.getValue()) - time;
                                            loglist[cnt] = new BoonLog(curBL.getTime(), curBL.getValue() - subtract, curBL.getOverstack() + subtract);
                                            break;
                                        }
                                    }
                                    // loglist.Add(new BoonLog(time, c.getValue(), c.getOverstackValue()));
                                    bm.setBoonLog(loglist);
                                    boon_map[count] = bm;
                                    break;
                                }
                                else
                                {
                                    break;
                                }
                            }
                            count++;
                        }
                    }
                    else if (c.isBuffremove().getID() == 3 && c.getValue() > 0)//Manuel
                    {
                        //finding correct boonmap
                        int count = 0;
                        foreach (BoonMap bm in boon_map.ToList())
                        {
                            if (skill_name.Contains(bm.getName()))
                            {
                                if (bm.getName().Contains("Fury"))
                                {
                                    int stop = 0;
                                }
                                //make sure log is within fight time
                                int time = c.getTime() - time_start;
                                if (time < fight_duration)
                                {
                                    List <BoonLog> loglist = bm.getBoonLog();

                                    for (int cnt = loglist.Count() - 1; cnt >= 0; cnt--)
                                    {
                                        BoonLog curBL = loglist[cnt];
                                        if (curBL.getTime() + curBL.getValue() > time)
                                        {
                                            int subtract = (curBL.getTime() + curBL.getValue()) - time;
                                            loglist[cnt] = new BoonLog(curBL.getTime(), curBL.getValue() - subtract, curBL.getOverstack() + subtract);
                                            break;
                                        }
                                    }
                                    // loglist.Add(new BoonLog(time, c.getValue(), c.getOverstackValue()));
                                    bm.setBoonLog(loglist);
                                    boon_map[count] = bm;
                                    break;
                                }
                                else
                                {
                                    break;
                                }
                            }
                            count++;
                        }
                    }
                }
            }
        }
        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);
        }
示例#24
0
        private void setBoonDistribution(ParsedLog log, List <PhaseData> phases, List <Boon> to_track)
        {
            BoonMap to_use         = getBoonMap(log, to_track);
            long    dur            = log.getBossData().getAwareDuration();
            int     fight_duration = (int)(dur) / 1000;
            // Init boon presence points
            BoonsGraphModel boon_presence_points = new BoonsGraphModel("Number of Boons");

            for (int i = 0; i <= fight_duration; i++)
            {
                boon_presence_points.getBoonChart().Add(new Point(i, 0));
            }
            for (int i = 0; i < phases.Count; i++)
            {
                boon_distribution.Add(new BoonDistribution());
                boon_presence.Add(new Dictionary <int, long>());
            }

            var toFill         = new Point[dur + 1];
            var toFillPresence = new Point[dur + 1];

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

            foreach (Boon boon in to_track)
            {
                int boonid = boon.getID();
                if (to_use.TryGetValue(boonid, out var logs) && logs.Count != 0)
                {
                    if (boon_distribution[0].ContainsKey(boonid))
                    {
                        continue;
                    }
                    var simulator = boon.CreateSimulator();
                    simulator.simulate(logs, dur);
                    if (death > 0 && getCastLogs(log, death + 1, fight_duration).Count > 0)
                    {
                        simulator.trim(death - log.getBossData().getFirstAware());
                    }
                    else
                    {
                        simulator.trim(dur);
                    }
                    var simulation = simulator.getSimulationResult();
                    foreach (var simul in simulation)
                    {
                        for (int i = 0; i < phases.Count; i++)
                        {
                            var phase        = phases[i];
                            var presenceDict = boon_presence[i];
                            if (!boon_distribution[i].TryGetValue(boonid, out var distrib))
                            {
                                distrib = new Dictionary <ushort, OverAndValue>();
                                boon_distribution[i].Add(boonid, distrib);
                            }
                            Add(presenceDict, boonid, simul.getItemDuration(phase.getStart(), phase.getEnd()));
                            foreach (ushort src in simul.getSrc())
                            {
                                if (distrib.TryGetValue(src, out var toModify))
                                {
                                    toModify.value     += simul.getDuration(src, phase.getStart(), phase.getEnd());
                                    toModify.overstack += simul.getOverstack(src, phase.getStart(), phase.getEnd());
                                    distrib[src]        = toModify;
                                }
                                else
                                {
                                    distrib.Add(src, new OverAndValue(
                                                    simul.getDuration(src, phase.getStart(), phase.getEnd()),
                                                    simul.getOverstack(src, phase.getStart(), phase.getEnd())));
                                }
                            }
                        }
                    }
                    // Graphs
                    // full precision
                    for (int i = 0; i <= dur; i++)
                    {
                        toFill[i]         = new Point(i, 0);
                        toFillPresence[i] = new Point(i, 0);
                    }
                    foreach (var simul in simulation)
                    {
                        int start = (int)simul.getStart();
                        int end   = (int)simul.getEnd();

                        bool present = simul.getItemDuration() > 0;
                        for (int i = start; i <= end; i++)
                        {
                            toFill[i]         = new Point(i, simul.getStack(i));
                            toFillPresence[i] = new Point(i, present ? 1 : 0);
                        }
                    }
                    // reduce precision to seconds
                    var reducedPrecision   = new List <Point>(capacity: fight_duration + 1);
                    var boonPresence       = boon_presence_points.getBoonChart();
                    var updateBoonPresence = Boon.getBoonList().Any(x => x.getID() == boonid);
                    for (int i = 0; i <= fight_duration; i++)
                    {
                        reducedPrecision.Add(new Point(i, toFill[1000 * i].Y));
                        if (updateBoonPresence)
                        {
                            boonPresence[i] = new Point(i, boonPresence[i].Y + toFillPresence[1000 * i].Y);
                        }
                    }
                    boon_points[boonid] = new BoonsGraphModel(boon.getName(), reducedPrecision);
                }
            }
            boon_points[-2] = boon_presence_points;
        }
示例#25
0
 public BoonsGraphModel(Boon boon, List <Segment> boonChart)
 {
     Boon      = boon;
     BoonChart = boonChart;
     FuseSegments();
 }
 public BuffDamageModifier(Boon buff, string name, string tooltip, DamageSource damageSource, double gainPerStack, DamageType srctype, DamageType compareType, ModifierSource src, GainComputer gainComputer, string url, DamageLogChecker dlChecker, ulong maxBuild = ulong.MaxValue) : base(name, tooltip, damageSource, gainPerStack, srctype, compareType, src, url, gainComputer, dlChecker, maxBuild)
 {
     BuffsChecker = new BuffsTrackerSingle(buff);
 }