示例#1
0
        private bool getUnitsInPath(AIHeroClient player, AIHeroClient target, SpellBase spell)
        {
            float distance        = player.Distance(target);
            var   minionList      = EntityManager.MinionsAndMonsters.GetLaneMinions(EntityManager.UnitTeam.Enemy, ObjectManager.Player.ServerPosition, spell.Range);
            int   numberOfMinions = (from Obj_AI_Minion minion in minionList
                                     let skillshotPosition =
                                         V2E(player.Position,
                                             V2E(player.Position, target.Position,
                                                 Vector3.Distance(player.Position, target.Position) - spell.Width() + 1).To3D(),
                                             Vector3.Distance(player.Position, minion.Position))
                                         where skillshotPosition.Distance(minion) <= spell.Width()
                                         select minion).Count();
            int numberOfChamps = (from minion in ObjectManager.Get <AIHeroClient>()
                                  let skillshotPosition =
                                      V2E(player.Position,
                                          V2E(player.Position, target.Position,
                                              Vector3.Distance(player.Position, target.Position) - spell.Width() + 1).To3D(),
                                          Vector3.Distance(player.Position, minion.Position))
                                      where skillshotPosition.Distance(minion) < spell.Width() && minion.IsEnemy
                                      select minion).Count();
            int totalUnits = numberOfChamps + numberOfMinions - 1;

            // total number of champions and minions the projectile will pass through.
            if (totalUnits == -1)
            {
                return(false);
            }
            double damageReduction = 0;

            damageReduction = ((totalUnits > 7)) ? 0.4 : (totalUnits == 0) ? 1.0 : (1 - ((totalUnits) / 12.5));
            // the damage reduction calculations minus percentage for each unit it passes through!
            return(spell.GetDamage(target) * damageReduction >= (target.Health + (distance / 2000) * target.HPRegenRate));
            // - 15 is a safeguard for certain kill.
        }
示例#2
0
        public override void farm()
        {
            var laneClear = true;

            if (player.ManaPercent < 65)
            {
                return;
            }

            var rangedMinions = EntityManager.MinionsAndMonsters.EnemyMinions.Where(x => !x.IsDead && x.IsMelee && x.IsInRange(ObjectManager.Player.ServerPosition, Q2.Range));
            var allMinions    = EntityManager.MinionsAndMonsters.GetLaneMinions(EntityManager.UnitTeam.Enemy, ObjectManager.Player.ServerPosition, Q2.Range);

            var useQi = 2;
            var useWi = 2;
            var useEi = 2;
            var useQ  = (laneClear && (useQi == 1 || useQi == 2)) || (!laneClear && (useQi == 0 || useQi == 2));
            var useW  = (laneClear && (useWi == 1 || useWi == 2)) || (!laneClear && (useWi == 0 || useWi == 2));
            var useE  = (laneClear && (useEi == 1 || useEi == 2)) || (!laneClear && (useEi == 0 || useEi == 2));

            if (laneClear)
            {
                if (Q1.IsReady() && useQ)
                {
                    var rangedLocation = Q2.GetCircularFarmLocation(rangedMinions, Q2.Width());
                    var location       = Q2.GetCircularFarmLocation(allMinions, Q2.Width());

                    var bLocation = (location.HitNumber > rangedLocation.HitNumber + 1) ? location : rangedLocation;

                    if (bLocation.HitNumber > 0)
                    {
                        Q2.Cast(bLocation.CastPosition);
                    }
                }

                if (W.IsReady() && useW)
                {
                    var dmgpct         = new[] { 25, 27.5, 30, 32.5, 35 }[W.Level - 1];
                    var killableTurret = ObjectManager.Get <Obj_AI_Turret>().FirstOrDefault(x => x.IsEnemy && ObjectManager.Player.Distance(x.Position) <= W.Range && x.HealthPercent < dmgpct);
                    if (killableTurret != null)
                    {
                        W.Cast(killableTurret.Position);
                    }
                }

                if (E.IsReady() && useE)
                {
                    var rangedLocation = E.GetCircularFarmLocation(rangedMinions, E.Width() * 2);
                    var location       = E.GetCircularFarmLocation(allMinions, E.Width() * 2);

                    var bLocation = (location.HitNumber > rangedLocation.HitNumber + 1) ? location : rangedLocation;

                    if (bLocation.HitNumber > 2)
                    {
                        E.Cast(bLocation.CastPosition);
                    }
                }
            }
            else
            {
                if (useQ && Q1.IsReady())
                {
                    foreach (var minion in allMinions)
                    {
                        if (!Player.Instance.IsInAutoAttackRange(minion))
                        {
                            var Qdamage = ObjectManager.Player.GetSpellDamage(minion, SpellSlot.Q) * 0.75;

                            if (Qdamage > Q1.GetHealthPrediction(minion))
                            {
                                Q2.Cast(minion);
                            }
                        }
                    }
                }

                if (E.IsReady() && useE)
                {
                    var rangedLocation = E.GetCircularFarmLocation(rangedMinions, E.Width() * 2);
                    var location       = E.GetCircularFarmLocation(allMinions, E.Width() * 2);

                    var bLocation = (location.HitNumber > rangedLocation.HitNumber + 1) ? location : rangedLocation;

                    if (bLocation.HitNumber > 2)
                    {
                        E.Cast(bLocation.CastPosition);
                    }
                }
            }
        }
