Beispiel #1
0
        public static int CompareByThreatPerCost(AbilityDK_Base a, AbilityDK_Base b, DKCostTypes t)
        {
            int   ic     = 0;
            float aRunes = 1;
            float bRunes = 1;

            // Sum of cost:
            switch (t)
            {
            case DKCostTypes.Blood:
                aRunes = a.AbilityCost[(int)DKCostTypes.Blood];
                bRunes = b.AbilityCost[(int)DKCostTypes.Blood];
                break;

            case DKCostTypes.Frost:
                aRunes = a.AbilityCost[(int)DKCostTypes.Frost];
                bRunes = b.AbilityCost[(int)DKCostTypes.Frost];
                break;

            case DKCostTypes.UnHoly:
                aRunes = a.AbilityCost[(int)DKCostTypes.UnHoly];
                bRunes = b.AbilityCost[(int)DKCostTypes.UnHoly];
                break;

            case DKCostTypes.Death:
                aRunes = a.AbilityCost[(int)DKCostTypes.Blood] + a.AbilityCost[(int)DKCostTypes.Frost] + a.AbilityCost[(int)DKCostTypes.UnHoly];
                bRunes = b.AbilityCost[(int)DKCostTypes.Blood] + b.AbilityCost[(int)DKCostTypes.Frost] + b.AbilityCost[(int)DKCostTypes.UnHoly];
                break;

            case DKCostTypes.CastTime:
            case DKCostTypes.CooldownTime:
            case DKCostTypes.DurationTime:
                aRunes = a.AbilityCost[(int)t] / 1000;
                bRunes = b.AbilityCost[(int)t] / 1000;
                break;

            case DKCostTypes.RunicPower:
                aRunes = a.AbilityCost[(int)t];
                bRunes = b.AbilityCost[(int)t];
                break;

            default:
                aRunes = 1;
                bRunes = 1;
                break;
            }
            if (aRunes != 0 || bRunes != 0)
            {
                if (aRunes != 0 && bRunes != 0)
                {
                    float avalue = a.GetTotalThreat() / aRunes;
                    float bvalue = b.GetTotalThreat() / bRunes;
                    if (avalue != bvalue)
                    {
                        // This is setup where we want a descending order.
                        if (avalue > bvalue)
                        {
                            ic = -1;
                        }
                        else
                        {
                            ic = 1;
                        }
                    }
                }
                else // one of them are 0
                {
                    if (aRunes > bRunes)
                    {
                        ic = -1;
                    }
                    else
                    {
                        ic = 1;
                    }
                }
            }
            return(ic);
        }
Beispiel #2
0
        public static int CompareValuePSPerRune(AbilityDK_Base a, AbilityDK_Base b, DKCostTypes t, bool bThreat)
        {
            int   ic     = 0;
            float aRunes = 1;
            float bRunes = 1;

            // Sum of cost:
            switch (t)
            {
            case DKCostTypes.Blood:
                aRunes = a.AbilityCost[(int)DKCostTypes.Blood];
                bRunes = b.AbilityCost[(int)DKCostTypes.Blood];
                break;

            case DKCostTypes.Frost:
                aRunes = a.AbilityCost[(int)DKCostTypes.Frost];
                bRunes = b.AbilityCost[(int)DKCostTypes.Frost];
                break;

            case DKCostTypes.UnHoly:
                aRunes = a.AbilityCost[(int)DKCostTypes.UnHoly];
                bRunes = b.AbilityCost[(int)DKCostTypes.UnHoly];
                break;

            case DKCostTypes.Death:
                aRunes = a.AbilityCost[(int)DKCostTypes.Blood] + a.AbilityCost[(int)DKCostTypes.Frost] + a.AbilityCost[(int)DKCostTypes.UnHoly];
                bRunes = b.AbilityCost[(int)DKCostTypes.Blood] + b.AbilityCost[(int)DKCostTypes.Frost] + b.AbilityCost[(int)DKCostTypes.UnHoly];
                break;

            case DKCostTypes.RunicPower:
                aRunes = a.RunicPower;
                bRunes = b.RunicPower;
                break;

            case DKCostTypes.CastTime:
            case DKCostTypes.CooldownTime:
            case DKCostTypes.DurationTime:
            default:
                aRunes = 1;
                bRunes = 1;
                break;
            }
            if (aRunes != 0 || bRunes != 0)
            {
                if (aRunes != 0 && bRunes != 0)
                {
                    float avalue = 0;
                    float bvalue = 0;
                    if (bThreat)
                    {
                        // Let's expand this to include triggered values as well.
                        avalue = a.GetTPS();
                        if (a.ml_TriggeredAbility != null)
                        {
                            foreach (AbilityDK_Base TriggerByA in a.ml_TriggeredAbility)
                            {
                                avalue += TriggerByA.GetTPS();
                            }
                        }
                        avalue /= aRunes;
                        bvalue  = b.GetTPS();
                        if (b.ml_TriggeredAbility != null)
                        {
                            foreach (AbilityDK_Base TriggerByA in b.ml_TriggeredAbility)
                            {
                                bvalue += TriggerByA.GetTPS();
                            }
                        }
                        bvalue /= bRunes;
                    }
                    else
                    {
                        // Let's expand this to include triggered values as well.
                        avalue = a.GetDPS();
                        if (a.ml_TriggeredAbility != null)
                        {
                            foreach (AbilityDK_Base TriggerByA in a.ml_TriggeredAbility)
                            {
                                avalue += TriggerByA.GetDPS();
                            }
                        }
                        avalue /= aRunes;
                        bvalue  = b.GetDPS();
                        if (b.ml_TriggeredAbility != null)
                        {
                            foreach (AbilityDK_Base TriggerByA in b.ml_TriggeredAbility)
                            {
                                bvalue += TriggerByA.GetDPS();
                            }
                        }
                        bvalue /= bRunes;
                    }
                    if (avalue != bvalue)
                    {
                        // This is setup where we want a descending order.
                        if (avalue > bvalue)
                        {
                            ic = -1;
                        }
                        else
                        {
                            ic = 1;
                        }
                    }
                }
                else // one of them are 0
                {
                    if (aRunes > bRunes)
                    {
                        ic = -1;
                    }
                    else
                    {
                        ic = 1;
                    }
                }
            }
            return(ic);
        }
