Esempio n. 1
0
        internal void AssasinationCombo(Obj_AI_Hero target)
        {
            if ((target != null))
            {
                var dist = Khazix.Distance(target);

                // Normal abilities

                if (Q.IsReady() && dist <= Q.Range)
                {
                    Q.Cast(target);
                }

                if (W.IsReady() && !EvolvedW && dist <= W.Range)
                {
                    var pred = W.GetPrediction(target);
                    if (pred.Hitchance >= Config.GetHitChance("WHitchance"))
                    {
                        W.Cast(pred.CastPosition);
                    }
                }

                else if (W.IsReady() && EvolvedW && dist <= WE.Range)
                {
                    PredictionOutput pred = WE.GetPrediction(target);
                    CastWE(target, pred.UnitPosition.To2D(), 0);
                }

                if (Config.GetBool("UseItems"))
                {
                    UseItems(target);
                }
            }
        }
 int StepI  = 0;                                 //Var To Step Shoot Toly
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     PhysicsTimer.Stop();                         //Close Thread Because Window Closed
     JumpTimerM.Stop();                           //Close Thread Because Window Closed
     JumpTimerT.Stop();                           //Close Thread Because Window Closed
     RightTimerM.Stop();                          //Close Thread Because Window Closed
     RightTimerT.Stop();                          //Close Thread Because Window Closed
     LeftTimerT.Stop();                           //Close Thread Because Window Closed
     LeftTimerM.Stop();                           //Close Thread Because Window Closed
     WE.Stop();                                   //Close Thread Because Window Closed
 }
        private string Get_StageFour(string regPipline3)
        {
            string MEM_WB;

            string[] Arr_regPipline4 = regPipline3.Split('|');
            string[] arr_M           = Arr_regPipline4[1].Split('&');
            WE = Arr_regPipline4[0];
            string[] x = WE.Split('&');
            if (arr_M[2] != "1")
            {
                PiplineGrid.Rows[25].Cells[0].Value = "MEM/WB RegWrite";
                PiplineGrid.Rows[25].Cells[1].Value = x[0];
                PiplineGrid.Rows[26].Cells[0].Value = "MEM/WB memToReg";
                PiplineGrid.Rows[26].Cells[1].Value = x[1];
                PiplineGrid.Rows[27].Cells[0].Value = "MEM/WB ReadData";
                PiplineGrid.Rows[27].Cells[1].Value = "Not VAl";
                PiplineGrid.Rows[28].Cells[0].Value = "MEM/WB resALU";
                PiplineGrid.Rows[28].Cells[1].Value = Arr_regPipline4[3];
                PiplineGrid.Rows[29].Cells[0].Value = "MEM/WB RegDstRet";
                PiplineGrid.Rows[29].Cells[1].Value = Arr_regPipline4[5];
                MEM_WB = WE + "|" + "Not VAl" + "|" + Arr_regPipline4[3] + "|" + Arr_regPipline4[5];
            }
            else
            {
                PiplineGrid.Rows[25].Cells[0].Value        = "MEM/WB RegWrite";
                PiplineGrid.Rows[25].Cells[1].Value        = x[0];
                PiplineGrid.Rows[26].Cells[0].Value        = "MEM/WB memToReg";
                PiplineGrid.Rows[26].Cells[1].Value        = x[1];
                PiplineGrid.Rows[27].Cells[0].Value        = "MEM/WB ReadData";
                PiplineGrid.Rows[27].Cells[1].Value        = "Not VAl";
                PiplineGrid.Rows[28].Cells[0].Value        = "MEM/WB resALU";
                PiplineGrid.Rows[28].Cells[1].Value        = Arr_regPipline4[3];
                PiplineGrid.Rows[29].Cells[0].Value        = "MEM/WB RegDstRet";
                PiplineGrid.Rows[29].Cells[1].Value        = "NOT dest this SW";
                MipsMemory[uint.Parse(Arr_regPipline4[3])] = Arr_regPipline4[4];
                MemoryGrid.Rows[int.Parse(Arr_regPipline4[3])].Cells[1].Value = Arr_regPipline4[4];
                MEM_WB = "x";
            }

            return(MEM_WB);
        }
Esempio n. 4
0
 void Harass()
 {
     if (getCheckBoxItem(harass, "UseQHarass") && Q.IsReady())
     {
         var enemy = TargetSelector.GetTarget(Q.Range, DamageType.Physical);
         if (enemy.IsValidEnemy())
         {
             Q.Cast(enemy);
         }
     }
     if (getCheckBoxItem(harass, "UseWHarass") && W.IsReady())
     {
         AIHeroClient target    = TargetSelector.GetTarget(950, DamageType.Physical);
         var          autoWI    = getCheckBoxItem(harass, "Harass.AutoWI");
         var          autoWD    = getCheckBoxItem(harass, "Harass.AutoWD");
         var          hitchance = HarassHitChance(Config);
         if (target != null && W.IsReady())
         {
             if (!EvolvedW && Khazix.Distance(target) <= W.Range)
             {
                 PredictionOutput predw = W.GetPrediction(target);
                 if (predw.Hitchance == hitchance)
                 {
                     W.Cast(predw.CastPosition);
                 }
             }
             else if (EvolvedW && target.IsValidTarget(W.Range))
             {
                 PredictionOutput pred = WE.GetPrediction(target);
                 if ((pred.Hitchance == HitChance.Immobile && autoWI) || (pred.Hitchance == HitChance.Dashing && autoWD) || pred.Hitchance >= hitchance)
                 {
                     CastWE(target, pred.UnitPosition.To2D(), 0, hitchance);
                 }
             }
         }
     }
 }
        public Win()
        {
            InitializeComponent();
            PhysicsTimer          = new System.Windows.Threading.DispatcherTimer();      //Set Timer(all 1ms)
            PhysicsTimer.Interval = TimeSpan.FromMilliseconds(1);                        //Set Timer(all 1ms)
            PhysicsTimer.Tick    += PhysicsTimer_Tick;                                   //Set Timer(all 1ms)
                                                                                         //Set Timer(all 1ms)
            JumpTimerM          = new System.Windows.Threading.DispatcherTimer();        //Set Timer(all 1ms)
            JumpTimerM.Interval = TimeSpan.FromMilliseconds(1);                          //Set Timer(all 1ms)
            JumpTimerM.Tick    += JumpTimerM_Tick;                                       //Set Timer(all 1ms)
                                                                                         //Set Timer(all 1ms)
            JumpTimerT          = new System.Windows.Threading.DispatcherTimer();        //Set Timer(all 1ms)
            JumpTimerT.Interval = TimeSpan.FromMilliseconds(1);                          //Set Timer(all 1ms)
            JumpTimerT.Tick    += JumpTimerT_Tick;                                       //Set Timer(all 1ms)
                                                                                         //Set Timer(all 1ms)
            RightTimerM          = new System.Windows.Threading.DispatcherTimer();       //Set Timer(all 1ms)
            RightTimerM.Interval = TimeSpan.FromMilliseconds(1);                         //Set Timer(all 1ms)
            RightTimerM.Tick    += RightTimerM_Tick;                                     //Set Timer(all 1ms)
                                                                                         //Set Timer(all 1ms)
            LeftTimerM          = new System.Windows.Threading.DispatcherTimer();        //Set Timer(all 1ms)
            LeftTimerM.Interval = TimeSpan.FromMilliseconds(1);                          //Set Timer(all 1ms)
            LeftTimerM.Tick    += LeftTimerM_Tick;                                       //Set Timer(all 1ms)
                                                                                         //Set Timer(all 1ms)
            RightTimerT          = new System.Windows.Threading.DispatcherTimer();       //Set Timer(all 1ms)
            RightTimerT.Interval = TimeSpan.FromMilliseconds(1);                         //Set Timer(all 1ms)
            RightTimerT.Tick    += RightTimerT_Tick;                                     //Set Timer(all 1ms)
                                                                                         //Set Timer(all 1ms)
            LeftTimerT          = new System.Windows.Threading.DispatcherTimer();        //Set Timer(all 1ms)
            LeftTimerT.Interval = TimeSpan.FromMilliseconds(1);                          //Set Timer(all 1ms)
            LeftTimerT.Tick    += LeftTimerT_Tick;                                       //Set Timer(all 1ms)
            rnd  = new Random();                                                         //Set Timer(all 1ms)
            rand = rnd.Next(10, 16);                                                     //Set Timer(all 1ms)

            this.Opacity = Class1.brightness / 1850;                                     //Brightness
            WE.Volume    = Class1.Volume;                                                //Volume Music
            WE.Play();                                                                   //Start Music
        }
