string[] GetDamageData(int powerLocation)
        {
            IPower enhancedPower = MainModule.MidsController.Toon.GetEnhancedPower(powerLocation);
            float  damageValue   = enhancedPower.FXGetDamageValue();
            float  rechargeTime  = enhancedPower.RechargeTime;
            float  num           = (float)(Math.Ceiling((double)(enhancedPower.CastTimeReal / 0.132f)) + 1.0) * 0.132f;
            float  endCost       = enhancedPower.EndCost;

            Enums.ShortFX effectMag  = enhancedPower.GetEffectMag(Enums.eEffectType.DamageBuff, Enums.eToWho.Self, false);
            Enums.ShortFX effectMag2 = enhancedPower.GetEffectMag(Enums.eEffectType.Resistance, Enums.eToWho.Target, false);
            effectMag.Multiply();
            effectMag2.Multiply();
            float num2 = damageValue / num;

            string[] strArray;
            if (damageValue != 0f)
            {
                string[] array = new string[]
                {
                    num2.ToString(),
                         damageValue.ToString(),
                         rechargeTime.ToString(),
                         num.ToString(),
                         endCost.ToString(),
                         effectMag.Sum.ToString(),
                         effectMag2.Sum.ToString(),
                         powerLocation.ToString()
                };
                strArray = array;
            }
            else
            {
                string[] array = new string[]
                {
                    "-",
                    "-",
                    rechargeTime.ToString(),
                    num.ToString(),
                    endCost.ToString(),
                    effectMag.Sum.ToString(),
                    effectMag2.Sum.ToString(),
                    powerLocation.ToString()
                };
                strArray = array;
            }
            return(strArray);
        }