示例#3
0
        private void CastQ(Obj_AI_Base target)
        {
            PredictionResult prediction;

            if (ObjectManager.Player.Distance(target) < Q1.Range)
            {
                var oldrange = Q1.Range;
                Q1.Range   = Q2.Range;
                prediction = Q1.GetPrediction(target, true);
                Q1.Range   = oldrange;
            }
            else if (ObjectManager.Player.Distance(target) < Q2.Range)
            {
                var oldrange = Q2.Range;
                Q2.Range   = Q3.Range;
                prediction = Q2.GetPrediction(target, true);
                Q2.Range   = oldrange;
            }
            else if (ObjectManager.Player.Distance(target) < Q3.Range)
            {
                prediction = Q3.GetPrediction(target, true);
            }
            else
            {
                return;
            }

            if (prediction.HitChance >= HitChance.High)
            {
                if (ObjectManager.Player.ServerPosition.Distance(prediction.CastPosition) <= Q1.Range + Q1.Width())
                {
                    Vector3 p;
                    if (ObjectManager.Player.ServerPosition.Distance(prediction.CastPosition) > 300)
                    {
                        p = prediction.CastPosition -
                            100 *
                            (prediction.CastPosition.To2D() - ObjectManager.Player.ServerPosition.To2D()).Normalized()
                            .To3D();
                    }
                    else
                    {
                        p = prediction.CastPosition;
                    }

                    Q1.Cast(p);
                }
                else if (ObjectManager.Player.ServerPosition.Distance(prediction.CastPosition) <= ((Q1.Range + Q2.Range) / 2))
                {
                    var p = ObjectManager.Player.ServerPosition.To2D().Extend(prediction.CastPosition.To2D(), Q1.Range - 100);

                    if (!CheckQCollision(target, prediction.UnitPosition, p.To3D()))
                    {
                        Q1.Cast(p.To3D());
                    }
                }
                else
                {
                    var p = ObjectManager.Player.ServerPosition.To2D() +
                            Q1.Range *
                            (prediction.CastPosition.To2D() - ObjectManager.Player.ServerPosition.To2D()).Normalized
                                ();

                    if (!CheckQCollision(target, prediction.UnitPosition, p.To3D()))
                    {
                        Q1.Cast(p.To3D());
                    }
                }
            }
        }
示例#4
0
        private void CastER(Obj_AI_Base target) // copied from ScienceARK
        {
            PredictionResult prediction;

            if (ObjectManager.Player.Distance(target) < E1.Range)
            {
                var oldrange = E1.Range;
                E1.Range   = E2.Range;
                prediction = E1.GetPrediction(target, true);
                E1.Range   = oldrange;
            }
            else if (ObjectManager.Player.Distance(target) < E2.Range)
            {
                var oldrange = E2.Range;
                E2.Range   = E3.Range;
                prediction = E2.GetPrediction(target, true);
                E2.Range   = oldrange;
            }
            else if (ObjectManager.Player.Distance(target) < E3.Range)
            {
                prediction = E3.GetPrediction(target, true);
            }
            else
            {
                return;
            }

            if (prediction.HitChance >= HitChance.High)
            {
                if (ObjectManager.Player.ServerPosition.Distance(prediction.CastPosition) <= E1.Range + E1.Width())
                {
                    Vector3 p;
                    if (ObjectManager.Player.ServerPosition.Distance(prediction.CastPosition) > 300)
                    {
                        p = prediction.CastPosition -
                            100 *
                            (prediction.CastPosition.To2D() - ObjectManager.Player.ServerPosition.To2D()).Normalized()
                            .To3D();
                    }
                    else
                    {
                        p = prediction.CastPosition;
                    }
                    R.Cast();
                    E1.Cast(p);
                }
                else if (ObjectManager.Player.ServerPosition.Distance(prediction.CastPosition) <=
                         ((E1.Range + E1.Range) / 2))
                {
                    var p = ObjectManager.Player.ServerPosition.To2D()
                            .Extend(prediction.CastPosition.To2D(), E1.Range - 100);
                    {
                        R.Cast();
                        E1.Cast(p.To3D());
                    }
                }
                else
                {
                    var p = ObjectManager.Player.ServerPosition.To2D() +
                            E1.Range *
                            (prediction.CastPosition.To2D() - ObjectManager.Player.ServerPosition.To2D()).Normalized
                                ();

                    {
                        R.Cast();
                        E1.Cast(p.To3D());
                    }
                }
            }
        }