Esempio n. 6
0
        void Combo()
        {
            AIHeroClient target = null;

            if (SpellSlot.E.IsReady() && SpellSlot.Q.IsReady())
            {
                target = TargetSelector.GetTarget((E.Range + Q.Range) * 0.95f, DamageType.Physical);
            }

            if (target == null)
            {
                target = TargetSelector.GetTarget(W.Range, DamageType.Physical);
            }

            if ((target != null))
            {
                var dist = Khazix.Distance(target);

                // Normal abilities

                if (Q.IsReady() && !Jumping && getCheckBoxItem(combo, "UseQCombo"))
                {
                    if (dist <= Q.Range)
                    {
                        Q.Cast(target);
                    }
                }

                if (W.IsReady() && !EvolvedW && dist <= W.Range && getCheckBoxItem(combo, "UseWCombo"))
                {
                    var pred = W.GetPrediction(target);
                    if (pred.Hitchance >= Config.GetHitChance("WHitchance"))
                    {
                        W.Cast(pred.CastPosition);
                    }
                }

                if (E.IsReady() && !Jumping && dist <= E.Range && getCheckBoxItem(combo, "UseECombo") && dist > Q.Range + (0.7 * Khazix.MoveSpeed))
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead && ShouldJump(pred.CastPosition))
                    {
                        E.Cast(pred.CastPosition);
                    }
                }

                // Use EQ AND EW Synergy
                if ((dist <= E.Range + Q.Range + (0.7 * Khazix.MoveSpeed) && dist > Q.Range && E.IsReady() &&
                     getCheckBoxItem(combo, "UseEGapclose")) || (dist <= E.Range + W.Range && dist > Q.Range && E.IsReady() && W.IsReady() &&
                                                                 getCheckBoxItem(combo, "UseEGapcloseW")))
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead && ShouldJump(pred.CastPosition))
                    {
                        E.Cast(pred.CastPosition);
                    }
                    if (getCheckBoxItem(combo, "UseRGapcloseW") && R.IsReady())
                    {
                        R.CastOnUnit(Khazix);
                    }
                }


                // Ult Usage
                if (R.IsReady() && !Q.IsReady() && !W.IsReady() && !E.IsReady() &&
                    getCheckBoxItem(combo, "UseRCombo"))
                {
                    R.Cast();
                }
                // Evolved

                if (W.IsReady() && EvolvedW && dist <= WE.Range && getCheckBoxItem(combo, "UseWCombo"))
                {
                    PredictionOutput pred = WE.GetPrediction(target);
                    if (pred.Hitchance >= Config.GetHitChance("WHitchance"))
                    {
                        CastWE(target, pred.UnitPosition.To2D(), 0, Config.GetHitChance("WHitchance"));
                    }
                    if (pred.Hitchance >= HitChance.Collision)
                    {
                        List <Obj_AI_Base> PCollision = pred.CollisionObjects;
                        var x = PCollision.Where(PredCollisionChar => PredCollisionChar.Distance(target) <= 30).FirstOrDefault();
                        if (x != null)
                        {
                            W.Cast(x.Position);
                        }
                    }
                }

                if (dist <= E.Range + (0.7 * Khazix.MoveSpeed) && dist > Q.Range &&
                    getCheckBoxItem(combo, "UseECombo") && E.IsReady())
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead && ShouldJump(pred.CastPosition))
                    {
                        E.Cast(pred.CastPosition);
                    }
                }

                if (getCheckBoxItem(combo, "UseItems"))
                {
                    UseItems(target);
                }
            }
        }
 private void media_MediaEnded(object sender, RoutedEventArgs e)
 {
     WE.Stop();
     WE.Play();
 }
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Right)
            {
                RightTimerM.Start();
            }
            if (e.Key == Key.Left)
            {
                LeftTimerM.Start();
            }
            if (e.Key == Key.Up || e.Key == Key.Space && CanJumpM)
            {
                JumpTimerM.Start();
            }
            if (e.Key == Key.Escape)
            {
                if (PhysicsTimer.IsEnabled == false)
                {
                    PhysicsTimer.Start();
                    lblEsc.Content    = "Oops ;(";
                    PressM.Visibility = Visibility.Visible;
                    PressT.Visibility = Visibility.Visible;
                    Canvas.SetLeft(PressM, Canvas.GetLeft(Margalit) - 25);
                    Canvas.SetTop(PressM, Canvas.GetTop(Margalit) - 40);

                    Canvas.SetLeft(PressT, Canvas.GetLeft(Toly) - 70);
                    Canvas.SetTop(PressT, Canvas.GetTop(Toly) - 60);

                    MoveLbl = true;
                    WE.Stop();
                }
            }
            if (start)
            {
                if (shootM == false)
                {
                    if (e.Key == Key.Enter)
                    {
                        shootM = true;
                        Canvas.SetTop(Algo, Canvas.GetTop(Margalit));
                        Canvas.SetLeft(Algo, Canvas.GetLeft(Margalit));
                    }
                }
                if (shootT == false)
                {
                    if (e.Key == Key.G)
                    {
                        StepI++;
                        shootT = true;
                        Canvas.SetTop(Step, Canvas.GetTop(Toly));
                        Canvas.SetLeft(Step, Canvas.GetLeft(Toly));
                    }
                }
            }
            if (e.Key == Key.A)
            {
                LeftTimerT.Start();
            }
            if (e.Key == Key.D)
            {
                RightTimerT.Start();
            }
            if (e.Key == Key.W && CanJumpT)
            {
                JumpTimerT.Start();
            }
        }