Exemple #2
0
        string[] GetDamageData(int powerLocation)
        {
            IPower enhancedPower = MainModule.MidsController.Toon.GetEnhancedPower(powerLocation);
            float  damageValue   = enhancedPower.FXGetDamageValue();
            float  rechargeTime  = enhancedPower.RechargeTime;
            float  num1          = (float)(Math.Ceiling((double)enhancedPower.CastTimeReal / 0.131999999284744) + 1.0) * 0.132f;
            float  endCost       = enhancedPower.EndCost;

            Enums.ShortFX effectMag1 = enhancedPower.GetEffectMag(Enums.eEffectType.DamageBuff, Enums.eToWho.Self, false);
            Enums.ShortFX effectMag2 = enhancedPower.GetEffectMag(Enums.eEffectType.Resistance, Enums.eToWho.Target, false);
            effectMag1.Multiply();
            effectMag2.Multiply();
            float num2 = damageValue / num1;

            string[] strArray;
            if (damageValue != 0.0)
            {
                strArray = new string[8]
                {
                    num2.ToString(),
                        damageValue.ToString(),
                        rechargeTime.ToString(),
                        num1.ToString(),
                        endCost.ToString(),
                        effectMag1.Sum.ToString(),
                        effectMag2.Sum.ToString(),
                        powerLocation.ToString()
                }
            }
            ;
            else
            {
                strArray = new string[8]
                {
                    "-",
                    "-",
                    rechargeTime.ToString(),
                    num1.ToString(),
                    endCost.ToString(),
                    effectMag1.Sum.ToString(),
                    effectMag2.Sum.ToString(),
                    powerLocation.ToString()
                }
            };
            return(strArray);
        }

        void lvPower_ColumnClick(object sender, ColumnClickEventArgs e)
        {
            this.lvPower.Sort();
        }

        frmDPSCalc.PowerList[] IncrementRecharge(
            frmDPSCalc.PowerList[] List,
            float Time)
        {
            for (int index1 = 0; index1 < List.Length; ++index1)
            {
                int index2 = index1;
                List[index2].RechargeTimer -= Time;
            }
            return(List);
        }

        void CalculateDPS()
        {
            if (this.ibAutoMode.TextOff == "Automagical")
            {
                frmDPSCalc.PowerList[] array = new frmDPSCalc.PowerList[this.lvPower.Items.Count - 1];
                int length = 0;
                for (int index = 1; index < this.lvPower.Items.Count; ++index)
                {
                    if (this.lvPower.Items[0].Checked || this.lvPower.Items[index].Checked)
                    {
                        array[length].PowerName = this.lvPower.Items[index].Text;
                        if (this.lvPower.Items[index].SubItems[1].Text != "-")
                        {
                            array[length].Damage = float.Parse(this.lvPower.Items[index].SubItems[2].Text);
                            if (!this.chkDamageBuffs.Checked)
                            {
                                IPower basePower = MainModule.MidsController.Toon.GetBasePower(int.Parse(this.lvPower.Items[index].SubItems[8].Text), -1);
                                array[length].Damage += basePower.FXGetDamageValue() * (this.GlobalDamageBuff / 100f);
                            }
                            array[length].DPA      = float.Parse(this.lvPower.Items[index].SubItems[1].Text);
                            array[length].HidenDPA = float.Parse(this.lvPower.Items[index].SubItems[1].Text);
                        }
                        array[length].Recharge         = float.Parse(this.lvPower.Items[index].SubItems[3].Text);
                        array[length].Animation        = float.Parse(this.lvPower.Items[index].SubItems[4].Text);
                        array[length].Endurance        = float.Parse(this.lvPower.Items[index].SubItems[5].Text);
                        array[length].DamageBuff       = float.Parse(this.lvPower.Items[index].SubItems[6].Text);
                        array[length].ResistanceDeBuff = float.Parse(this.lvPower.Items[index].SubItems[7].Text);
                        array[length].RechargeTimer    = -1f;
                        if ((double)array[length].DamageBuff > 0.0 && (double)array[length].DPA != 0.0)
                        {
                            IPower basePower = MainModule.MidsController.Toon.GetBasePower(int.Parse(this.lvPower.Items[index].SubItems[8].Text), -1);
                            array[length].HidenDPA = basePower.FXGetDamageValue();
                            array[length].HidenDPA = array[length].HidenDPA * (array[length].DamageBuff / array[length].Recharge) / array[length].Animation;
                        }
                        ++length;
                    }
                }
                if (length < this.lvPower.Items.Count - 1)
                {
                    frmDPSCalc.PowerList[] powerListArray = array;
                    array = new frmDPSCalc.PowerList[length];
                    for (int index = 0; index < length; ++index)
                    {
                        array[index] = powerListArray[index];
                    }
                }
                if (array.Length > 1)
                {
                    Array.Sort(array, (x, y) => x.HidenDPA.CompareTo(y.HidenDPA));
                    float num1 = array[length - 1].Recharge + 5f;
                    int   num2 = length - 1;
                    while ((double)num1 > 0.0 && num2 > 0)
                    {
                        num1 -= array[num2--].Animation;
                    }
                    frmDPSCalc.PowerList[] List = new frmDPSCalc.PowerList[length - num2];
                    int num3 = 0;
                    for (int index = 0; index < length - num2; ++index)
                    {
                        if ((double)array[length - 1 - index].Recharge <= 20.0)
                        {
                            List[num3++] = array[length - 1 - index];
                        }
                    }
                    float num4 = 0.0f;
                    for (int index = 0; index < List.Length; ++index)
                    {
                        if ((double)num4 < (double)List[index].Recharge)
                        {
                            num4 = List[index].Recharge;
                        }
                    }
                    frmDPSCalc.PowerList[] AttackChain = new frmDPSCalc.PowerList[20];
                    int index1 = 1;
                    int index2 = 1;
                    AttackChain[0] = List[0];
                    float animation = AttackChain[0].Animation;
                    List[0].RechargeTimer = List[0].Recharge;
                    while ((double)animation < (double)num4 + 1.0)
                    {
                        for (int index3 = index1; index3 >= 0; --index3)
                        {
                            if (index1 >= List.Length)
                            {
                                animation += 0.01f;
                                List       = this.IncrementRecharge(List, 0.01f);
                            }
                            else if ((double)List[index3].RechargeTimer <= 0.0)
                            {
                                index1 = index3;
                            }
                        }
                        if (index1 >= List.Length)
                        {
                            --index1;
                            animation += 0.01f;
                            List       = this.IncrementRecharge(List, 0.01f);
                        }
                        while ((double)List[index1].RechargeTimer > 0.0)
                        {
                            ++index1;
                            if (index1 >= List.Length)
                            {
                                index1     = 0;
                                animation += 0.01f;
                                List       = this.IncrementRecharge(List, 0.01f);
                            }
                        }
                        AttackChain[index2] = List[index1];
                        animation          += AttackChain[index2].Animation;
                        List = this.IncrementRecharge(List, AttackChain[index2].Animation);
                        List[index1].RechargeTimer = List[index1].Recharge;
                        ++index1;
                        ++index2;
                    }
                    this.FillAttackChainWindow(AttackChain);
                }
                else if (array.Length == 1)
                {
                    this.tbDPSOutput.Text = "You cannot make an attack chain from one attack";
                }
                else
                {
                    this.tbDPSOutput.Text = "Come on Kiddo, gotta pick something :)";
                }
            }
            else
            {
                float num1 = 0.0f;
                float num2 = 0.0f;
                float num3 = 0.0f;
                bool  flag = true;
                for (int index = 0; index < this.GlobalPowerList.Length; ++index)
                {
                    if ((double)this.GlobalPowerList[index].Damage > 0.0)
                    {
                        num1 += this.GlobalPowerList[index].Damage;
                        num2 += this.GlobalPowerList[index].Endurance;
                        num3 += this.GlobalPowerList[index].Animation;
                        this.GlobalPowerList[index].RechargeTimer = this.GlobalPowerList[index].Recharge;
                    }
                    float animation = this.GlobalPowerList[index].Animation;
                }
                var powerListArray = new PowerList[this.GlobalPowerList.Length * 2];
                int num4           = 0;
                for (int index = 0; index < powerListArray.Length; ++index)
                {
                    if (index > this.GlobalPowerList.Length - 1)
                    {
                        num4 = index - (this.GlobalPowerList.Length - 1) - 1;
                    }
                    powerListArray[index] = this.GlobalPowerList[num4++];
                }
                for (int index1 = 0; index1 < powerListArray.Length; ++index1)
                {
                    for (int index2 = index1 + 1; index2 < powerListArray.Length; ++index2)
                    {
                        if (powerListArray[index1].PowerName != powerListArray[index2].PowerName)
                        {
                            powerListArray[index1].RechargeTimer -= powerListArray[index2].Animation;
                        }
                        else if ((double)powerListArray[index1].RechargeTimer > 0.0)
                        {
                            flag = false;
                        }
                    }
                }
                for (int index1 = powerListArray.Length - 1; index1 >= 0; --index1)
                {
                    for (int index2 = index1 - 1; index2 >= 0; --index2)
                    {
                        if (powerListArray[index1].PowerName != powerListArray[index2].PowerName)
                        {
                            powerListArray[index1].RechargeTimer -= powerListArray[index2].Animation;
                        }
                        else if ((double)powerListArray[index1].RechargeTimer > 0.0)
                        {
                            flag = false;
                        }
                    }
                }
                if (!flag)
                {
                    this.lblHeader.ForeColor = System.Drawing.Color.Red;
                    this.lblHeader.Text      = "Impossible Chain";
                }
                else
                {
                    this.lblHeader.ForeColor = System.Drawing.Color.FromArgb(192, 192, (int)byte.MaxValue);
                    this.lblHeader.Text      = "You may select -All Powers- or just the powers you want to consider.";
                }
                this.lblDPSNum.Text = (num1 / num3).ToString();
                this.lblEPSNum.Text = (num2 / num3).ToString();
            }
        }
 void CalculateDPS()
 {
     if (this.ibAutoMode.TextOff == "Automagical")
     {
         frmDPSCalc.PowerList[] array = new frmDPSCalc.PowerList[this.lvPower.Items.Count - 1];
         int length = 0;
         for (int index = 1; index < this.lvPower.Items.Count; index++)
         {
             if (this.lvPower.Items[0].Checked || this.lvPower.Items[index].Checked)
             {
                 array[length].PowerName = this.lvPower.Items[index].Text;
                 if (this.lvPower.Items[index].SubItems[1].Text != "-")
                 {
                     array[length].Damage = float.Parse(this.lvPower.Items[index].SubItems[2].Text);
                     if (!this.chkDamageBuffs.Checked)
                     {
                         IPower basePower = MainModule.MidsController.Toon.GetBasePower(int.Parse(this.lvPower.Items[index].SubItems[8].Text), -1);
                         frmDPSCalc.PowerList[] array2 = array;
                         int num9 = length;
                         array2[num9].Damage = array2[num9].Damage + basePower.FXGetDamageValue() * (this.GlobalDamageBuff / 100f);
                     }
                     array[length].DPA      = float.Parse(this.lvPower.Items[index].SubItems[1].Text);
                     array[length].HidenDPA = float.Parse(this.lvPower.Items[index].SubItems[1].Text);
                 }
                 array[length].Recharge         = float.Parse(this.lvPower.Items[index].SubItems[3].Text);
                 array[length].Animation        = float.Parse(this.lvPower.Items[index].SubItems[4].Text);
                 array[length].Endurance        = float.Parse(this.lvPower.Items[index].SubItems[5].Text);
                 array[length].DamageBuff       = float.Parse(this.lvPower.Items[index].SubItems[6].Text);
                 array[length].ResistanceDeBuff = float.Parse(this.lvPower.Items[index].SubItems[7].Text);
                 array[length].RechargeTimer    = -1f;
                 if (array[length].DamageBuff > 0f && array[length].DPA != 0f)
                 {
                     IPower basePower = MainModule.MidsController.Toon.GetBasePower(int.Parse(this.lvPower.Items[index].SubItems[8].Text), -1);
                     array[length].HidenDPA = basePower.FXGetDamageValue();
                     array[length].HidenDPA = array[length].HidenDPA * (array[length].DamageBuff / array[length].Recharge) / array[length].Animation;
                 }
                 length++;
             }
         }
         if (length < this.lvPower.Items.Count - 1)
         {
             frmDPSCalc.PowerList[] powerListArray = array;
             array = new frmDPSCalc.PowerList[length];
             for (int index = 0; index < length; index++)
             {
                 array[index] = powerListArray[index];
             }
         }
         if (array.Length > 1)
         {
             Array.Sort <frmDPSCalc.PowerList>(array, (frmDPSCalc.PowerList x, frmDPSCalc.PowerList y) => x.HidenDPA.CompareTo(y.HidenDPA));
             float num10 = array[length - 1].Recharge + 5f;
             float num   = num10;
             int   num2  = length - 1;
             while (num > 0f && num2 > 0)
             {
                 num -= array[num2--].Animation;
             }
             frmDPSCalc.PowerList[] List = new frmDPSCalc.PowerList[length - num2];
             int num3 = 0;
             for (int index = 0; index < length - num2; index++)
             {
                 if (array[length - 1 - index].Recharge <= 20f)
                 {
                     List[num3++] = array[length - 1 - index];
                 }
             }
             float num4 = 0f;
             for (int index = 0; index < List.Length; index++)
             {
                 if (num4 < List[index].Recharge)
                 {
                     num4 = List[index].Recharge;
                 }
             }
             frmDPSCalc.PowerList[] AttackChain = new frmDPSCalc.PowerList[20];
             int index2 = 1;
             int index3 = 1;
             AttackChain[0] = List[0];
             float animation = AttackChain[0].Animation;
             List[0].RechargeTimer = List[0].Recharge;
             while (animation < num4 + 1f)
             {
                 for (int index = index2; index >= 0; index--)
                 {
                     if (index2 >= List.Length)
                     {
                         animation += 0.01f;
                         List       = this.IncrementRecharge(List, 0.01f);
                     }
                     else if (List[index].RechargeTimer <= 0f)
                     {
                         index2 = index;
                     }
                 }
                 if (index2 >= List.Length)
                 {
                     index2--;
                     animation += 0.01f;
                     List       = this.IncrementRecharge(List, 0.01f);
                 }
                 while (List[index2].RechargeTimer > 0f)
                 {
                     index2++;
                     if (index2 >= List.Length)
                     {
                         index2     = 0;
                         animation += 0.01f;
                         List       = this.IncrementRecharge(List, 0.01f);
                     }
                 }
                 AttackChain[index3] = List[index2];
                 animation          += AttackChain[index3].Animation;
                 List = this.IncrementRecharge(List, AttackChain[index3].Animation);
                 List[index2].RechargeTimer = List[index2].Recharge;
                 index2++;
                 index3++;
             }
             this.FillAttackChainWindow(AttackChain);
         }
         else if (array.Length == 1)
         {
             this.tbDPSOutput.Text = "You cannot make an attack chain from one attack";
         }
         else
         {
             this.tbDPSOutput.Text = "Come on Kiddo, gotta pick something :)";
         }
     }
     else
     {
         float num5 = 0f;
         float num6 = 0f;
         float num7 = 0f;
         bool  flag = true;
         for (int index = 0; index < this.GlobalPowerList.Length; index++)
         {
             if (this.GlobalPowerList[index].Damage > 0f)
             {
                 num5 += this.GlobalPowerList[index].Damage;
                 num6 += this.GlobalPowerList[index].Endurance;
                 num7 += this.GlobalPowerList[index].Animation;
                 this.GlobalPowerList[index].RechargeTimer = this.GlobalPowerList[index].Recharge;
             }
             float animation = this.GlobalPowerList[index].Animation;
         }
         frmDPSCalc.PowerList[] powerListArray2 = new frmDPSCalc.PowerList[this.GlobalPowerList.Length * 2];
         int num8 = 0;
         for (int index = 0; index < powerListArray2.Length; index++)
         {
             if (index > this.GlobalPowerList.Length - 1)
             {
                 num8 = index - (this.GlobalPowerList.Length - 1) - 1;
             }
             powerListArray2[index] = this.GlobalPowerList[num8++];
         }
         for (int index = 0; index < powerListArray2.Length; index++)
         {
             for (int index4 = index + 1; index4 < powerListArray2.Length; index4++)
             {
                 if (powerListArray2[index].PowerName != powerListArray2[index4].PowerName)
                 {
                     frmDPSCalc.PowerList[] array3 = powerListArray2;
                     int num11 = index;
                     array3[num11].RechargeTimer = array3[num11].RechargeTimer - powerListArray2[index4].Animation;
                 }
                 else if (powerListArray2[index].RechargeTimer > 0f)
                 {
                     flag = false;
                 }
             }
         }
         for (int index = powerListArray2.Length - 1; index >= 0; index--)
         {
             for (int index4 = index - 1; index4 >= 0; index4--)
             {
                 if (powerListArray2[index].PowerName != powerListArray2[index4].PowerName)
                 {
                     frmDPSCalc.PowerList[] array4 = powerListArray2;
                     int num12 = index;
                     array4[num12].RechargeTimer = array4[num12].RechargeTimer - powerListArray2[index4].Animation;
                 }
                 else if (powerListArray2[index].RechargeTimer > 0f)
                 {
                     flag = false;
                 }
             }
         }
         if (!flag)
         {
             this.lblHeader.ForeColor = Color.Red;
             this.lblHeader.Text      = "Impossible Chain";
         }
         else
         {
             this.lblHeader.ForeColor = Color.FromArgb(192, 192, 255);
             this.lblHeader.Text      = "You may select -All Powers- or just the powers you want to consider.";
         }
         this.lblDPSNum.Text = (num5 / num7).ToString();
         this.lblEPSNum.Text = (num6 / num7).ToString();
     }
 }