public Parameters(SpecialEffect[] effects, float[] triggerInterval, float[] triggerChance, float[] offset, float attackSpeed, float[] scale, float[] value, float fightDuration)
            {
                //this.effects = effects;
                //this.triggerInterval = triggerInterval;
                d = new float[effects.Length];
                p = new float[effects.Length];
                c = new float[effects.Length];
                o = new float[effects.Length];
                k = new float[effects.Length];
                v = new float[effects.Length];
                this.effects = new SpecialEffect[effects.Length];
                this.triggerInterval = new float[effects.Length];
                /*k = scale;
                if (scale == null)
                {
                    k = new float[effects.Length];
                    for (int i = 0; i < effects.Length; i++)
                    {
                        k[i] = 1.0f;
                    }
                }*/

                bool discretizationCorrection = true;

                // sort it so that we have nonstationary effects first
                int j = 0;
                for (int i = 0; i < effects.Length; i++)
                {
                    if (effects[i].Cooldown > effects[i].Duration)
                    {
                        I = i;
                        this.effects[j] = effects[i];
                        this.triggerInterval[j] = triggerInterval[i];
                        if (scale == null)
                        {
                            k[j] = 1.0f;
                        }
                        else
                        {
                            k[j] = scale[i];
                        }
                        if (value != null)
                        {
                            v[j] = value[i];
                        }
                        p[j] = triggerChance[i] * effects[i].GetChance(attackSpeed);
                        if (triggerInterval[i] == 0.0f)
                        {
                            // on use effects
                            d[j] = effects[i].Duration;
                            c[j] = effects[i].Cooldown;
                            o[j] = offset[i];
                        }
                        else
                        {
                            d[j] = effects[i].Duration / triggerInterval[i];
                            c[j] = effects[i].Cooldown / triggerInterval[i];
                            if (discretizationCorrection)
                            {
                                c[j] += 0.5f;
                            }
                            if (c[j] < 1.0f) c[j] = 0.0f; // no cooldown model, WARNING: we currently don't support the case where 0 < cooldown < duration
                            o[j] = offset[i] / triggerInterval[i];
                        }
                        j++;
                    }
                }

                N = j;
                NC = (1 << N);

                uptime = new float[effects.Length];
                combinedUptime = new float[5 + 2 * maxRecursionDepth, NC];
                partialIntegral = new float[5 + 2 * maxRecursionDepth, NC];

                for (int i = 0; i < effects.Length; i++)
                {
                    if (effects[i].Cooldown <= effects[i].Duration)
                    {
                        this.effects[j] = effects[i];
                        if (value != null)
                        {
                            v[j] = value[i];
                        }
                        uptime[j] = effects[i].GetAverageUptime(triggerInterval[i], triggerChance[i], attackSpeed, fightDuration);
                        if (scale != null)
                        {
                            uptime[j] *= scale[i];
                        }
                        j++;
                    }
                }

                switch (Properties.GeneralSettings.Default.CombinationEffectMode)
                {
                    case 0:
                        Ibeta = SpecialFunction.IbetaInterpolatedLinear;
                        break;
                    case 1:
                        Ibeta = SpecialFunction.IbetaInterpolated;
                        break;
                    case 2:
                    default:
                        Ibeta = SpecialFunction.Ibeta;
                        break;
                }
            }
Ejemplo n.º 2
0
            public Parameters(SpecialEffect[] effects, float[] triggerInterval, float[] triggerChance, float[] offset, float attackSpeed, float[] scale, float[] value, float fightDuration)
            {
                //this.effects = effects;
                //this.triggerInterval = triggerInterval;
                d                    = new float[effects.Length];
                p                    = new float[effects.Length];
                c                    = new float[effects.Length];
                o                    = new float[effects.Length];
                k                    = new float[effects.Length];
                v                    = new float[effects.Length];
                this.effects         = new SpecialEffect[effects.Length];
                this.triggerInterval = new float[effects.Length];

                /*k = scale;
                 * if (scale == null)
                 * {
                 *  k = new float[effects.Length];
                 *  for (int i = 0; i < effects.Length; i++)
                 *  {
                 *      k[i] = 1.0f;
                 *  }
                 * }*/

                bool discretizationCorrection = true;

                // sort it so that we have nonstationary effects first
                int j = 0;

                for (int i = 0; i < effects.Length; i++)
                {
                    if (effects[i].Cooldown > effects[i].Duration)
                    {
                        I = i;
                        this.effects[j]         = effects[i];
                        this.triggerInterval[j] = triggerInterval[i];
                        if (scale == null)
                        {
                            k[j] = 1.0f;
                        }
                        else
                        {
                            k[j] = scale[i];
                        }
                        if (value != null)
                        {
                            v[j] = value[i];
                        }
                        p[j] = triggerChance[i] * effects[i].GetChance(attackSpeed);
                        if (triggerInterval[i] == 0.0f)
                        {
                            // on use effects
                            d[j] = effects[i].Duration;
                            c[j] = effects[i].Cooldown;
                            o[j] = offset[i];
                        }
                        else
                        {
                            d[j] = effects[i].Duration / triggerInterval[i];
                            c[j] = effects[i].Cooldown / triggerInterval[i];
                            if (discretizationCorrection)
                            {
                                c[j] += 0.5f;
                            }
                            if (c[j] < 1.0f)
                            {
                                c[j] = 0.0f;              // no cooldown model, WARNING: we currently don't support the case where 0 < cooldown < duration
                            }
                            o[j] = offset[i] / triggerInterval[i];
                        }
                        j++;
                    }
                }

                N  = j;
                NC = (1 << N);

                uptime          = new float[effects.Length];
                combinedUptime  = new float[5 + 2 * maxRecursionDepth, NC];
                partialIntegral = new float[5 + 2 * maxRecursionDepth, NC];

                for (int i = 0; i < effects.Length; i++)
                {
                    if (effects[i].Cooldown <= effects[i].Duration)
                    {
                        this.effects[j] = effects[i];
                        if (value != null)
                        {
                            v[j] = value[i];
                        }
                        uptime[j] = effects[i].GetAverageUptime(triggerInterval[i], triggerChance[i], attackSpeed, fightDuration);
                        if (scale != null)
                        {
                            uptime[j] *= scale[i];
                        }
                        j++;
                    }
                }

                switch (Properties.GeneralSettings.Default.CombinationEffectMode)
                {
                case 0:
                    Ibeta = SpecialFunction.IbetaInterpolatedLinear;
                    break;

                case 1:
                    Ibeta = SpecialFunction.IbetaInterpolated;
                    break;

                case 2:
                default:
                    Ibeta = SpecialFunction.Ibeta;
                    break;
                }
            }