Esempio n. 9
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBoxT.TextLength > 0)
            {
                button1.Visible = false;
                MegaMatriz            megaMatriz            = new MegaMatriz();
                F8                    codigof8              = new F8();
                AF8                   codigoaf8             = new AF8();
                Ordenar_Contorno      ordenar_Contorno      = new Ordenar_Contorno();
                Contorno              contorno              = new Contorno();
                BuscarCoordenadas     buscar_coordenadas    = new BuscarCoordenadas();
                Calcular_Error        calcular_Error        = new Calcular_Error();
                Seleccion_Segmentos   seleccion_Segmentos   = new Seleccion_Segmentos();
                Procesar_PQR          procesar_PQR          = new Procesar_PQR();
                Quitar_BPs            quitar_BPs            = new Quitar_BPs();
                ReOrdenamientoBPS     reOrdenamientoBPS     = new ReOrdenamientoBPS();
                Puntos_Dominantes2    puntos_Dominantes2    = new Puntos_Dominantes2();
                Obtener_subcadenasAF8 obtener_SubcadenasAF8 = new Obtener_subcadenasAF8();

                List <string>         PDs_alfa_siguiente  = new List <string>();
                List <Int32>          PDs_alpha_original  = new List <Int32>();
                List <int>            PDs_mantener_actual = new List <int>();
                List <Int32>          PDs_alpha_actual    = new List <Int32>();
                List <string>         PDs_objeto          = new List <string>();
                List <double>         ISES           = new List <double>();
                List <List <string> > Subcadenas_AF8 = new List <List <string> >();
                List <int>            PDs_ordenados  = new List <int>();
                List <int>            coordenadas_PDs_alfa_actual = new List <int>();
                List <int>            coordenadas_BP_reordenadas  = new List <int>();
                List <int>            PDs_ordenados_ant           = new List <int>();

                List <int> posiciones             = new List <int>();
                List <int> posiciones_almacenadas = new List <int>();
                List <int> posiciones_ant_act     = new List <int>();

                Convertir_a_Imagen Pintar_PDs = new Convertir_a_Imagen();

                string subcadena;



                double[,] distancias_ises = new double[5, 5];
                int[]    coor_pixel_inicial     = new int[3];
                int[]    coor_pixel_inicial_sig = new int[3];
                int[]    dimensiones            = new int[3];
                int[]    pqr        = new int[3];
                string[] vectorBase = new string[2];
                string[] rectas_discretas_actuales = new string[4];
                int      n, p_temporal, q_temporal, r_temporal, contador_BPs = 0;
                double   ISE, CR, WE, FOM, WE2, n_1, nDP;
                int      num_vecinos = 5;
                bool     continuar = false, repetir_penultimo = false;
                string   rectas_discretas2;

                double T;
                T = Convert.ToDouble(textBoxT.Text);
                textBoxT.Enabled = false;
                bool cambiar_resolucion = false, primer_alfa = true;

                dimensiones[0] = Moriginal.GetLength(0);
                dimensiones[1] = Moriginal.GetLength(1);
                dimensiones[2] = 1;

                n = 1;

                string subcadenas = Path.Combine(filepath, "Substrings of " + nombre + ".txt");
                File.Delete(subcadenas);

                do
                {
                    if (primer_alfa)
                    {
                        coor_pixel_inicial = buscar_coordenadas.Buscar_Primerpixel(Moriginal, n);
                        if (!It_is_file)
                        {
                            //Traverse the boundary of the 2D shape to obtain its coordinates.
                            coordenadas_contorno_ordenadas_original = ordenar_Contorno.Ordenar(Moriginal, coor_pixel_inicial)[0];
                        }
                        //Obtain the CC to f8 for the boundary of the original shape to know the maximum of p, q and r.
                        Restablecer(Moriginal);
                        cadenaAF8 = codigoaf8.CC_AF8(Moriginal, n, PDs_alfa_siguiente, It_is_file, coordenadas_contorno_ordenadas_original);
                        Restablecer(Moriginal);

                        //Function to obtain maximum p, q, r.
                        while (PDs_alfa_siguiente.Count != 0)
                        {
                            PDs_alfa_siguiente.RemoveAt(0);
                        }
                        pqr = procesar_PQR.Calcular_PQR(cadenaAF8);
                        p   = pqr[0];
                        q   = pqr[1];
                        r   = pqr[2];

                        label3.Visible   = true;
                        textBox2.Visible = true;
                        label6.Visible   = true;
                        textBox3.Visible = true;
                        label5.Visible   = true;
                        label4.Visible   = true;
                        textBox4.Visible = true;

                        textBox2.Text = p.ToString();
                        textBox3.Text = q.ToString();
                        textBox4.Text = r.ToString();
                    }
                    cadenaAF8 = codigoaf8.CC_AF8(Moriginal, n, PDs_alfa_siguiente, It_is_file, coordenadas_contorno_ordenadas_original);

                    if (coordenadas_contorno_ordenadas_original[coordenadas_contorno_ordenadas_original.Count - 1] < 0)
                    {
                        repetir_penultimo = true;
                    }
                    if (!It_is_file)
                    {
                        coordenadas_contorno_ordenadas_original.RemoveAt(coordenadas_contorno_ordenadas_original.Count - 1);
                    }
                    char[]   delimiter = { '0', '1', '2', '3', '4', '6', '7', '8', '9' };
                    string[] aAF8      = cadenaAF8.Split(delimiter, StringSplitOptions.RemoveEmptyEntries);
                    p_temporal = p;
                    q_temporal = q;
                    r_temporal = r;
                    do
                    {
                        //Store the BPs from the previous iteration to know which are the BPs detected after each change of r.
                        while (posiciones_ant_act.Count > 0)
                        {
                            posiciones_ant_act.RemoveAt(0);
                        }
                        for (int i = 0; i < posiciones_almacenadas.Count; i++)
                        {
                            posiciones_ant_act.Add(posiciones_almacenadas[i]);
                        }
                        while (posiciones.Count > 0)
                        {
                            posiciones.RemoveAt(0);
                        }
                        //Application of the language for detection of BPs.
                        rectas_discretas2 = puntos_Dominantes2.Coordenates_BPs(cadenaAF8, p_temporal, q_temporal, r_temporal, coordenadas_contorno_ordenadas_original, PDs_alfa_siguiente, primer_alfa);
                        label14.Visible   = true;

                        //Divide the chain into substrings according to the position where PDs are.
                        PDs_alpha_actual = Obtener_subcadenasAF8.Almacenar_PD_Lista(rectas_discretas2, primer_alfa);

                        //1000000000 This value allows to separate the DPs of different Segments of Discrete Straight Lines
                        Restablecer(Moriginal);
                        PDs_alpha_original = seleccion_Segmentos.Obtener_Coordenadas_PDs_reales(PDs_alpha_actual, Moriginal, alfa, true);
                        //-------------------------------------Error ISE -------------------------------------------------------------------------
                        PDs_alpha_actual = contorno.LimpiarDPs2(PDs_alpha_original, coor_pixel_inicial, posiciones);

                        for (int i = 0; i < posiciones.Count; i++)
                        {
                            posiciones_ant_act.Add(posiciones[i]);
                        }
                        //Create and store the images of the sets of BPs detected by L
                        Pintar_PDs.getDP(PDs_alpha_actual, new Bitmap(PDResultante.Image)).Save(filepath + "\\Detection" + list_ISE.Count + ".jpeg");
                        //------------------------------------------------------------------------------

                        //Calculation of the error made between each pair of BPs.
                        ISES = calcular_Error.Obtener_Error(PDs_alpha_actual, coordenadas_contorno_ordenadas_original, 0, repetir_penultimo);

                        //Store the different substrings in a file.
                        using (StreamWriter mylogs = File.AppendText(subcadenas))
                        {
                            List <int> sortedPosiciones = posiciones_ant_act.OrderBy(number => number).ToList();
                            int        index            = 0;
                            while (index < sortedPosiciones.Count - 1)
                            {
                                if (sortedPosiciones[index] == sortedPosiciones[index + 1])
                                {
                                    sortedPosiciones.RemoveAt(index);
                                }
                                else
                                {
                                    index++;
                                }
                            }

                            if (list_ISE.Count > 0)
                            {
                                List <int>    PD_temp  = new List <int>();
                                List <double> ISE_temp = new List <double>();
                                for (int k = 0; k < sortedPosiciones.Count; k++)
                                {
                                    PD_temp.Add(coordenadas_contorno_ordenadas_original[(sortedPosiciones[k] * 2)]);
                                    PD_temp.Add(coordenadas_contorno_ordenadas_original[(sortedPosiciones[k] * 2) + 1]);
                                    PD_temp.Add(sortedPosiciones[k]);
                                }
                                ISE_temp = calcular_Error.Obtener_Error(PD_temp, coordenadas_contorno_ordenadas_original, 0, true);
                                list_ISE.Add(ISE_temp[ISE_temp.Count - 1]);
                            }
                            else
                            {
                                list_ISE.Add(ISES[ISES.Count - 1]);
                            }

                            list_n_DPs.Add(sortedPosiciones.Count);

                            mylogs.WriteLine("-------------------------------------------------------------------------------");
                            mylogs.WriteLine("                                     r = " + r_temporal);
                            mylogs.WriteLine("-------------------------------------------------------------------------------");
                            contador_BPs = 0;
                            subcadena    = System.String.Empty;
                            string[] Substring = cadenaAF8.Split(' ');
                            for (int i = 0; i < Substring[Substring.Length - 2].Length; i++)
                            {
                                if (contador_BPs < sortedPosiciones.Count)
                                {
                                    if (sortedPosiciones[contador_BPs] != 0)
                                    {
                                        if (i == (sortedPosiciones[contador_BPs]))
                                        {
                                            mylogs.WriteLine(sortedPosiciones[contador_BPs - 1] + "," + subcadena);
                                            contador_BPs++;
                                            subcadena  = System.String.Empty;
                                            subcadena += Substring[Substring.Length - 2].Substring(i, 1);
                                        }
                                        else
                                        {
                                            subcadena += Substring[Substring.Length - 2].Substring(i, 1);
                                        }
                                    }
                                    else
                                    {
                                        contador_BPs++;
                                        subcadena += Substring[Substring.Length - 2].Substring(i, 1);
                                    }
                                }
                                else
                                {
                                    subcadena += Substring[Substring.Length - 2].Substring(i, 1);
                                }
                            }

                            mylogs.WriteLine((sortedPosiciones[sortedPosiciones.Count - 1]) + "," + subcadena);
                        }

                        //------------------------------------------------------------------------------


                        //----------- Obtain segments with errors greater than those allowed (T / sd). --------------
                        if (alfa >= 1)
                        {
                            cambiar_resolucion  = false;
                            PDs_mantener_actual = seleccion_Segmentos.Obtener_Segmentos(ISES, PDs_alpha_original, T, PDs_objeto, coordenadas_contorno_ordenadas_original, r_temporal, nombre, list_ISE);

                            if (PDs_mantener_actual.Count > 0)
                            {
                                int i_anterior = 0;
                                //Remove 1000000000 from the list of BPs
                                //-----------------------------------------------------------------------------------------------------------
                                for (int i = 0; i < PDs_alpha_original.Count; i++)
                                {
                                    if (PDs_alpha_original[i] == 1000000000)
                                    {
                                        PDs_alpha_original.RemoveAt(i);
                                        if (i == i_anterior + 3)
                                        {
                                            PDs_alpha_original.Insert(i, 0);
                                            PDs_alpha_original.Insert(i, 0);
                                        }
                                        i_anterior = i;
                                        i--;
                                    }
                                }
                                //-----------------------------------------------------------------------------------------------------------

                                for (int i = 0; i < PDs_mantener_actual.Count; i++)
                                {
                                    for (int j = 0; j < 6; j++)
                                    {
                                        if (j == 0 || j == 3)
                                        {
                                            if (!megaMatriz.Es_PD(PDs_objeto, PDs_alpha_original[(PDs_mantener_actual[i] * 6) - i * 6], PDs_alpha_original[(PDs_mantener_actual[i] * 6) - i * 6 + 1], PDs_alpha_original[(PDs_mantener_actual[i] * 6) - i * 6 + 2]))
                                            {
                                                //Store the coordinates of the BPs that generate an allowed error.
                                                //------------------------------------------------------------------------------------
                                                PDs_objeto.Add(PDs_alpha_original[(PDs_mantener_actual[i] * 6) - i * 6].ToString());
                                                PDs_objeto.Add(PDs_alpha_original[(PDs_mantener_actual[i] * 6) - i * 6 + 1].ToString());
                                                PDs_objeto.Add(PDs_alpha_original[(PDs_mantener_actual[i] * 6) - i * 6 + 2].ToString());
                                                posiciones_almacenadas.Add(PDs_alpha_original[(PDs_mantener_actual[i] * 6) - i * 6 + 2]);
                                                //------------------------------------------------------------------------------------
                                            }
                                        }
                                        PDs_alpha_original.RemoveAt((PDs_mantener_actual[i] * 6) - i * 6);
                                    }
                                    if (PDs_alpha_original.Count == 0)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                        else
                        {
                            while (PDs_alpha_original.Count > 0)
                            {
                                if (PDs_alpha_original[0] != 1000000000)
                                {
                                    PDs_objeto.Add(PDs_alpha_original[0].ToString());
                                }
                                PDs_alpha_original.RemoveAt(0);
                            }
                        }
                        //Decrease r, while p and q maintain their initial values.

                        while (PDs_alfa_siguiente.Count > 0)
                        {
                            PDs_alfa_siguiente.RemoveAt(0);
                        }
                        if (r_temporal > 0)
                        {
                            if (PDs_alpha_original.Count > 0)
                            {
                                repetir_penultimo = false;
                            }
                            for (int i = 0; i < PDs_alpha_original.Count; i++)
                            {
                                if (PDs_alpha_original[i] != 1000000000)
                                {
                                    if (i % 6 == 0 && i + 3 < PDs_alpha_original.Count)
                                    {
                                        //The coordinates of the BPs that do not meet the condition allow finding new BPs contained between them in those contour segments.
                                        if (PDs_alpha_original[i] != PDs_alpha_original[i + 3] || PDs_alpha_original[i + 1] != PDs_alpha_original[i + 4])
                                        {
                                            PDs_alfa_siguiente.Add(PDs_alpha_original[i].ToString());
                                        }
                                        else
                                        {
                                            i += 3;
                                        }
                                    }
                                    else
                                    {
                                        if ((i + 1) % 3 != 0)
                                        {
                                            PDs_alfa_siguiente.Add(PDs_alpha_original[i].ToString());
                                        }
                                    }
                                }
                            }
                        }
                        if (r_temporal > 1)
                        {
                            r_temporal = Convert.ToInt32(Math.Round(Convert.ToDouble(r_temporal) / 2, 1));
                        }
                        else if (r_temporal == 1)
                        {
                            r_temporal = 0;
                        }
                        else
                        {
                            r_temporal = -1;
                            while (PDs_alfa_siguiente.Count > 0)
                            {
                                if (PDs_alfa_siguiente[0] != "1000000000")
                                {
                                    PDs_objeto.Add(PDs_alfa_siguiente[0].ToString());
                                }
                                PDs_alfa_siguiente.RemoveAt(0);
                            }
                        }
                        primer_alfa = false;
                    } while (r_temporal != -1 && PDs_alfa_siguiente.Count != 0);
                } while (cambiar_resolucion && PDs_alfa_siguiente.Count > 0 && alfa > 1);
                //Eliminate repeated BPs to know the total number of them.
                PDs_objeto    = contorno.LimpiarDPs(PDs_objeto);
                PDs_ordenados = contorno.Ordenar_PDs_2(PDs_objeto, coordenadas_contorno_ordenadas_original);

                megaMatriz = null;
                posiciones_almacenadas.Clear();
                posiciones_ant_act.Clear();
                repetir_penultimo = true;
                int contador_eliminados = 0;

                do
                {
                    ISES = calcular_Error.Obtener_Error(PDs_ordenados, coordenadas_contorno_ordenadas_original, 0, repetir_penultimo);
                    if (list_ISE_Elimination.Count == 0)
                    {
                        list_ISE_Elimination.Add(ISES[ISES.Count - 1]);
                        list_n_DPs_Elimination.Add(PDs_ordenados.Count / 3);
                    }
                    list_ISE_Rearrangement.Add(ISES[ISES.Count - 1]);
                    list_n_DPs_Rearrangement.Add(PDs_ordenados.Count / 3);

                    Pintar_PDs.getDP(PDs_ordenados, new Bitmap(PDResultante.Image)).Save(filepath + "\\Elimination" + list_ISE_Elimination.Count + ".jpeg");
                    //Use of our novel method for the elimination of BPs.
                    PDs_ordenados = quitar_BPs.Eliminar_BPs_version2(PDs_ordenados, coordenadas_contorno_ordenadas_original, ISES, T);

                    ISES = calcular_Error.Obtener_Error(PDs_ordenados, coordenadas_contorno_ordenadas_original, 0, repetir_penultimo);

                    list_ISE_Elimination.Add(ISES[ISES.Count - 1]);
                    list_n_DPs_Elimination.Add(PDs_ordenados.Count / 3);

                    while (PDs_ordenados_ant.Count > 0)
                    {
                        PDs_ordenados_ant.RemoveAt(0);
                    }
                    for (int ii = 0; ii < PDs_ordenados.Count; ii++)
                    {
                        PDs_ordenados_ant.Add(PDs_ordenados[ii]);
                    }
                    //Create 5 graphs to use the Dijkstra algorithm.
                    distancias_ises = quitar_BPs.Mejor_acomodo_BPS(PDs_ordenados, coordenadas_contorno_ordenadas_original, T, num_vecinos);

                    //Use of Dijkstra to get the best fit of current BPs.
                    PDs_ordenados = reOrdenamientoBPS.NuevosBPs(distancias_ises, PDs_ordenados, coordenadas_contorno_ordenadas_original, num_vecinos);


                    //Storage of the rearrangement information.
                    Pintar_PDs.getDP(PDs_ordenados, new Bitmap(PDResultante.Image)).Save(filepath + "\\Rearrangement" + list_ISE_Rearrangement.Count + ".jpeg");

                    //Comparison of Sets of BPs of the previous and current iteration to know if there was any change, if not, end the loop.
                    continuar = Comparar_Listas_DPs(PDs_ordenados, PDs_ordenados_ant);
                    contador_eliminados++;
                } while (continuar);

                //Updating of errors made between each pair of BPs.
                ISES = calcular_Error.Obtener_Error(PDs_ordenados, coordenadas_contorno_ordenadas_original, 0, true);

                //----------------------------------------ISE ----------------------------------------------------------------------------

                ISE           = Math.Round(ISES[ISES.Count - 1], 4);
                textBox5.Text = ISE.ToString();

                //----------------------------------------n ----------------------------------------------------------------------------

                n_1 = coordenadas_contorno_ordenadas_original.Count / 2;
                nDP = ((PDs_ordenados.Count) / 3);
                //----------------------------------------CR ----------------------------------------------------------------------------

                CR = Math.Round(n_1 / nDP, 4);

                textBox6.Text = n_1.ToString();

                //----------------------------------------FOM ---------------------------------------------------------------------------
                FOM           = Math.Round(n_1 / (ISE * nDP), 4);
                textBox8.Text = FOM.ToString();

                //----------------------------------------WE ---------------------------------------------------------------------------
                WE            = Math.Round(ISE / CR, 4);
                textBox7.Text = WE.ToString();

                //----------------------------------------WE2 ---------------------------------------------------------------------------
                WE2           = Math.Round(ISE / Math.Pow(CR, 2), 4);
                textBox9.Text = WE2.ToString();

                textBox1.Text = nDP.ToString();


                label7.Visible   = true;
                label8.Visible   = true;
                label9.Visible   = true;
                label10.Visible  = true;
                label11.Visible  = true;
                label12.Visible  = true;
                labelT.Visible   = true;
                label13.Visible  = true;
                textBox1.Visible = true;
                textBox5.Visible = true;
                textBox6.Visible = true;
                textBox7.Visible = true;
                textBox8.Visible = true;
                textBox9.Visible = true;

                Clean.Visible   = true;
                Restart.Visible = true;
                label2.Text     = "Result";
                It_is_file      = false;

                //----------------------------------------------------------------------------------------------------------------------------



                PDResultante.Image = Pintar_PDs.Pintar_lineas(PDResultante, PDs_ordenados);
                PDResultante.Image = Pintar_PDs.getDP(PDs_ordenados, new Bitmap(PDResultante.Image));

                button2.Visible = true;
                //Storage of the generated polygon, its BPs and the original boundary on the hard disk.
                PDResultante.Image.Save(filepath + "\\Resultante_PDs" + nombre + ".jpeg");

                //Show the method information on the screen.
                this.Hide();
                Form_BPs_Detection bPs_Detection = new Form_BPs_Detection();
                bPs_Detection.Show(this);
                bPs_Detection.Mostrar_informacion(filepath, list_ISE, list_n_DPs, r, list_ISE_Elimination, list_n_DPs_Elimination, list_ISE_Rearrangement, list_n_DPs_Rearrangement);
            }
            else
            {
                string            message = "Assign a value to T to continue";
                string            caption = "Error Detected in Input";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;

                // Displays the MessageBox.
                result = MessageBox.Show(message, caption, buttons);
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    // Closes the parent form.
                    this.Close();
                }
            }
        }
Esempio n. 10
0
        void KillSteal()
        {
            //Avoid interrupting our assasination attempt
            if (jumpManager.MidAssasination)
            {
                return;
            }

            Obj_AI_Hero target = HeroList
                                 .Where(x => x.IsValidTarget() && x.Distance(Khazix.Position) < 1375f && !x.IsZombie)
                                 .MinOrDefault(x => x.Health);

            if (target != null)
            {
                if (Config.GetBool("UseIgnite") && Ignite.IsReady() && target.IsInRange(Ignite.Range))
                {
                    double igniteDmg = Khazix.GetSummonerSpellDamage(target, Damage.SummonerSpell.Ignite);
                    if (igniteDmg > target.Health)
                    {
                        Ignite.Cast(target);
                        return;
                    }
                }

                if (Config.GetBool("UseQKs") && Q.IsReady() &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= Q.Range)
                {
                    double QDmg = GetQDamage(target);
                    if (!Jumping && target.Health <= QDmg)
                    {
                        Q.Cast(target);
                        return;
                    }
                }

                if (Config.GetBool("UseEKs") && E.IsReady() && !Jumping &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= E.Range && Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) > Q.Range)
                {
                    double EDmg = Khazix.GetSpellDamage(target, SpellSlot.E);
                    if (!Jumping && target.Health < EDmg)
                    {
                        Utility.DelayAction.Add(
                            Game.Ping + Config.GetSlider("EDelay"), delegate
                        {
                            var jump = GetJumpPosition(target);
                            if (jump.shouldJump)
                            {
                                if (target.IsValid && !target.IsDead)
                                {
                                    E.Cast(jump.position);
                                }
                            }
                        });
                    }
                }

                if (W.IsReady() && !EvolvedW && Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range &&
                    Config.GetBool("UseWKs"))
                {
                    double WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    if (target.Health <= WDmg)
                    {
                        var pred = W.GetPrediction(target);
                        if (pred.Hitchance >= HitChance.Medium)
                        {
                            W.Cast(pred.CastPosition);
                            return;
                        }
                    }
                }

                if (W.IsReady() && EvolvedW &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range &&
                    Config.GetBool("UseWKs"))
                {
                    double           WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    PredictionOutput pred = WE.GetPrediction(target);
                    if (target.Health <= WDmg && pred.Hitchance >= HitChance.Medium)
                    {
                        CastWE(target, pred.UnitPosition.To2D(), 0, Config.GetHitChance("WHitchance"));
                        return;
                    }

                    if (pred.Hitchance >= HitChance.Collision)
                    {
                        List <Obj_AI_Base> PCollision = pred.CollisionObjects;
                        var x =
                            PCollision
                            .FirstOrDefault(PredCollisionChar => Vector3.Distance(PredCollisionChar.ServerPosition, target.ServerPosition) <= 30);
                        if (x != null)
                        {
                            W.Cast(x.Position);
                            return;
                        }
                    }
                }


                // Mixed's EQ KS
                if (Q.IsReady() && E.IsReady() &&
                    target.IsValidEnemy(0.90f * (E.Range + Q.Range)) &&
                    Config.GetBool("UseEQKs"))
                {
                    double QDmg = GetQDamage(target);
                    double EDmg = Khazix.GetSpellDamage(target, SpellSlot.E);
                    if ((target.Health <= QDmg + EDmg))
                    {
                        Utility.DelayAction.Add(Config.GetSlider("EDelay"), delegate
                        {
                            var jump = GetJumpPosition(target);
                            if (jump.shouldJump)
                            {
                                E.Cast(jump.position);
                            }
                        });
                    }
                }

                // MIXED EW KS
                if (W.IsReady() && E.IsReady() && !EvolvedW &&
                    target.IsValidEnemy(W.Range + E.Range) &&
                    Config.GetBool("UseEWKs"))
                {
                    double WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    if (target.Health <= WDmg)
                    {
                        Utility.DelayAction.Add(Config.GetSlider("EDelay"), delegate
                        {
                            var jump = GetJumpPosition(target);
                            if (jump.shouldJump)
                            {
                                E.Cast(jump.position);
                            }
                        });
                    }
                }

                if (Tiamat.IsReady() &&
                    Vector2.Distance(Khazix.ServerPosition.To2D(), target.ServerPosition.To2D()) <= Tiamat.Range &&
                    Config.GetBool("UseTiamatKs"))
                {
                    double Tiamatdmg = Khazix.GetItemDamage(target, Damage.DamageItems.Tiamat);
                    if (target.Health <= Tiamatdmg)
                    {
                        Tiamat.Cast();
                        return;
                    }
                }

                if (Config.GetBool("UseSmiteKs"))
                {
                    if (SmiteManager.CanCast(target))
                    {
                        var dmg = SmiteManager.GetSmiteDamage(target);
                        if (dmg >= target.Health)
                        {
                            SmiteManager.Cast(target);
                        }
                    }
                }

                if (Hydra.IsReady() &&
                    Vector2.Distance(Khazix.ServerPosition.To2D(), target.ServerPosition.To2D()) <= Hydra.Range &&
                    Config.GetBool("UseTiamatKs"))
                {
                    double hydradmg = Khazix.GetItemDamage(target, Damage.DamageItems.Hydra);
                    if (target.Health <= hydradmg)
                    {
                        Hydra.Cast();
                    }
                }
            }
        }
