示例#1
0
        // Human Q Logic
        internal static void CastJavelin(Obj_AI_Base target, string mode)
        {
            // if not harass mode ignore mana check
            if (!KL.CatForm() && KL.CanUse(KL.Spells["Javelin"], true, mode))
            {
                if (mode != "ha" || KL.Player.ManaPercent > 65)
                {
                    if (target.IsValidTargetLS(KL.Spells["Javelin"].Range))
                    {
                        // try prediction on champion
                        if (target.IsChampion())
                        {
                            var qoutput = KL.Spells["Javelin"].GetPrediction(target);

                            if (KN.Root.Item("ndhqcheck").GetValue <bool>())
                            {
                                switch (KN.Root.Item("ppred").GetValue <StringList>().SelectedValue)
                                {
                                case "OKTW":
                                    var pi = new SebbyLib.Prediction.PredictionInput
                                    {
                                        Aoe       = false,
                                        Collision = true,
                                        Speed     = 1300f,
                                        Delay     = 0.25f,
                                        Range     = 1500f,
                                        From      = KN.Player.ServerPosition,
                                        Radius    = 40f,
                                        Unit      = target,
                                        Type      = SebbyLib.Prediction.SkillshotType.SkillshotLine
                                    };

                                    var po = SebbyLib.Prediction.Prediction.GetPrediction(pi);
                                    if (po.Hitchance == (SebbyLib.Prediction.HitChance)(KN.Root.Item("ndhqch").GetValue <StringList>().SelectedIndex + 3))
                                    {
                                        KL.Spells["Javelin"].Cast(po.CastPosition);
                                    }

                                    break;

                                case "SPrediction":
                                    var so = KL.Spells["Javelin"].GetSPrediction((AIHeroClient)target);
                                    if (so.HitChance == (HitChance)(KN.Root.Item("ndhqch").GetValue <StringList>().SelectedIndex + 3))
                                    {
                                        KL.Spells["Javelin"].Cast(so.CastPosition);
                                    }
                                    break;

                                case "Common":
                                    var co = KL.Spells["Javelin"].GetPrediction(target);
                                    if (co.Hitchance == (HitChance)(KN.Root.Item("ndhqch").GetValue <StringList>().SelectedIndex + 3))
                                    {
                                        KL.Spells["Javelin"].Cast(co.CastPosition);
                                    }
                                    break;
                                }
                            }

                            if (qoutput.Hitchance == HitChance.Collision && KL.Smite.IsReady())
                            {
                                if (KN.Root.Item("qsmcol").GetValue <bool>() && target.Health <= KL.CatDamage(target) * 3)
                                {
                                    if (qoutput.CollisionObjects.All(i => i.NetworkId != KL.Player.NetworkId))
                                    {
                                        var obj = qoutput.CollisionObjects.Cast <Obj_AI_Minion>().ToList();
                                        if (obj.Count == 1)
                                        {
                                            if (obj.Any(
                                                    i =>
                                                    i.Health <= KL.Player.GetSummonerSpellDamage(i, LeagueSharp.Common.Damage.SummonerSpell.Smite) &&
                                                    KL.Player.Distance(i) < 500 && KL.Player.Spellbook.CastSpell(KL.Smite, obj.First())))
                                            {
                                                KL.Spells["Javelin"].Cast(qoutput.CastPosition);
                                                return;
                                            }
                                        }
                                    }
                                }
                            }


                            if (!KN.Root.Item("ndhqcheck").GetValue <bool>())
                            {
                                KL.Spells["Javelin"].Cast(target);
                            }
                        }
                        else
                        {
                            KL.Spells["Javelin"].Cast(target);
                        }
                    }
                }
            }
        }