示例#1
0
        private static Vector3 GetRCastPosition(AIHeroClient target)
        {
            if (target == null || !target.IsValidTarget(R.Range) || target.IsUnKillable())
            {
                return(Vector3.Zero);
            }

            var rPredInput = new SpellPrediction.PredictionInput
            {
                Unit             = target,
                Radius           = R.Width,
                Speed            = R.Speed,
                Range            = R.Range,
                Delay            = R.Delay,
                Aoe              = false,
                AddHitBox        = true,
                From             = Me.PreviousPosition,
                RangeCheckFrom   = Me.PreviousPosition,
                Type             = SkillshotType.Line,
                CollisionObjects = CollisionObjects.Heroes | CollisionObjects.YasuoWall
            };

            var rPredOutput = SpellPrediction.GetPrediction(rPredInput);

            if (rPredOutput.Hitchance < HitChance.High /* ||
                                                        * SpellPrediction.GetCollision(new List<Vector3> { target.PreviousPosition }, rPredInput)
                                                        * .Any(x => x.NetworkId != target.NetworkId)*/)
            {
                return(Vector3.Zero);
            }

            return(rPredOutput.CastPosition);
        }
示例#2
0
文件: Spells.cs 项目: sergix1/Ensoul
        public void CastQE(AIBaseClient target)
        {
            if (GetE.IsReady())
            {
                //    var prediction = Prediction.GetPrediction(target, 500);
                var predictionInput = new SpellPrediction.PredictionInput
                {
                    Aoe       = false,
                    Collision = EQ.Collision,
                    Speed     = EQ.Speed,
                    Delay     = EQ.Delay,
                    Range     = EQ.Range,
                    From      = ObjectManager.Player.Position,
                    Radius    = EQ.Width,
                    Unit      = target,
                    Type      = SkillshotType.Line
                };
                var prediction = EnsoulSharp.SDK.Prediction.SpellPrediction.GetPrediction(predictionInput);

                Vector3 castQpos = prediction.CastPosition;

                if (ObjectManager.Player.Distance(castQpos) > GetQ.Range)
                {
                    castQpos = ObjectManager.Player.Position.Extend(castQpos, GetE.Range);
                }


                if (prediction.Hitchance >= HitChance.VeryHigh)
                {
                    EQcastNow = true;
                    GetQ.Cast(castQpos);
                }
            }
        }
示例#3
0
        private static void OnGameLoad()
        {
            if (ObjectManager.Player.CharacterName != CharName)
            {
                return;
            }

            Q1 = new Spell(SpellSlot.Q, 950f);
            Q1.SetSkillshot(0.25f, 79f, 2500f, true, SkillshotType.Line);
            Q2 = new Spell(SpellSlot.Q, 329f);
            Q2.SetSkillshot(0.25f, 150f, 9999f, false, SkillshotType.Cone);
            W = new Spell(SpellSlot.W, 390f);
            E = new Spell(SpellSlot.E, 600f);
            R = new Spell(SpellSlot.R, 600f);

            ConeAOEInput = new SpellPrediction.PredictionInput {
                Aoe = true, Collision = false, CollisionObjects = CollisionObjects.Heroes, Delay = 0.25f, From = myhero.Position, Type = SkillshotType.Cone, Range = 350f, Radius = 120f, Speed = 9999f
            };

            Potion  = new Items.Item(ItemId.Health_Potion, 0f);
            Biscuit = new Items.Item(ItemId.Total_Biscuit_of_Rejuvenation, 0f);
            RPotion = new Items.Item(ItemId.Refillable_Potion, 0f);
            CPotion = new Items.Item(ItemId.Corrupting_Potion, 0f);

            if (myhero.GetSpellSlot("SummonerDot") != SpellSlot.Unknown)
            {
                ignite = new Spell(myhero.GetSpellSlot("SummonerDot"), 600f);
            }

            EnemyPlayerNames = GameObjects.EnemyHeroes.Select(x => x.CharacterName).ToArray();
            EnemyADC         = GetEnemyADC();

            DatMenu();

            Game.OnUpdate += OnUpdate;
            GameObject.OnMissileCreate += OnMissile;
            GameObject.OnDelete        += GameObject_OnDelete;
            //AIHeroClient.OnProcessSpellCast += OnProcessSpell;
            Drawing.OnDraw          += OnDraw;
            Drawing.OnEndScene      += OnEndScene;
            AIHeroClient.OnLevelUp  += OnLevelUp;
            Gapcloser.OnGapcloser   += OnGapcloser;
            AIBaseClient.OnBuffGain += OnBuffGain;
            Orbwalker.OnAction      += OnAction;
            Tick.OnTick             += OnTick;

            if (myhero.Level == 1)
            {
                DelayAction.Add(300, delegate { myhero.Spellbook.LevelSpell(SpellSlot.Q); });
            }

            myhero.SetSkin(comb(misc, "skinID"));

            Console.WriteLine("T7 " + CharName + " Loaded");
            Game.Print("<b><font color='#0040FF'>T7</font><font color='#ab180e'>" + CharName + " </font></b> Alpha Version Loaded!");
        }