Esempio n. 11
0
        void Combo()
        {
            Obj_AI_Hero target = null;

            TargetSelector.TargetSelectionConditionDelegate conditions = targ => targ.IsIsolated() || targ.Health <= GetBurstDamage(targ);

            float targetSelectionRange = Khazix.AttackRange;

            if (SpellSlot.Q.IsReady())
            {
                targetSelectionRange += Q.Range;
            }

            if (SpellSlot.E.IsReady())
            {
                targetSelectionRange += E.Range;
            }

            else if (SpellSlot.W.IsReady())
            {
                targetSelectionRange += W.Range;
            }

            //Get Optimal target if available
            target = TargetSelector.GetTarget(targetSelectionRange, TargetSelector.DamageType.Physical, true, null, null, conditions);

            //If could not find then settle for anything
            if (target == null)
            {
                target = TargetSelector.GetTarget(targetSelectionRange, TargetSelector.DamageType.Physical, true, null, null);
            }

            //If a target has been found
            if ((target != null && target.IsValidEnemy()))
            {
                var dist = Khazix.Distance(target.ServerPosition);

                // Normal abilities

                if (Config.GetBool("UseQCombo") && Q.IsReady() && !Jumping)
                {
                    if (dist <= Q.Range)
                    {
                        Q.Cast(target);
                    }
                }

                if (Config.GetBool("UseWCombo") && W.IsReady() && !EvolvedW && dist <= W.Range)
                {
                    var pred = W.GetPrediction(target);
                    if (pred.Hitchance >= Config.GetHitChance("WHitchance"))
                    {
                        W.Cast(pred.CastPosition);
                    }
                }

                if (Config.GetBool("UseECombo") && E.IsReady() && !Jumping && dist <= E.Range && dist > Q.Range + (0.4 * Khazix.MoveSpeed))
                {
                    var jump = GetJumpPosition(target);
                    if (jump.shouldJump)
                    {
                        E.Cast(jump.position);
                    }
                }

                // Use EQ
                if ((Config.GetBool("UseEGapcloseQ") && Q.IsReady() && E.IsReady() && dist > Q.Range + (0.4 * Khazix.MoveSpeed) && dist <= E.Range + Q.Range))
                {
                    var jump = GetJumpPosition(target);
                    if (jump.shouldJump)
                    {
                        E.Cast(jump.position);
                    }
                    if (Config.GetBool("UseRGapcloseL") && R.IsReady())
                    {
                        R.CastOnUnit(Khazix);
                    }
                }


                // Ult Usage
                if (R.IsReady() && !Q.IsReady() && !W.IsReady() && !E.IsReady() &&
                    Config.GetBool("UseRCombo") && Khazix.CountEnemiesInRange(500) > 0)
                {
                    R.Cast();
                }

                // Evolved

                if (W.IsReady() && EvolvedW && dist <= WE.Range && Config.GetBool("UseWCombo"))
                {
                    PredictionOutput pred = WE.GetPrediction(target);
                    if (pred.Hitchance >= Config.GetHitChance("WHitchance"))
                    {
                        CastWE(target, pred.UnitPosition.To2D(), 0, Config.GetHitChance("WHitchance"));
                    }
                    if (pred.Hitchance >= HitChance.Collision)
                    {
                        List <Obj_AI_Base> PCollision = pred.CollisionObjects;
                        var x = PCollision.Where(PredCollisionChar => PredCollisionChar.Distance(target) <= 30).FirstOrDefault();
                        if (x != null)
                        {
                            W.Cast(x.Position);
                        }
                    }
                }


                if (Config.GetBool("Combo.Smite"))
                {
                    if (SmiteManager.CanCast(target))
                    {
                        SmiteManager.Cast(target);
                    }
                }

                if (Config.GetBool("UseItems"))
                {
                    UseItems(target);
                }
            }
        }