Beispiel #3
0
        public static int CompareValuePSPerRune(AbilityDK_Base a, AbilityDK_Base b, DKCostTypes t, bool bThreat)
        {
            int ic = 0;
            float aRunes = 1;
            float bRunes = 1;

            // Sum of cost:
            switch (t)
            {
                case DKCostTypes.Blood:
                    aRunes = a.AbilityCost[(int)DKCostTypes.Blood];
                    bRunes = b.AbilityCost[(int)DKCostTypes.Blood];
                    break;
                case DKCostTypes.Frost:
                    aRunes = a.AbilityCost[(int)DKCostTypes.Frost];
                    bRunes = b.AbilityCost[(int)DKCostTypes.Frost];
                    break;
                case DKCostTypes.UnHoly:
                    aRunes = a.AbilityCost[(int)DKCostTypes.UnHoly];
                    bRunes = b.AbilityCost[(int)DKCostTypes.UnHoly];
                    break;
                case DKCostTypes.Death:
                    aRunes = a.AbilityCost[(int)DKCostTypes.Blood] + a.AbilityCost[(int)DKCostTypes.Frost] + a.AbilityCost[(int)DKCostTypes.UnHoly];
                    bRunes = b.AbilityCost[(int)DKCostTypes.Blood] + b.AbilityCost[(int)DKCostTypes.Frost] + b.AbilityCost[(int)DKCostTypes.UnHoly];
                    break;
                case DKCostTypes.RunicPower:
                    aRunes = a.RunicPower;
                    bRunes = b.RunicPower;
                    break;
                case DKCostTypes.CastTime:
                case DKCostTypes.CooldownTime:
                case DKCostTypes.DurationTime:
                default:
                    aRunes = 1;
                    bRunes = 1;
                    break;

            }
            if (aRunes != 0 || bRunes != 0)
            {
                if (aRunes != 0 && bRunes != 0)
                {
                    float avalue = 0;
                    float bvalue = 0;
                    if (bThreat)
                    {
                        // Let's expand this to include triggered values as well.
                        avalue = a.GetTPS();
                        if (a.ml_TriggeredAbility != null)
                        {
                            foreach (AbilityDK_Base TriggerByA in a.ml_TriggeredAbility)
                            {
                                avalue += TriggerByA.GetTPS();
                            }
                        }
                        avalue /= aRunes;
                        bvalue = b.GetTPS();
                        if (b.ml_TriggeredAbility != null)
                        {
                            foreach (AbilityDK_Base TriggerByA in b.ml_TriggeredAbility)
                            {
                                bvalue += TriggerByA.GetTPS();
                            }
                        }
                        bvalue /= bRunes;
                    }
                    else
                    {
                        // Let's expand this to include triggered values as well.
                        avalue = a.GetDPS();
                        if (a.ml_TriggeredAbility != null)
                        {
                            foreach (AbilityDK_Base TriggerByA in a.ml_TriggeredAbility)
                            {
                                avalue += TriggerByA.GetDPS();
                            }
                        }
                        avalue /= aRunes;
                        bvalue = b.GetDPS();
                        if (b.ml_TriggeredAbility != null)
                        {
                            foreach (AbilityDK_Base TriggerByA in b.ml_TriggeredAbility)
                            {
                                bvalue += TriggerByA.GetDPS();
                            }
                        }
                        bvalue /= bRunes;
                    }
                    if (avalue != bvalue)
                    {
                        // This is setup where we want a descending order.
                        if (avalue > bvalue)
                            ic = -1;
                        else
                            ic = 1;
                    }
                }
                else // one of them are 0
                {
                    if (aRunes > bRunes)
                        ic = -1;
                    else
                        ic = 1;
                }
            }
            return ic;
        }