Example #1
0
        /// <summary>
        /// Calculates on which phase the log started by checking Soo-Won's initial health and invulnerability buffs.
        /// </summary>
        ///
        /// <returns>An integer indicating on which phase the log started:
        /// <code>
        ///  0: 100% - 80%
        ///  1: First Greens
        ///  2: 80% - 60%
        ///  3: First Spear
        ///  4: First Champions
        ///  5: 60% - 40%
        ///  6: Second Greens
        ///  7: 40% - 20%
        ///  8: Second Spear
        ///  9: Second Champions
        /// 10: 20% - 0%
        /// </code>
        /// </returns>
        private static int GetPhaseOffset(ParsedEvtcLog log, AbstractSingleActor mainTarget)
        {
            double initialHealth = mainTarget.GetCurrentHealthPercent(log, 0);
            Func <Func <BuffApplyEvent, bool>, BuffApplyEvent> targetBuffs =
                log.CombatData.GetBuffData(mainTarget.AgentItem).OfType <BuffApplyEvent>().FirstOrDefault;
            AbstractBuffEvent initialInvuln      = targetBuffs(x => x.Initial && x.BuffID == Invulnerability757);
            AbstractBuffEvent initialDmgImmunity = targetBuffs(x => x.Initial && x.BuffID == SooWonSpearPhaseInvul); // spear phase

            int offset = 0;

            if (initialHealth <= 80 && initialHealth > 60)
            {
                offset = 2;
            }
            else if (initialHealth <= 60 && initialHealth > 40)
            {
                offset = 5;
            }
            else if (initialHealth <= 40 && initialHealth > 20)
            {
                offset = 7;
            }
            else if (initialHealth <= 20 && initialHealth > 0)
            {
                offset = 10;
            }

            if (offset > 0)
            {
                if (initialInvuln != null)
                {
                    offset--;
                }
                else if (initialDmgImmunity != null)
                {
                    offset++;
                }
            }

            return(offset);
        }