Esempio n. 12
0
        void KillSteal()
        {
            Obj_AI_Hero target = HeroList
                                 .Where(x => x.IsValidTarget() && x.Distance(Khazix.Position) < 1375f && !x.IsZombie)
                                 .MinOrDefault(x => x.Health);

            if (target != null && target.IsInRange(Ignite.Range))
            {
                if (Config.GetBool("UseIgnite") && IgniteSlot != SpellSlot.Unknown &&
                    Khazix.Spellbook.CanUseSpell(IgniteSlot) == SpellState.Ready)
                {
                    double igniteDmg = Khazix.GetSummonerSpellDamage(target, Damage.SummonerSpell.Ignite);
                    if (igniteDmg > target.Health)
                    {
                        Khazix.Spellbook.CastSpell(IgniteSlot, target);
                        return;
                    }
                }

                if (Config.GetBool("Safety.autoescape") && !IsHealthy)
                {
                    var ally =
                        HeroList.FirstOrDefault(h => h.HealthPercent > 40 && h.CountEnemiesInRange(400) == 0 && !h.ServerPosition.PointUnderEnemyTurret());
                    if (ally != null && ally.IsValid)
                    {
                        E.Cast(ally.ServerPosition);
                        return;
                    }
                    var underTurret = EnemyTurrets.Any(x => x.Distance(Khazix.ServerPosition) <= 900f && !x.IsDead && x.IsValid);
                    if (underTurret || Khazix.CountEnemiesInRange(500) >= 1)
                    {
                        var bestposition = Khazix.ServerPosition.Extend(NexusPosition, E.Range);
                        E.Cast(bestposition);
                        return;
                    }
                }

                if (Config.GetBool("UseQKs") && Q.IsReady() &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= Q.Range)
                {
                    double QDmg = GetQDamage(target);
                    if (!Jumping && target.Health <= QDmg)
                    {
                        Q.Cast(target);
                        return;
                    }
                }

                if (Config.GetBool("UseEKs") && E.IsReady() && !Jumping &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= E.Range && Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) > Q.Range)
                {
                    double EDmg = Khazix.GetSpellDamage(target, SpellSlot.E);
                    if (!Jumping && target.Health < EDmg)
                    {
                        Utility.DelayAction.Add(
                            Game.Ping + Config.GetSlider("EDelay"), delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValid && !target.IsDead)
                            {
                                if (Config.GetBool("Ksbypass") || ShouldJump(pred.CastPosition))
                                {
                                    E.Cast(pred.CastPosition);
                                }
                            }
                        });
                    }
                }

                if (W.IsReady() && !EvolvedW && Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range &&
                    Config.GetBool("UseWKs"))
                {
                    double WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    if (target.Health <= WDmg)
                    {
                        var pred = W.GetPrediction(target);
                        if (pred.Hitchance >= HitChance.Medium)
                        {
                            W.Cast(pred.CastPosition);
                            return;
                        }
                    }
                }

                if (W.IsReady() && EvolvedW &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range &&
                    Config.GetBool("UseWKs"))
                {
                    double           WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    PredictionOutput pred = WE.GetPrediction(target);
                    if (target.Health <= WDmg && pred.Hitchance >= HitChance.Medium)
                    {
                        CastWE(target, pred.UnitPosition.To2D(), 0, Config.GetHitChance("WHitchance"));
                        return;
                    }

                    if (pred.Hitchance >= HitChance.Collision)
                    {
                        List <Obj_AI_Base> PCollision = pred.CollisionObjects;
                        var x =
                            PCollision
                            .FirstOrDefault(PredCollisionChar => Vector3.Distance(PredCollisionChar.ServerPosition, target.ServerPosition) <= 30);
                        if (x != null)
                        {
                            W.Cast(x.Position);
                            return;
                        }
                    }
                }


                // Mixed's EQ KS
                if (Q.IsReady() && E.IsReady() &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= E.Range + Q.Range &&
                    Config.GetBool("UseEQKs"))
                {
                    double QDmg = GetQDamage(target);
                    double EDmg = Khazix.GetSpellDamage(target, SpellSlot.E);
                    if ((target.Health <= QDmg + EDmg))
                    {
                        Utility.DelayAction.Add(Config.GetSlider("EDelay"), delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValidTarget() && !target.IsZombie && ShouldJump(pred.CastPosition))
                            {
                                if (Config.GetBool("Ksbypass") || ShouldJump(pred.CastPosition))
                                {
                                    E.Cast(pred.CastPosition);
                                }
                            }
                        });
                    }
                }

                // MIXED EW KS
                if (W.IsReady() && E.IsReady() && !EvolvedW &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range + E.Range &&
                    Config.GetBool("UseEWKs"))
                {
                    double WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    if (target.Health <= WDmg)
                    {
                        Utility.DelayAction.Add(Config.GetSlider("EDelay"), delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValid && !target.IsDead && ShouldJump(pred.CastPosition))
                            {
                                if (Config.GetBool("Ksbypass") || ShouldJump(pred.CastPosition))
                                {
                                    E.Cast(pred.CastPosition);
                                }
                            }
                        });
                    }
                }

                if (Tiamat.IsReady() &&
                    Vector2.Distance(Khazix.ServerPosition.To2D(), target.ServerPosition.To2D()) <= Tiamat.Range &&
                    Config.GetBool("UseTiamatKs"))
                {
                    double Tiamatdmg = Khazix.GetItemDamage(target, Damage.DamageItems.Tiamat);
                    if (target.Health <= Tiamatdmg)
                    {
                        Tiamat.Cast();
                        return;
                    }
                }
                if (Hydra.IsReady() &&
                    Vector2.Distance(Khazix.ServerPosition.To2D(), target.ServerPosition.To2D()) <= Hydra.Range &&
                    Config.GetBool("UseTiamatKs"))
                {
                    double hydradmg = Khazix.GetItemDamage(target, Damage.DamageItems.Hydra);
                    if (target.Health <= hydradmg)
                    {
                        Hydra.Cast();
                    }
                }
            }
        }