示例#5
0
        private void CastSpell(SpellBase QWER, AIHeroClient target, int HitChanceNum)
        {
            QWER.CastIfHitchanceEquals(target, (EloBuddy.SDK.Enumerations.HitChance)HitChanceNum, true);
            return;



            //HitChance 0 - 2
            // example CastSpell(Q, ts, 2);
            var poutput = QWER.GetPrediction(target);
            var col     = poutput.CollisionObjects.Count(ColObj => ColObj.IsEnemy && ColObj.IsMinion && !ColObj.IsDead);

            if (target.IsDead || col > 0 || target.Path.Count() > 1)
            {
                return;
            }

            if ((target.Path.Count() == 0 && target.Position == target.ServerPosition) || target.HasBuff("Recall"))
            {
                QWER.Cast(poutput.CastPosition);
                return;
            }

            if (HitChanceNum == 0)
            {
                QWER.Cast(target);
            }
            else if (HitChanceNum == 1)
            {
                if ((int)poutput.HitChance > 4)
                {
                    QWER.Cast(poutput.CastPosition);
                }
            }
            else if (HitChanceNum == 2)
            {
                List <Vector2> waypoints = target.GetWaypoints();
                if (waypoints.Last().To3D().Distance(poutput.CastPosition) > QWER.Width() && (int)poutput.HitChance == 5)
                {
                    if (waypoints.Last().To3D().Distance(player.Position) <= target.Distance(player.Position) || (target.Path.Count() == 0 && target.Position == target.ServerPosition))
                    {
                        if (player.Distance(target.ServerPosition) < QWER.Range - (poutput.CastPosition.Distance(target.ServerPosition) + target.BoundingRadius))
                        {
                            QWER.Cast(poutput.CastPosition);
                        }
                    }
                    else if ((int)poutput.HitChance == 5)
                    {
                        QWER.Cast(poutput.CastPosition);
                    }
                }
            }
            else if (HitChanceNum == 3)
            {
                List <Vector2> waypoints   = target.GetWaypoints();
                float          SiteToSite  = ((target.MoveSpeed * QWER.CastDelay) + (player.Distance(target.ServerPosition) / QWER.Speed()) - QWER.Width()) * 6;
                float          BackToFront = ((target.MoveSpeed * QWER.CastDelay) + (player.Distance(target.ServerPosition) / QWER.Speed()));
                if (player.Distance(waypoints.Last().To3D()) < SiteToSite || player.Distance(target.Position) < SiteToSite)
                {
                    QWER.CastIfHitchanceEquals(target, EloBuddy.SDK.Enumerations.HitChance.High, true);
                }
                else if ((target.ServerPosition.Distance(waypoints.Last().To3D()) > SiteToSite ||
                          Math.Abs(player.Distance(waypoints.Last().To3D()) - player.Distance(target.Position)) > BackToFront))
                {
                    if (waypoints.Last().To3D().Distance(player.Position) <= target.Distance(player.Position))
                    {
                        if (player.Distance(target.ServerPosition) < QWER.Range - (poutput.CastPosition.Distance(target.ServerPosition)))
                        {
                            QWER.Cast(poutput.CastPosition);
                        }
                    }
                    else
                    {
                        QWER.Cast(poutput.CastPosition);
                    }
                }
            }
            else if (HitChanceNum == 4 && (int)poutput.HitChance > 4)
            {
                List <Vector2> waypoints   = target.GetWaypoints();
                float          SiteToSite  = ((target.MoveSpeed * QWER.CastDelay) + (player.Distance(target.ServerPosition) / QWER.Speed()) - QWER.Width()) * 6;
                float          BackToFront = ((target.MoveSpeed * QWER.CastDelay) + (player.Distance(target.ServerPosition) / QWER.Speed()));

                if (player.Distance(waypoints.Last().To3D()) < SiteToSite || player.Distance(target.Position) < SiteToSite)
                {
                    QWER.CastIfHitchanceEquals(target, EloBuddy.SDK.Enumerations.HitChance.High, true);
                }
                else if ((target.ServerPosition.Distance(waypoints.Last().To3D()) > SiteToSite ||
                          Math.Abs(player.Distance(waypoints.Last().To3D()) - player.Distance(target.Position)) > BackToFront))
                {
                    if (waypoints.Last().To3D().Distance(player.Position) <= target.Distance(player.Position))
                    {
                        if (player.Distance(target.ServerPosition) < QWER.Range - (poutput.CastPosition.Distance(target.ServerPosition)))
                        {
                            QWER.Cast(poutput.CastPosition);
                        }
                    }
                    else
                    {
                        QWER.Cast(poutput.CastPosition);
                    }
                }
            }
        }
示例#6
0
        public Tuple <int, List <AIHeroClient> > GetHits(SpellBase spell)
        {
            var hits  = new List <AIHeroClient>();
            var range = spell.Range * spell.Range;

            foreach (var enemy in ObjectManager.Get <AIHeroClient>().Where(h => h.IsValidTarget() && BallManager.BallPosition.Distance(h.ServerPosition, true) < range))
            {
                if (spell.WillHit(enemy, BallManager.BallPosition) && BallManager.BallPosition.Distance(enemy.ServerPosition, true) < spell.Width() * spell.Width())
                {
                    hits.Add(enemy);
                }
            }
            return(new Tuple <int, List <AIHeroClient> >(hits.Count, hits));
        }