示例#4
0
        private static void OnProcessSpellCast(AIBaseClient sender, AIBaseClientProcessSpellCastEventArgs args)
        {
            if (myhero.IsDead || !sender.IsEnemy || sender.IsMinion)
            {
                return;
            }

            if (args.Slot == SpellSlot.R)
            {
                switch (args.SData.CastType)
                {
                case SpellDataCastType.CircleMissile:
                    if (args.End.DistanceToPlayer() < args.SData.CastRadius - 20)
                    {
                        E.Cast();
                    }
                    break;

                case SpellDataCastType.Missile:
                    var pred = new SpellPrediction.PredictionInput();
                    pred.Type   = SkillshotType.Line;
                    pred.Range  = args.SData.CastRange;
                    pred.Speed  = args.SData.MissileSpeed;
                    pred.Radius = args.SData.LineWidth;

                    if (SpellPrediction.GetPrediction(pred).CollisionObjects.Contains(myhero))
                    {
                        E.Cast();
                    }
                    break;
                }
            }
            else if (args.Target == myhero)
            {
                E.Cast();
            }
        }
        public static void CastSpell(Spell QWER, AIBaseClient target)
        {
            var predIndex = 0;
            var hitchance = HitChance.Low;

            if (QWER.Slot == SpellSlot.Q)
            {
                predIndex = Config["predmode"].GetValue <MenuList <string> >("Qpred").Index;
                var QHitChance = Config["predmode"].GetValue <MenuList <string> >("QHitChance").Index;
                if (QHitChance == 0)
                {
                    hitchance = HitChance.VeryHigh;
                }
                else if (QHitChance == 1)
                {
                    hitchance = HitChance.High;
                }
                else if (QHitChance == 2)
                {
                    hitchance = HitChance.Medium;
                }
            }
            else if (QWER.Slot == SpellSlot.W)
            {
                predIndex = Config["predmode"].GetValue <MenuList <string> >("Wpred").Index;
                var WHitChance = Config["predmode"].GetValue <MenuList <string> >("WHitChance").Index;
                if (WHitChance == 0)
                {
                    hitchance = HitChance.VeryHigh;
                }
                else if (WHitChance == 1)
                {
                    hitchance = HitChance.High;
                }
                else if (WHitChance == 2)
                {
                    hitchance = HitChance.Medium;
                }
            }
            else if (QWER.Slot == SpellSlot.E)
            {
                predIndex = Config["predmode"].GetValue <MenuList <string> >("Epred").Index;
                var EHitChance = Config["predmode"].GetValue <MenuList <string> >("EHitChance").Index;
                if (EHitChance == 0)
                {
                    hitchance = HitChance.VeryHigh;
                }
                else if (EHitChance == 1)
                {
                    hitchance = HitChance.High;
                }
                else if (EHitChance == 2)
                {
                    hitchance = HitChance.Medium;
                }
            }
            else if (QWER.Slot == SpellSlot.R)
            {
                predIndex = Config["predmode"].GetValue <MenuList <string> >("Rpred").Index;
                var RHitChance = Config["predmode"].GetValue <MenuList <string> >("RHitChance").Index;
                if (RHitChance == 0)
                {
                    hitchance = HitChance.VeryHigh;
                }
                else if (RHitChance == 1)
                {
                    hitchance = HitChance.High;
                }
                else if (RHitChance == 2)
                {
                    hitchance = HitChance.Medium;
                }
            }

            if (predIndex == 3)
            {
                if (QWER.Type == SkillshotType.Circle)
                {
                    Core.PredictionAio.CCast(QWER, target, hitchance);
                }
                else if (QWER.Type == SkillshotType.Line)
                {
                    Core.PredictionAio.LCast(QWER, target, hitchance);
                }
                else if (QWER.Type == SkillshotType.Cone)
                {
                    Core.PredictionAio.ConeCast(QWER, target, hitchance);
                }
                else
                {
                    QWER.CastIfHitchanceMinimum(target, hitchance);
                }
            }
            else if (predIndex == 2)
            {
                if (target is AIHeroClient)
                {
                    QWER.SPredictionCast(target as AIHeroClient, hitchance);
                }
                else
                {
                    QWER.CastIfHitchanceMinimum(target, hitchance);
                }
            }
            else if (predIndex == 1)
            {
                var aoe = false;

                if (QWER.Type == SkillshotType.Circle)
                {
                    aoe = true;
                }

                if (QWER.Width > 80 && !QWER.Collision)
                {
                    aoe = true;
                }

                var predInput = new SpellPrediction.PredictionInput
                {
                    Aoe            = aoe,
                    Collision      = QWER.Collision,
                    Speed          = QWER.Speed,
                    Delay          = QWER.Delay,
                    Range          = QWER.Range,
                    From           = Player.PreviousPosition,
                    RangeCheckFrom = Player.PreviousPosition,
                    Radius         = QWER.Width,
                    Unit           = target,
                    Type           = QWER.Type
                };

                var predOutput = SpellPrediction.GetPrediction(predInput);

                if (QWER.Speed != float.MaxValue && OktwCommon.CollisionYasuo(Player.PreviousPosition, predOutput.CastPosition))
                {
                    return;
                }

                if (predOutput.Hitchance >= hitchance)
                {
                    QWER.Cast(predOutput.CastPosition);
                }

                if (Game.Time - DrawSpellTime > 0.5)
                {
                    DrawSpell     = QWER;
                    DrawSpellTime = Game.Time;
                }

                DrawSpellPos = predOutput;
            }
            else if (predIndex == 0)
            {
                QWER.CastIfHitchanceMinimum(target, hitchance);
            }
        }