Esempio n. 13
0
        private static void Combo()
        {
            if (Player.IsDead)
            {
                return;
            }
            var         usePacket    = Config.Item("usePackets").GetValue <bool>();
            var         isolatedlist = GetIsolatedTargets();
            HitChance   hitchance    = HarassHitChance();
            Obj_AI_Hero target       = new Obj_AI_Hero();

            if (isolatedlist != null && isolatedlist.Any())
            {
                var isolated = isolatedlist.OrderByDescending(
                    hero =>
                    Player.CalcDamage(hero, Damage.DamageType.Physical, 100) / (1 + hero.Health) *
                    TargetSelector.GetPriority(hero)).FirstOrDefault();

                target = isolated;
                isolatedlist.Clear();
            }
            else
            {
                target = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical);
            }

            if (target == null || !target.IsValid || !target.IsEnemy || target.IsDead || Player.Distance(target) > E.Range + 100)
            {
                target = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical);
            }


            if ((target != null))
            {
                // Normal abilities
                if (Player.Distance(target) <= Q.Range && Config.Item("UseQCombo").GetValue <bool>() &&
                    Q.IsReady())
                {
                    Orbwalker.SetAttack(false);
                    Q.Cast(target, usePacket);
                    Orbwalker.SetAttack(true);
                }
                if (Wnorm && Player.Distance(target) <= W.Range && Config.Item("UseWCombo").GetValue <bool>() &&
                    W.IsReady() && W.GetPrediction(target).Hitchance >= hitchance)
                {
                    PredictionOutput pred = W.GetPrediction(target);
                    W.Cast(pred.CastPosition, usePacket);
                }

                if (Player.Distance(target) <= E.Range && Config.Item("UseECombo").GetValue <bool>() &&
                    E.IsReady() && Player.Distance(target) > Q.Range)
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead)
                    {
                        E.Cast(pred.CastPosition, usePacket);
                    }
                }

                // Use EQ AND EW Synergy
                if ((Player.Distance(target) <= E.Range + Q.Range && Player.Distance(target) > Q.Range && E.IsReady() &&
                     Config.Item("UseEGapclose").GetValue <bool>()) || (Player.Distance(target) <= E.Range + W.Range && Player.Distance(target) > Q.Range && E.IsReady() && W.IsReady() &&
                                                                        Config.Item("UseEGapcloseW").GetValue <bool>()))
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead)
                    {
                        E.Cast(pred.CastPosition, usePacket);
                    }
                    if (Config.Item("UseRGapcloseW").GetValue <bool>() && R.IsReady())
                    {
                        R.CastOnUnit(ObjectManager.Player);
                    }
                }


                // Ult Usage
                if (R.IsReady() && !Q.IsReady() && !W.IsReady() && !E.IsReady() &&
                    Config.Item("UseRCombo").GetValue <bool>())
                {
                    R.Cast();
                    if (Config.Item("Debugon").GetValue <bool>())
                    {
                        Game.PrintChat("9 - Basic Ult Cast");
                    }
                }
                // Evolved

                if (Wevolved && Player.Distance(target) <= WE.Range && Config.Item("UseWCombo").GetValue <bool>() &&
                    W.IsReady() && W.GetPrediction(target).Hitchance >= hitchance)
                {
                    PredictionOutput pred = WE.GetPrediction(target);
                    // W.Cast(pred.CastPosition, usePacket);
                    CastWE(target, pred.UnitPosition.To2D());
                }
                if (Wevolved && Player.Distance(target) <= WE.Range && Config.Item("UseWCombo").GetValue <bool>() &&
                    W.IsReady() && W.GetPrediction(target).Hitchance >= HitChance.Collision)
                {
                    List <Obj_AI_Base> PCollision = W.GetPrediction(target).CollisionObjects;
                    foreach (
                        Obj_AI_Base PredCollisionChar in
                        PCollision.Where(PredCollisionChar => PredCollisionChar.Distance(target) <= 30))
                    {
                        W.Cast(PredCollisionChar.Position, usePacket);
                    }
                }

                if (Player.Distance(target) <= E.Range && Player.Distance(target) > Q.Range &&
                    Config.Item("UseECombo").GetValue <bool>() && E.IsReady())
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead)
                    {
                        E.Cast(pred.CastPosition, usePacket);
                    }
                }


                if (Config.Item("UseItems").GetValue <bool>())
                {
                    UseItems(target);
                }
            }
        }
Esempio n. 14
0
        static void Combo()
        {
            var target = TargetSelector.GetTarget(W.Range, DamageType.Physical);

            if ((target != null))
            {
                var dist = myHero.Distance(target);

                // Normal abilities
                if (Q.IsReady() && dist <= Q.Range && UseQCombo)
                {
                    Q.Cast(target);
                }

                if (W.IsReady() && !EvolvedW && dist <= W.Range && UseWCombo)
                {
                    var pred = W.GetPrediction(target);
                    if (pred.HitChance >= HitChance.High)
                    {
                        W.Cast(pred.CastPosition);
                    }
                }

                if (E.IsReady() && dist <= E.Range && UseECombo && dist > Q.Range + (0.7 * myHero.MoveSpeed))
                {
                    PredictionResult pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead && ShouldJump(pred.CastPosition))
                    {
                        E.Cast(pred.CastPosition);
                    }
                }

                // Use EQ AND EW Synergy
                if ((dist <= E.Range + Q.Range + (0.7 * myHero.MoveSpeed) && dist > Q.Range && E.IsReady() && UseEGapclose) || (dist <= E.Range + W.Range && dist > Q.Range && E.IsReady() && W.IsReady() && UseEGapcloseW))
                {
                    PredictionResult pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead && ShouldJump(pred.CastPosition))
                    {
                        E.Cast(pred.CastPosition);
                    }
                    if (UseRGapcloseW && R.IsReady())
                    {
                        R.Cast();
                    }
                }


                // Ult Usage
                if (R.IsReady() && !Q.IsReady() && !W.IsReady() && !E.IsReady() && UseRCombo)
                {
                    R.Cast();
                }
                // Evolved

                if (W.IsReady() && EvolvedW && dist <= WE.Range && UseWCombo)
                {
                    PredictionResult pred = WE.GetPrediction(target);
                    if (pred.HitChance >= HitChance.High)
                    {
                        CastWE(target, pred.UnitPosition.To2D(), 0, HitChance.High);
                    }
                    if (pred.HitChance >= HitChance.Collision)
                    {
                        List <Obj_AI_Base> PCollision = pred.CollisionObjects.ToList();
                        var x = PCollision.Where(PredCollisionChar => PredCollisionChar.Distance(target) <= 30).FirstOrDefault();
                        if (x != null)
                        {
                            W.Cast(x.Position);
                        }
                    }
                }

                if (dist <= E.Range + (0.7 * myHero.MoveSpeed) && dist > Q.Range && UseECombo && E.IsReady())
                {
                    PredictionResult pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead && ShouldJump(pred.CastPosition))
                    {
                        E.Cast(pred.CastPosition);
                    }
                }

                if (UseItems_)
                {
                    UseItems(target);
                }
            }
        }
Esempio n. 15
0
        void KillSteal()
        {
            AIHeroClient target = HeroList
                                  .Where(x => x.IsValidTarget() && x.Distance(Khazix.Position) < 1375f && !x.IsZombie)
                                  .MinOrDefault(x => x.Health);

            if (target != null && target.IsInRange(600))
            {
                if (getCheckBoxItem(safety, "Safety.autoescape") && !IsHealthy)
                {
                    var ally =
                        HeroList.FirstOrDefault(h => h.HealthPercent > 40 && h.CountEnemiesInRange(400) == 0 && !h.ServerPosition.PointUnderEnemyTurret());
                    if (ally != null && ally.IsValid)
                    {
                        E.Cast(ally.ServerPosition);
                        return;
                    }
                    var objAiturret = EnemyTurretPositions.Where(x => Vector3.Distance(Khazix.ServerPosition, x) <= 900f);
                    if (objAiturret.Any() || Khazix.CountEnemiesInRange(500) >= 1)
                    {
                        var bestposition = Khazix.ServerPosition.LSExtend(NexusPosition, E.Range);
                        E.Cast(bestposition);
                        return;
                    }
                }

                if (getCheckBoxItem(ks, "UseQKs") && Q.IsReady() &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= Q.Range)
                {
                    double QDmg = GetQDamage(target);
                    if (!Jumping && target.Health <= QDmg)
                    {
                        Q.Cast(target);
                        return;
                    }
                }

                if (getCheckBoxItem(ks, "UseEKs") && E.IsReady() && !Jumping &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= E.Range && Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) > Q.Range)
                {
                    double EDmg = Khazix.GetSpellDamage(target, SpellSlot.E);
                    if (!Jumping && target.Health < EDmg)
                    {
                        LeagueSharp.Common.Utility.DelayAction.Add(
                            Game.Ping + getSliderItem(ks, "Edelay"), delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValid && !target.IsDead)
                            {
                                if (getCheckBoxItem(ks, "Ksbypass") || ShouldJump(pred.CastPosition))
                                {
                                    E.Cast(pred.CastPosition);
                                }
                            }
                        });
                    }
                }

                if (W.IsReady() && !EvolvedW && Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range &&
                    getCheckBoxItem(ks, "UseWKs"))
                {
                    double WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    if (target.Health <= WDmg)
                    {
                        var pred = W.GetPrediction(target);
                        if (pred.Hitchance >= HitChance.Medium)
                        {
                            W.Cast(pred.CastPosition);
                            return;
                        }
                    }
                }

                if (W.IsReady() && EvolvedW &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range &&
                    getCheckBoxItem(ks, "UseWKs"))
                {
                    double           WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    PredictionOutput pred = WE.GetPrediction(target);
                    if (target.Health <= WDmg && pred.Hitchance >= HitChance.Medium)
                    {
                        CastWE(target, pred.UnitPosition.To2D(), 0, Config.GetHitChance("WHitchance"));
                        return;
                    }

                    if (pred.Hitchance >= HitChance.Collision)
                    {
                        List <Obj_AI_Base> PCollision = pred.CollisionObjects;
                        var x =
                            PCollision
                            .FirstOrDefault(PredCollisionChar => Vector3.Distance(PredCollisionChar.ServerPosition, target.ServerPosition) <= 30);
                        if (x != null)
                        {
                            W.Cast(x.Position);
                            return;
                        }
                    }
                }


                // Mixed's EQ KS
                if (Q.IsReady() && E.IsReady() &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= E.Range + Q.Range &&
                    getCheckBoxItem(ks, "UseEQKs"))
                {
                    double QDmg = GetQDamage(target);
                    double EDmg = Khazix.GetSpellDamage(target, SpellSlot.E);
                    if ((target.Health <= QDmg + EDmg))
                    {
                        LeagueSharp.Common.Utility.DelayAction.Add(getSliderItem(ks, "Edelay"), delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValidTarget() && !target.IsZombie && ShouldJump(pred.CastPosition))
                            {
                                if (getCheckBoxItem(ks, "Ksbypass") || ShouldJump(pred.CastPosition))
                                {
                                    E.Cast(pred.CastPosition);
                                }
                            }
                        });
                    }
                }

                // MIXED EW KS
                if (W.IsReady() && E.IsReady() && !EvolvedW &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range + E.Range &&
                    getCheckBoxItem(ks, "UseEWKs"))
                {
                    double WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    if (target.Health <= WDmg)
                    {
                        LeagueSharp.Common.Utility.DelayAction.Add(getSliderItem(ks, "Edelay"), delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValid && !target.IsDead && ShouldJump(pred.CastPosition))
                            {
                                if (getCheckBoxItem(ks, "Ksbypass") || ShouldJump(pred.CastPosition))
                                {
                                    E.Cast(pred.CastPosition);
                                }
                            }
                        });
                    }
                }

                if (Tiamat.IsReady() &&
                    Vector2.Distance(Khazix.ServerPosition.To2D(), target.ServerPosition.To2D()) <= Tiamat.Range &&
                    getCheckBoxItem(ks, "UseTiamatKs"))
                {
                    double Tiamatdmg = Khazix.GetItemDamage(target, LeagueSharp.Common.Damage.DamageItems.Tiamat);
                    if (target.Health <= Tiamatdmg)
                    {
                        Tiamat.Cast();
                        return;
                    }
                }
                if (Hydra.IsReady() &&
                    Vector2.Distance(Khazix.ServerPosition.To2D(), target.ServerPosition.To2D()) <= Hydra.Range &&
                    getCheckBoxItem(ks, "UseTiamatKs"))
                {
                    double hydradmg = Khazix.GetItemDamage(target, LeagueSharp.Common.Damage.DamageItems.Hydra);
                    if (target.Health <= hydradmg)
                    {
                        Hydra.Cast();
                    }
                }
            }
        }
Esempio n. 16
0
        internal void CastWE(Obj_AI_Base unit, Vector2 unitPosition, int minTargets = 0, HitChance hc = HitChance.Medium)
        {
            var points   = new List <Vector2>();
            var hitBoxes = new List <int>();

            Vector2 startPoint        = Khazix.ServerPosition.To2D();
            Vector2 originalDirection = W.Range * (unitPosition - startPoint).Normalized();

            foreach (AIHeroClient enemy in HeroManager.Enemies)
            {
                if (enemy.IsValidTarget() && enemy.NetworkId != unit.NetworkId)
                {
                    PredictionOutput pos = WE.GetPrediction(enemy);
                    if (pos.Hitchance >= hc)
                    {
                        points.Add(pos.UnitPosition.To2D());
                        hitBoxes.Add((int)enemy.BoundingRadius + 275);
                    }
                }
            }

            var posiblePositions = new List <Vector2>();

            for (int i = 0; i < 3; i++)
            {
                if (i == 0)
                {
                    posiblePositions.Add(unitPosition + originalDirection.Rotated(0));
                }
                if (i == 1)
                {
                    posiblePositions.Add(startPoint + originalDirection.Rotated(Wangle));
                }
                if (i == 2)
                {
                    posiblePositions.Add(startPoint + originalDirection.Rotated(-Wangle));
                }
            }


            if (startPoint.Distance(unitPosition) < 900)
            {
                for (int i = 0; i < 3; i++)
                {
                    Vector2 pos       = posiblePositions[i];
                    Vector2 direction = (pos - startPoint).Normalized().Perpendicular();
                    float   k         = (2 / 3 * (unit.BoundingRadius + W.Width));
                    posiblePositions.Add(startPoint - k * direction);
                    posiblePositions.Add(startPoint + k * direction);
                }
            }

            var bestPosition = new Vector2();
            int bestHit      = -1;

            foreach (Vector2 position in posiblePositions)
            {
                int hits = CountHits(position, points, hitBoxes);
                if (hits > bestHit)
                {
                    bestPosition = position;
                    bestHit      = hits;
                }
            }

            if (bestHit + 1 <= minTargets)
            {
                return;
            }

            W.Cast(bestPosition.To3D(), false);
        }
Esempio n. 17
0
        private static void Combo()
        {
            if (Player.IsDead || Player.IsRecalling())
            {
                return;
            }
            var         isolatedlist = GetIsolatedTargets();
            HitChance   hitchance    = HarassHitChance();
            Obj_AI_Hero target       = new Obj_AI_Hero();

            if (isolatedlist != null && isolatedlist.Any())
            {
                var isolated = isolatedlist.MaxOrDefault(h => TargetSelector.GetPriority(h));
                target = isolated;
            }

            else
            {
                target = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical);
            }

            if (target == null && target.IsValidTarget(E.Range + 100) && !target.IsZombie)
            {
                target = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical);
            }

            if ((target != null))
            {
                // Normal abilities
                if (Vector3.Distance(Player.ServerPosition, target.ServerPosition) <= Q.Range && Config.Item("UseQCombo").GetValue <bool>() &&
                    Q.IsReady() && !Jumping)
                {
                    Orbwalker.SetAttack(false);
                    Q.Cast(target);
                    Orbwalker.SetAttack(true);
                }
                if (Wnorm && Vector3.Distance(Player.ServerPosition, target.ServerPosition) <= W.Range && Config.Item("UseWCombo").GetValue <bool>() &&
                    W.IsReady() && W.GetPrediction(target).Hitchance >= hitchance)
                {
                    PredictionOutput pred = W.GetPrediction(target);
                    W.Cast(pred.CastPosition);
                }

                if (Vector3.Distance(Player.ServerPosition, target.ServerPosition) <= E.Range && Config.Item("UseECombo").GetValue <bool>() &&
                    E.IsReady() && Vector3.Distance(Player.ServerPosition, target.ServerPosition) > Q.Range + (0.7 * Player.MoveSpeed))
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead)
                    {
                        E.Cast(pred.CastPosition);
                    }
                }

                // Use EQ AND EW Synergy
                if ((Vector3.Distance(Player.ServerPosition, target.ServerPosition) <= E.Range + Q.Range + (0.7 * Player.MoveSpeed) && Vector3.Distance(Player.ServerPosition, target.ServerPosition) > Q.Range && E.IsReady() &&
                     Config.Item("UseEGapclose").GetValue <bool>()) || (Vector3.Distance(Player.ServerPosition, target.ServerPosition) <= E.Range + W.Range && Vector3.Distance(Player.ServerPosition, target.ServerPosition) > Q.Range && E.IsReady() && W.IsReady() &&
                                                                        Config.Item("UseEGapcloseW").GetValue <bool>()))
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead)
                    {
                        E.Cast(pred.CastPosition);
                    }
                    if (Config.Item("UseRGapcloseW").GetValue <bool>() && R.IsReady())
                    {
                        R.CastOnUnit(ObjectManager.Player);
                    }
                }


                // Ult Usage
                if (R.IsReady() && !Q.IsReady() && !W.IsReady() && !E.IsReady() &&
                    Config.Item("UseRCombo").GetValue <bool>())
                {
                    R.Cast();
                }
                // Evolved

                if (Wevolved && Vector3.Distance(Player.ServerPosition, target.ServerPosition) <= WE.Range && Config.Item("UseWCombo").GetValue <bool>() &&
                    W.IsReady())
                {
                    PredictionOutput pred = WE.GetPrediction(target);
                    if (pred.Hitchance >= hitchance)
                    {
                        CastWE(target, pred.UnitPosition.To2D());
                    }
                    if (pred.Hitchance >= HitChance.Collision)
                    {
                        List <Obj_AI_Base> PCollision = pred.CollisionObjects;
                        var x = PCollision.Where(PredCollisionChar => PredCollisionChar.Distance(target) <= 30).FirstOrDefault();
                        if (x != null)
                        {
                            W.Cast(x.Position);
                        }
                    }
                }

                if (Vector3.Distance(Player.ServerPosition, target.ServerPosition) <= E.Range + (0.7 * Player.MoveSpeed) && Vector3.Distance(Player.ServerPosition, target.ServerPosition) > Q.Range &&
                    Config.Item("UseECombo").GetValue <bool>() && E.IsReady())
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead)
                    {
                        E.Cast(pred.CastPosition);
                    }
                }

                if (Config.Item("UseItems").GetValue <bool>())
                {
                    UseItems(target);
                }
            }
        }