コード例 #1
0
        protected override void SetupSpells()
        {
            Q = new Spell(SpellSlot.Q, 825f, DamageType.Magical);
            Q.SetSkillshot(0.13f, 115f, 1400f, false, SkillshotType.SkillshotCircle);

            W = new Spell(SpellSlot.W, float.MaxValue, DamageType.Magical);
            W.SetSkillshot(0f, 220f, float.MaxValue, false, SkillshotType.SkillshotCircle);

            E = new Spell(SpellSlot.E, 1095f, DamageType.Magical);
            E.SetSkillshot(0.25f, 125f, 1700f, false, SkillshotType.SkillshotLine);

            R = new Spell(SpellSlot.R, float.MaxValue, DamageType.Magical);
            R.SetSkillshot(0.75f, 375f, float.MaxValue, false, SkillshotType.SkillshotCircle);

            Ultimate = new UltimateManager
            {
                Combo = true,
                Assisted = true,
                Auto = true,
                Flash = true,
                Required = true,
                Force = true,
                Gapcloser = false,
                GapcloserDelay = false,
                Interrupt = true,
                InterruptDelay = false,
                Spells = Spells,
                DamageCalculation =
                    (hero, resMulti, rangeCheck) =>
                        CalcComboDamage(
                            hero, resMulti, rangeCheck, Menu.Item(Menu.Name + ".combo.q").GetValue<bool>(),
                            Menu.Item(Menu.Name + ".combo.w").GetValue<bool>(),
                            Menu.Item(Menu.Name + ".combo.e").GetValue<bool>(), true)
            };
        }
コード例 #2
0
ファイル: Casting.cs プロジェクト: 4859aa/LeagueSharp-Dev
        public static void TargetSkill(Obj_AI_Base target, Spell spell)
        {
            if (!spell.IsReady() || target == null)
            {
                return;
            }

            spell.CastOnUnit(target);
        }
コード例 #3
0
 public static Result Line(Spell spell,
                           Obj_AI_Hero target,
                           HitChance hitChance,
                           bool boundingRadius = true,
                           bool maxRange       = true)
 {
     try
     {
         if (spell == null || target == null)
         {
             return(new Result(Vector3.Zero, new List <Obj_AI_Hero>()));
         }
         var range = (spell.IsChargedSpell && maxRange ? spell.ChargedMaxRange : spell.Range) +
                     spell.Width * 0.9f +
                     (boundingRadius ? target.BoundingRadius * BoundingRadiusMultiplicator : 0);
         var positions = (from t in GameObjects.EnemyHeroes
                          where t.IsValidTarget(range, true, spell.RangeCheckFrom)
                          let prediction = spell.GetPrediction(t)
                                           where prediction.Hitchance >= hitChance
                                           select new Position(t, prediction.UnitPosition)).ToList();
         if (positions.Any())
         {
             var hits = new List <Obj_AI_Hero>();
             var pred = spell.GetPrediction(target);
             if (pred.Hitchance >= hitChance)
             {
                 hits.Add(target);
                 var rect = new Geometry.Polygon.Rectangle(
                     spell.From, spell.From.Extend(pred.CastPosition, range), spell.Width);
                 if (boundingRadius)
                 {
                     hits.AddRange(
                         from point in positions.Where(p => p.Hero.NetworkId != target.NetworkId)
                         let circle =
                             new Geometry.Polygon.Circle(
                                 point.UnitPosition, point.Hero.BoundingRadius * BoundingRadiusMultiplicator)
                             where circle.Points.Any(p => rect.IsInside(p))
                             select point.Hero);
                 }
                 else
                 {
                     hits.AddRange(
                         from position in positions
                         where rect.IsInside(position.UnitPosition)
                         select position.Hero);
                 }
                 return(new Result(pred.CastPosition, hits));
             }
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return(new Result(Vector3.Zero, new List <Obj_AI_Hero>()));
 }
コード例 #4
0
ファイル: Casting.cs プロジェクト: 4859aa/LeagueSharp-Dev
        private static void ConeFarm(Spell spell, List <Obj_AI_Base> minions, int min, float overrideWidth = -1f)
        {
            var spellWidth = overrideWidth > 0 ? overrideWidth : spell.Width;
            var pred       = spell.GetCircularFarmLocation(minions, spellWidth);

            if (pred.MinionsHit >= min)
            {
                spell.Cast(pred.Position);
            }
        }
コード例 #5
0
 public static void FarmSelfAoe(Spell spell, List <Obj_AI_Base> minions, int minHit = 3, float overrideWidth = -1f)
 {
     if (!spell.IsReady() || minions.Count == 0)
     {
         return;
     }
     if (minions.Count >= minHit)
     {
         spell.Cast();
     }
 }
コード例 #6
0
 public static HitChance GetHitChance(this Spell spell, string uniqueId)
 {
     try
     {
         if (spell != null && spell.Slot != SpellSlot.Unknown)
         {
             return(Get(uniqueId, spell.Slot.ToString()));
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return(HitChance.High);
 }
コード例 #7
0
ファイル: Casting.cs プロジェクト: 4859aa/LeagueSharp-Dev
        public static void Farm(Spell spell,
            int minHit = 3,
            float overrideWidth = -1f,
            bool chargeMax = true,
            List<Obj_AI_Base> minions = null)
        {
            if (!spell.IsReady())
            {
                return;
            }
            var spellWidth = overrideWidth > 0 ? overrideWidth : spell.Width;

            if (minions == null)
            {
                minions =
                    MinionManager.GetMinions(
                        (((chargeMax && spell.IsChargedSpell ? spell.ChargedMaxRange : spell.Range) + spellWidth) * 1.5f),
                        MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.MaxHealth);
            }

            if (minions.Count == 0)
            {
                return;
            }

            if (minHit > 1)
            {
                var nearest = minions.OrderBy(m => m.Distance(ObjectManager.Player)).FirstOrDefault();
                if (nearest != null && nearest.Team == GameObjectTeam.Neutral)
                {
                    minHit = 1;
                }
            }

            if (spell.Type == SkillshotType.SkillshotCircle)
            {
                CircleFarm(spell, minions, minHit, overrideWidth);
            }
            else if (spell.Type == SkillshotType.SkillshotLine)
            {
                LineFarm(spell, minions, minHit, overrideWidth);
            }
            else if (spell.Type == SkillshotType.SkillshotCone)
            {
                ConeFarm(spell, minions, minHit, overrideWidth);
            }
        }
コード例 #8
0
ファイル: Casting.cs プロジェクト: 4859aa/LeagueSharp-Dev
        public static void Farm(Spell spell,
                                int minHit                 = 3,
                                float overrideWidth        = -1f,
                                bool chargeMax             = true,
                                List <Obj_AI_Base> minions = null)
        {
            if (!spell.IsReady())
            {
                return;
            }
            var spellWidth = overrideWidth > 0 ? overrideWidth : spell.Width;

            if (minions == null)
            {
                minions =
                    MinionManager.GetMinions(
                        (((chargeMax && spell.IsChargedSpell ? spell.ChargedMaxRange : spell.Range) + spellWidth) * 1.5f),
                        MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.MaxHealth);
            }

            if (minions.Count == 0)
            {
                return;
            }

            if (minHit > 1)
            {
                var nearest = minions.OrderBy(m => m.Distance(ObjectManager.Player)).FirstOrDefault();
                if (nearest != null && nearest.Team == GameObjectTeam.Neutral)
                {
                    minHit = 1;
                }
            }

            if (spell.Type == SkillshotType.SkillshotCircle)
            {
                CircleFarm(spell, minions, minHit, overrideWidth);
            }
            else if (spell.Type == SkillshotType.SkillshotLine)
            {
                LineFarm(spell, minions, minHit, overrideWidth);
            }
            else if (spell.Type == SkillshotType.SkillshotCone)
            {
                ConeFarm(spell, minions, minHit, overrideWidth);
            }
        }
コード例 #9
0
 public static Obj_AI_Hero GetTargetNoCollision(Spell spell,
                                                bool ignoreShields = true,
                                                Vector3 from       = default(Vector3),
                                                IEnumerable <Obj_AI_Hero> ignoredChampions = null)
 {
     try
     {
         return
             (GetTargets(spell.Range, spell.DamageType, ignoreShields, from, ignoredChampions)
              .FirstOrDefault(t => spell.GetPrediction(t).Hitchance != HitChance.Collision));
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return(null);
 }
コード例 #10
0
        private static void LineFarm(Spell spell, List <Obj_AI_Base> minions, int min, float overrideWidth = -1f)
        {
            if (!spell.IsReady() || minions.Count == 0)
            {
                return;
            }
            var spellWidth = overrideWidth > 0 ? overrideWidth : spell.Width;
            var totalHits  = 0;
            var castPos    = Vector3.Zero;

            var positions = (from minion in minions
                             let pred = spell.GetPrediction(minion)
                                        where pred.Hitchance >= HitChance.Medium
                                        select new Tuple <Obj_AI_Base, Vector3>(minion, pred.UnitPosition)).ToList();

            if (positions.Any())
            {
                foreach (var position in positions)
                {
                    var rect = new Geometry.Polygon.Rectangle(
                        ObjectManager.Player.Position, ObjectManager.Player.Position.Extend(position.Item2, spell.Range),
                        spellWidth);
                    var count =
                        positions.Select(
                            position2 =>
                            new Geometry.Polygon.Circle(position2.Item2, position2.Item1.BoundingRadius * 0.9f))
                        .Count(circle => circle.Points.Any(p => rect.IsInside(p)));
                    if (count > totalHits)
                    {
                        totalHits = count;
                        castPos   = position.Item2;
                    }
                    if (totalHits == minions.Count)
                    {
                        break;
                    }
                }
                if (!castPos.Equals(Vector3.Zero) && totalHits >= min)
                {
                    spell.Cast(castPos);
                }
            }
        }
コード例 #11
0
 public static Obj_AI_Hero GetTarget(Spell spell,
                                     bool ignoreShields = true,
                                     Vector3 from       = default(Vector3),
                                     IEnumerable <Obj_AI_Hero> ignoredChampions = null)
 {
     try
     {
         return
             (GetTarget(
                  (spell.Range + spell.Width +
                   Targets.Items.Select(e => e.Hero.BoundingRadius).DefaultIfEmpty(50).Max()) * 1.1f,
                  spell.DamageType, ignoreShields, from, ignoredChampions));
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return(null);
 }
コード例 #12
0
 public static void Farm(Spell spell,
                         List <Obj_AI_Base> minions,
                         int minHit          = 3,
                         float overrideWidth = -1f,
                         bool chargeMax      = true)
 {
     if (!spell.IsReady() || minions.Count == 0)
     {
         return;
     }
     if (spell.IsSkillshot)
     {
         if (spell.Collision)
         {
             minHit = 1;
         }
         if (spell.Type == SkillshotType.SkillshotCircle)
         {
             CircleFarm(spell, minions, minHit, overrideWidth);
         }
         else if (spell.Type == SkillshotType.SkillshotLine)
         {
             LineFarm(spell, minions, minHit, overrideWidth);
         }
         else if (spell.Type == SkillshotType.SkillshotCone)
         {
             ConeFarm(spell, minions, minHit, overrideWidth);
         }
     }
     else
     {
         var minion =
             minions.OrderBy(m => spell.IsKillable(m))
             .FirstOrDefault(
                 m =>
                 spell.IsInRange(m) && spell.GetDamage(m) > m.Health ||
                 m.Health - spell.GetDamage(m) > m.MaxHealth * 0.25f);
         if (minion != null)
         {
             spell.CastOnUnit(minion);
         }
     }
 }
コード例 #13
0
 public static bool Check(string uniqueId, Spell spell, Obj_AI_Hero hero)
 {
     try
     {
         if (hero == null || !Enabled(uniqueId))
         {
             return(true);
         }
         var bestTarget = TargetSelector.GetTarget(spell);
         if (bestTarget == null || hero.NetworkId.Equals(bestTarget.NetworkId))
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return(false);
 }
コード例 #14
0
 public static bool Check(string uniqueId, Spell spell, Obj_AI_Hero hero)
 {
     try
     {
         if (hero == null || !Enabled(uniqueId))
         {
             return true;
         }
         var bestTarget = TargetSelector.GetTarget(spell);
         if (bestTarget == null || hero.NetworkId.Equals(bestTarget.NetworkId))
         {
             return true;
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return false;
 }
コード例 #15
0
        private static void CircleFarm(Spell spell, List <Obj_AI_Base> minions, int min, float overrideWidth = -1f)
        {
            if (!spell.IsReady() || minions.Count == 0)
            {
                return;
            }
            var spellWidth = (overrideWidth > 0 ? overrideWidth : spell.Width) + minions.Average(m => m.BoundingRadius);
            var points     = (from minion in minions
                              select spell.GetPrediction(minion)
                              into pred
                              where pred.Hitchance >= HitChance.Medium
                              select pred.UnitPosition.To2D()).ToList();

            if (points.Any())
            {
                var possibilities = ListExtensions.ProduceEnumeration(points).Where(p => p.Count >= min).ToList();
                if (possibilities.Any())
                {
                    var hits   = 0;
                    var radius = float.MaxValue;
                    var pos    = Vector3.Zero;
                    foreach (var possibility in possibilities)
                    {
                        var mec = MEC.GetMec(possibility);
                        if (mec.Radius < spellWidth)
                        {
                            if (possibility.Count > hits || possibility.Count == hits && radius > mec.Radius)
                            {
                                hits   = possibility.Count;
                                radius = mec.Radius;
                                pos    = mec.Center.To3D();
                            }
                        }
                    }
                    if (hits >= min && !pos.Equals(Vector3.Zero))
                    {
                        spell.Cast(pos);
                    }
                }
            }
        }
コード例 #16
0
 public static void Add(Spell spell, bool readyCheck = true, bool enabled = true)
 {
     try
     {
         if (_menu == null)
         {
             return;
         }
         _menu.AddItem(
             new MenuItem(_menu.Name + "." + spell.Slot, spell.Slot.ToString().ToUpper()).SetValue(enabled));
         if (readyCheck)
         {
             Functions.Add(spell.Slot.ToString(), hero => spell.IsReady() ? spell.GetDamage(hero) : 0);
         }
         else
         {
             Functions.Add(spell.Slot.ToString(), hero => spell.GetDamage(hero));
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
コード例 #17
0
        public static void SkillShot(Obj_AI_Hero target,
            Spell spell,
            HitChance hitChance,
            bool boundingRadius = true,
            bool maxRange = true)
        {
            if (!spell.IsReady() || target == null)
            {
                return;
            }

            if (spell.Type == SkillshotType.SkillshotLine)
            {
                var prediction = CPrediction.Line(spell, target, hitChance, boundingRadius, maxRange);
                if (prediction.TotalHits >= 1)
                {
                    spell.Cast(prediction.CastPosition);
                }
            }
            else if (spell.Type == SkillshotType.SkillshotCircle)
            {
                var prediction = CPrediction.Circle(spell, target, hitChance);
                if (prediction.TotalHits >= 1)
                {
                    spell.Cast(prediction.CastPosition);
                }
            }
            else
            {
                var prediction = spell.GetPrediction(target);
                if (prediction.Hitchance >= hitChance)
                {
                    spell.Cast(prediction.CastPosition);
                }
            }
        }
コード例 #18
0
 public static void Add(Spell spell, bool readyCheck = true, bool enabled = true)
 {
     try
     {
         if (_menu == null)
         {
             return;
         }
         _menu.AddItem(
             new MenuItem(_menu.Name + "." + spell.Slot, spell.Slot.ToString().ToUpper()).SetValue(enabled));
         if (readyCheck)
         {
             Functions.Add(spell.Slot.ToString(), hero => spell.IsReady() ? spell.GetDamage(hero) : 0);
         }
         else
         {
             Functions.Add(spell.Slot.ToString(), hero => spell.GetDamage(hero));
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
コード例 #19
0
ファイル: Casting.cs プロジェクト: 4859aa/LeagueSharp-Dev
        public static void SkillShot(Obj_AI_Hero target,
                                     Spell spell,
                                     HitChance hitChance,
                                     bool boundingRadius = true,
                                     bool maxRange       = true)
        {
            if (!spell.IsReady() || target == null)
            {
                return;
            }

            if (spell.Type == SkillshotType.SkillshotLine)
            {
                var prediction = CPrediction.Line(spell, target, hitChance, boundingRadius, maxRange);
                if (prediction.TotalHits >= 1)
                {
                    spell.Cast(prediction.CastPosition);
                }
            }
            else if (spell.Type == SkillshotType.SkillshotCircle)
            {
                var prediction = CPrediction.Circle(spell, target, hitChance);
                if (prediction.TotalHits >= 1)
                {
                    spell.Cast(prediction.CastPosition);
                }
            }
            else
            {
                var prediction = spell.GetPrediction(target);
                if (prediction.Hitchance >= hitChance)
                {
                    spell.Cast(prediction.CastPosition);
                }
            }
        }
コード例 #20
0
        private Tuple<int, List<Obj_AI_Hero>> GetHits(Spell spell,
            bool advancedChecks = true,
            float overrideWidth = -1f,
            Vector3 fromCheck = default(Vector3))
        {
            try
            {
                if (fromCheck.Equals(default(Vector3)))
                {
                    fromCheck = Ball.Position;
                }

                var input = new PredictionInput
                {
                    Collision = true,
                    CollisionObjects = new[] { CollisionableObjects.YasuoWall },
                    From = fromCheck,
                    RangeCheckFrom = fromCheck,
                    Type = spell.Type,
                    Radius = spell.Width,
                    Delay = spell.Delay,
                    Speed = spell.Speed,
                    Range = spell.Range,
                    Aoe = true
                };

                var width = overrideWidth > 0 ? overrideWidth : spell.Width;
                var hits = new List<Obj_AI_Hero>();
                var positions = new List<CPrediction.Position>();
                foreach (var t in GameObjects.EnemyHeroes)
                {
                    if (t.IsValidTarget(width * 4, true, fromCheck))
                    {
                        input.Unit = t;
                        var prediction = Prediction.GetPrediction(input);
                        if (prediction.Hitchance >= HitChance.High)
                        {
                            if (!advancedChecks ||
                                (Utils.IsImmobile(t) || Utils.IsSlowed(t) || t.Distance(fromCheck) < spell.Width * 0.75 ||
                                 t.Distance(fromCheck) < spell.Width &&
                                 (fromCheck.Distance(Ball.Position) > 100 || t.IsFacing(fromCheck, 120f))))
                            {
                                positions.Add(new CPrediction.Position(t, prediction.UnitPosition));
                            }
                        }
                    }
                }
                if (positions.Any())
                {
                    var circle = new Geometry.Polygon.Circle(fromCheck, width);
                    hits.AddRange(
                        from position in positions
                        where
                            !advancedChecks || !position.Hero.IsDashing() ||
                            (position.Hero.Distance(fromCheck) >= 100f &&
                             position.Hero.Position.Distance(fromCheck) >
                             position.Hero.GetDashInfo().EndPos.Distance(fromCheck) - 50f)
                        where circle.IsInside(position.UnitPosition)
                        select position.Hero);
                    return new Tuple<int, List<Obj_AI_Hero>>(hits.Count, hits);
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return new Tuple<int, List<Obj_AI_Hero>>(0, new List<Obj_AI_Hero>());
        }
コード例 #21
0
ファイル: Casting.cs プロジェクト: 4859aa/LeagueSharp-Dev
 public static void TargetSkill(Spell spell)
 {
     TargetSkill(TargetSelector.GetTarget(spell), spell);
 }
コード例 #22
0
ファイル: Orianna.cs プロジェクト: hprobotic/LeagueSharp-Dev
 private Tuple<int, List<Obj_AI_Hero>> GetHits(Spell spell)
 {
     try
     {
         var hits = new List<Obj_AI_Hero>();
         var positions = (from t in GameObjects.EnemyHeroes
             where t.IsValidTarget(spell.Width * 4, true, spell.RangeCheckFrom)
             let prediction = spell.GetPrediction(t)
             where prediction.Hitchance >= HitChance.High
             select new CPrediction.Position(t, prediction.UnitPosition)).ToList();
         if (positions.Any())
         {
             var circle = new Geometry.Polygon.Circle(Ball.Position, spell.Width);
             hits.AddRange(
                 from position in positions
                 where
                     !position.Hero.IsDashing() ||
                     (position.Hero.Distance(Ball.Position) >= 100f &&
                      position.Hero.Position.Distance(Ball.Position) >
                      position.Hero.GetDashInfo().EndPos.Distance(Ball.Position) - 50f)
                 where
                     new Geometry.Polygon.Circle(
                         position.UnitPosition,
                         (position.Hero.BoundingRadius * CPrediction.BoundingRadiusMultiplicator)).Points.Any(
                             p => circle.IsInside(p))
                 select position.Hero);
             return new Tuple<int, List<Obj_AI_Hero>>(hits.Count, hits);
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return new Tuple<int, List<Obj_AI_Hero>>(0, null);
 }
コード例 #23
0
ファイル: Casting.cs プロジェクト: 4859aa/LeagueSharp-Dev
 public static void SkillShot(Spell spell, HitChance hitChance, bool boundingRadius = true, bool maxRange = true)
 {
     SkillShot(TargetSelector.GetTarget(spell), spell, hitChance);
 }
コード例 #24
0
 private Tuple<int, List<Obj_AI_Hero>> GetHits(Spell spell, float overrideWidth = -1f)
 {
     try
     {
         var width = overrideWidth > 0 ? overrideWidth : spell.Width;
         var hits = new List<Obj_AI_Hero>();
         var positions = (from t in GameObjects.EnemyHeroes
             where t.IsValidTarget(width * 4, true, spell.RangeCheckFrom)
             let prediction = spell.GetPrediction(t)
             where prediction.Hitchance >= HitChance.High
             where
                 Utils.IsImmobile(t) || Utils.IsSlowed(t) || t.Distance(Ball.Position) < spell.Width * 0.75 ||
                 t.Distance(Ball.Position) < spell.Width && t.IsFacing(Ball.Position, 120f)
             select new CPrediction.Position(t, prediction.UnitPosition)).ToList();
         if (positions.Any())
         {
             var circle = new Geometry.Polygon.Circle(Ball.Position, width);
             hits.AddRange(
                 from position in positions
                 where
                     !position.Hero.IsDashing() ||
                     (position.Hero.Distance(Ball.Position) >= 100f &&
                      position.Hero.Position.Distance(Ball.Position) >
                      position.Hero.GetDashInfo().EndPos.Distance(Ball.Position) - 50f)
                 where circle.IsInside(position.UnitPosition)
                 select position.Hero);
             return new Tuple<int, List<Obj_AI_Hero>>(hits.Count, hits);
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return new Tuple<int, List<Obj_AI_Hero>>(0, null);
 }
コード例 #25
0
 public static void SkillShot(Spell spell, HitChance hitChance, bool boundingRadius = true, bool maxRange = true)
 {
     SkillShot(TargetSelector.GetTarget(spell), spell, hitChance);
 }
コード例 #26
0
 public static void FarmSelfAoe(Spell spell, List<Obj_AI_Base> minions, int minHit = 3, float overrideWidth = -1f)
 {
     if (!spell.IsReady() || minions.Count == 0)
     {
         return;
     }
     if (minions.Count >= minHit)
     {
         spell.Cast();
     }
 }
コード例 #27
0
        public static Result Circle(Spell spell,
            Obj_AI_Hero target,
            HitChance hitChance,
            bool boundingRadius = true,
            bool extended = true)
        {
            try
            {
                if (spell == null || target == null)
                {
                    return new Result(Vector3.Zero, new List<Obj_AI_Hero>());
                }
                var hits = new List<Obj_AI_Hero>();
                var center = Vector3.Zero;
                var radius = float.MaxValue;
                var range = spell.Range + (extended ? spell.Width * 0.85f : 0) +
                            (boundingRadius ? target.BoundingRadius * BoundingRadiusMultiplicator : 0);
                var positions = (from t in GameObjects.EnemyHeroes
                    where t.IsValidTarget(range * 1.5f, true, spell.RangeCheckFrom)
                    let prediction = spell.GetPrediction(t)
                    where prediction.Hitchance >= hitChance
                    select new Position(t, prediction.UnitPosition)).ToList();
                var spellWidth = spell.Width;
                if (positions.Any())
                {
                    var mainTarget = positions.FirstOrDefault(p => p.Hero.NetworkId == target.NetworkId);
                    var possibilities =
                        ListExtensions.ProduceEnumeration(
                            positions.Where(
                                p => p.UnitPosition.Distance(mainTarget.UnitPosition) <= spell.Width * 0.85f).ToList())
                            .Where(p => p.Count > 0 && p.Any(t => t.Hero.NetworkId == mainTarget.Hero.NetworkId))
                            .ToList();
                    foreach (var possibility in possibilities)
                    {
                        var mec = MEC.GetMec(possibility.Select(p => p.UnitPosition.To2D()).ToList());
                        var distance = spell.From.Distance(mec.Center.To3D());
                        if (mec.Radius < spellWidth && distance < range)
                        {
                            var lHits = new List<Obj_AI_Hero>();
                            var circle =
                                new Geometry.Polygon.Circle(
                                    spell.From.Extend(
                                        mec.Center.To3D(), spell.Range > distance ? distance : spell.Range), spell.Width);

                            if (boundingRadius)
                            {
                                lHits.AddRange(
                                    from position in positions
                                    where
                                        new Geometry.Polygon.Circle(
                                            position.UnitPosition,
                                            position.Hero.BoundingRadius * BoundingRadiusMultiplicator).Points.Any(
                                                p => circle.IsInside(p))
                                    select position.Hero);
                            }
                            else
                            {
                                lHits.AddRange(
                                    from position in positions
                                    where circle.IsInside(position.UnitPosition)
                                    select position.Hero);
                            }

                            if ((lHits.Count > hits.Count || lHits.Count == hits.Count && mec.Radius < radius ||
                                 lHits.Count == hits.Count &&
                                 spell.From.Distance(circle.Center.To3D()) < spell.From.Distance(center)) &&
                                lHits.Any(p => p.NetworkId == target.NetworkId))
                            {
                                center = circle.Center.To3D2();
                                radius = mec.Radius;
                                hits.Clear();
                                hits.AddRange(lHits);
                            }
                        }
                    }
                    if (!center.Equals(Vector3.Zero))
                    {
                        return new Result(center, hits);
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return new Result(Vector3.Zero, new List<Obj_AI_Hero>());
        }
コード例 #28
0
 private static void ConeFarm(Spell spell, List<Obj_AI_Base> minions, int min, float overrideWidth = -1f)
 {
     var spellWidth = overrideWidth > 0 ? overrideWidth : spell.Width;
     var pred = spell.GetCircularFarmLocation(minions, spellWidth);
     if (pred.MinionsHit >= min)
     {
         spell.Cast(pred.Position);
     }
 }
コード例 #29
0
        private static void LineFarm(Spell spell, List<Obj_AI_Base> minions, int min, float overrideWidth = -1f)
        {
            var spellWidth = overrideWidth > 0 ? overrideWidth : spell.Width;
            var totalHits = 0;
            var castPos = Vector3.Zero;

            var positions = (from minion in minions
                let pred = spell.GetPrediction(minion)
                where pred.Hitchance >= HitChance.Medium
                select new Tuple<Obj_AI_Base, Vector3>(minion, pred.UnitPosition)).ToList();

            if (positions.Any())
            {
                foreach (var position in positions)
                {
                    var rect = new Geometry.Polygon.Rectangle(
                        ObjectManager.Player.Position, ObjectManager.Player.Position.Extend(position.Item2, spell.Range),
                        spellWidth);
                    var count =
                        positions.Select(
                            position2 =>
                                new Geometry.Polygon.Circle(position2.Item2, position2.Item1.BoundingRadius * 0.9f))
                            .Count(circle => circle.Points.Any(p => rect.IsInside(p)));
                    if (count > totalHits)
                    {
                        totalHits = count;
                        castPos = position.Item2;
                    }
                    if (totalHits == minions.Count)
                    {
                        break;
                    }
                }
                if (!castPos.Equals(Vector3.Zero) && totalHits >= min)
                {
                    spell.Cast(castPos);
                }
            }
        }
コード例 #30
0
 private static void CircleFarm(Spell spell, List<Obj_AI_Base> minions, int min, float overrideWidth = -1f)
 {
     var spellWidth = (overrideWidth > 0 ? overrideWidth : spell.Width) + minions.Average(m => m.BoundingRadius);
     var points = (from minion in minions
         select spell.GetPrediction(minion)
         into pred
         where pred.Hitchance >= HitChance.Medium
         select pred.UnitPosition.To2D()).ToList();
     if (points.Any())
     {
         var possibilities = ListExtensions.ProduceEnumeration(points).Where(p => p.Count >= min).ToList();
         if (possibilities.Any())
         {
             var hits = 0;
             var radius = float.MaxValue;
             var pos = Vector3.Zero;
             foreach (var possibility in possibilities)
             {
                 var mec = MEC.GetMec(possibility);
                 if (mec.Radius < spellWidth)
                 {
                     if (possibility.Count > hits || possibility.Count == hits && radius > mec.Radius)
                     {
                         hits = possibility.Count;
                         radius = mec.Radius;
                         pos = mec.Center.To3D();
                     }
                 }
             }
             if (hits >= min && !pos.Equals(Vector3.Zero))
             {
                 spell.Cast(pos);
             }
         }
     }
 }
コード例 #31
0
        public static void TargetSkill(Obj_AI_Base target, Spell spell)
        {
            if (!spell.IsReady() || target == null)
            {
                return;
            }

            spell.CastOnUnit(target);
        }
コード例 #32
0
 public static Obj_AI_Hero GetTargetNoCollision(Spell spell,
     bool ignoreShields = true,
     Vector3 from = default(Vector3),
     IEnumerable<Obj_AI_Hero> ignoredChampions = null)
 {
     try
     {
         return
             GetTargets(spell.Range, spell.DamageType, ignoreShields, from, ignoredChampions)
                 .FirstOrDefault(t => spell.GetPrediction(t).Hitchance != HitChance.Collision);
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return null;
 }
コード例 #33
0
        protected override void SetupSpells()
        {
            Q = new Spell(SpellSlot.Q, 825f, DamageType.Magical);
            Q.SetSkillshot(0.15f, 120f, 1345f, false, SkillshotType.SkillshotCircle);

            W = new Spell(SpellSlot.W, float.MaxValue, DamageType.Magical);
            W.SetSkillshot(0f, 230f, float.MaxValue, false, SkillshotType.SkillshotCircle);

            E = new Spell(SpellSlot.E, 1095f, DamageType.Magical);
            E.SetSkillshot(0.25f, 125f, 1700f, false, SkillshotType.SkillshotLine);

            R = new Spell(SpellSlot.R, float.MaxValue, DamageType.Magical);
            R.SetSkillshot(0.75f, 375f, float.MaxValue, false, SkillshotType.SkillshotCircle);
        }
コード例 #34
0
 public static Obj_AI_Hero GetTarget(Spell spell,
     bool ignoreShields = true,
     Vector3 from = default(Vector3),
     IEnumerable<Obj_AI_Hero> ignoredChampions = null)
 {
     try
     {
         return
             GetTarget(
                 (spell.Range + spell.Width +
                  Targets.Items.Select(e => e.Hero.BoundingRadius).DefaultIfEmpty(50).Max()) * 1.1f,
                 spell.DamageType, ignoreShields, from, ignoredChampions);
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return null;
 }
コード例 #35
0
 private void EComboLogic(Spell spell)
 {
     try
     {
         Obj_AI_Hero hero = null;
         var totalHits = 0;
         foreach (var ally in
             GameObjects.AllyHeroes.Where(
                 a =>
                     (Ball.Hero == null || Ball.Hero.NetworkId != a.NetworkId) && a.Distance(Player) <= E.Range &&
                     (a.IsMe || Menu.Item(Menu.Name + ".miscellaneous.e-allies").GetValue<bool>()) &&
                     (a.IsMe && ResourceManager.Check("e-self") || !a.IsMe && ResourceManager.Check("e-allies")))
             )
         {
             var hits = GameObjects.EnemyHeroes.Count(e => e.Distance(ally) < spell.Range);
             if (hits > totalHits)
             {
                 totalHits = hits;
                 hero = ally;
             }
         }
         if (totalHits > 0)
         {
             CastE(hero);
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
コード例 #36
0
 public static void Farm(Spell spell,
     List<Obj_AI_Base> minions,
     int minHit = 3,
     float overrideWidth = -1f,
     bool chargeMax = true)
 {
     if (!spell.IsReady() || minions.Count == 0)
     {
         return;
     }
     if (spell.IsSkillshot)
     {
         if (spell.Type == SkillshotType.SkillshotCircle)
         {
             CircleFarm(spell, minions, minHit, overrideWidth);
         }
         else if (spell.Type == SkillshotType.SkillshotLine)
         {
             LineFarm(spell, minions, minHit, overrideWidth);
         }
         else if (spell.Type == SkillshotType.SkillshotCone)
         {
             ConeFarm(spell, minions, minHit, overrideWidth);
         }
     }
     else
     {
         var minion =
             minions.OrderBy(m => spell.IsKillable(m))
                 .FirstOrDefault(
                     m =>
                         spell.IsInRange(m) && spell.GetDamage(m) > m.Health ||
                         m.Health - spell.GetDamage(m) > m.MaxHealth * 0.25f);
         if (minion != null)
         {
             spell.CastOnUnit(minion);
         }
     }
 }
コード例 #37
0
 public static Result Line(Spell spell,
     Obj_AI_Hero target,
     HitChance hitChance,
     bool boundingRadius = true,
     bool maxRange = true)
 {
     try
     {
         if (spell == null || target == null)
         {
             return new Result(Vector3.Zero, new List<Obj_AI_Hero>());
         }
         var range = (spell.IsChargedSpell && maxRange ? spell.ChargedMaxRange : spell.Range) +
                     spell.Width * 0.9f +
                     (boundingRadius ? target.BoundingRadius * BoundingRadiusMultiplicator : 0);
         var positions = (from t in GameObjects.EnemyHeroes
             where t.IsValidTarget(range, true, spell.RangeCheckFrom)
             let prediction = spell.GetPrediction(t)
             where prediction.Hitchance >= hitChance
             select new Position(t, prediction.UnitPosition)).ToList();
         if (positions.Any())
         {
             var hits = new List<Obj_AI_Hero>();
             var pred = spell.GetPrediction(target);
             if (pred.Hitchance >= hitChance)
             {
                 hits.Add(target);
                 var rect = new Geometry.Polygon.Rectangle(
                     spell.From, spell.From.Extend(pred.CastPosition, range), spell.Width);
                 if (boundingRadius)
                 {
                     hits.AddRange(
                         from point in positions.Where(p => p.Hero.NetworkId != target.NetworkId)
                         let circle =
                             new Geometry.Polygon.Circle(
                                 point.UnitPosition, point.Hero.BoundingRadius * BoundingRadiusMultiplicator)
                         where circle.Points.Any(p => rect.IsInside(p))
                         select point.Hero);
                 }
                 else
                 {
                     hits.AddRange(
                         from position in positions
                         where rect.IsInside(position.UnitPosition)
                         select position.Hero);
                 }
                 return new Result(pred.CastPosition, hits);
             }
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return new Result(Vector3.Zero, new List<Obj_AI_Hero>());
 }
コード例 #38
0
        public static void FarmSelfAoe(Spell spell,
            int minHit = 3,
            float overrideWidth = -1f,
            List<Obj_AI_Base> minions = null)
        {
            if (!spell.IsReady())
            {
                return;
            }
            var spellWidth = overrideWidth > 0 ? overrideWidth : (spell.Width > 25f ? spell.Width : spell.Range);

            if (minions == null)
            {
                minions = MinionManager.GetMinions(
                    spellWidth, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.MaxHealth);
            }

            if (minions.Count == 0)
            {
                return;
            }

            if (minHit > 1)
            {
                var nearest = minions.OrderBy(m => m.Distance(ObjectManager.Player)).FirstOrDefault();
                if (nearest != null && nearest.Team == GameObjectTeam.Neutral)
                {
                    minHit = 1;
                }
            }
            if (minions.Count >= minHit)
            {
                spell.Cast();
            }
        }
コード例 #39
0
 public static void TargetSkill(Spell spell)
 {
     TargetSkill(TargetSelector.GetTarget(spell), spell);
 }
コード例 #40
0
        public static Result Circle(Spell spell,
                                    Obj_AI_Hero target,
                                    HitChance hitChance,
                                    bool boundingRadius = true,
                                    bool extended       = true)
        {
            try
            {
                if (spell == null || target == null)
                {
                    return(new Result(Vector3.Zero, new List <Obj_AI_Hero>()));
                }
                var hits   = new List <Obj_AI_Hero>();
                var center = Vector3.Zero;
                var radius = float.MaxValue;
                var range  = spell.Range + (extended ? spell.Width * 0.85f : 0) +
                             (boundingRadius ? target.BoundingRadius * BoundingRadiusMultiplicator : 0);
                var positions = (from t in GameObjects.EnemyHeroes
                                 where t.IsValidTarget(range * 1.5f, true, spell.RangeCheckFrom)
                                 let prediction = spell.GetPrediction(t)
                                                  where prediction.Hitchance >= hitChance
                                                  select new Position(t, prediction.UnitPosition)).ToList();
                var spellWidth = spell.Width;
                if (positions.Any())
                {
                    var mainTarget    = positions.FirstOrDefault(p => p.Hero.NetworkId == target.NetworkId);
                    var possibilities =
                        ListExtensions.ProduceEnumeration(
                            positions.Where(
                                p => p.UnitPosition.Distance(mainTarget.UnitPosition) <= spell.Width * 0.85f).ToList())
                        .Where(p => p.Count > 0 && p.Any(t => t.Hero.NetworkId == mainTarget.Hero.NetworkId))
                        .ToList();
                    foreach (var possibility in possibilities)
                    {
                        var mec      = MEC.GetMec(possibility.Select(p => p.UnitPosition.To2D()).ToList());
                        var distance = spell.From.Distance(mec.Center.To3D());
                        if (mec.Radius < spellWidth && distance < range)
                        {
                            var lHits  = new List <Obj_AI_Hero>();
                            var circle =
                                new Geometry.Polygon.Circle(
                                    spell.From.Extend(
                                        mec.Center.To3D(), spell.Range > distance ? distance : spell.Range), spell.Width);

                            if (boundingRadius)
                            {
                                lHits.AddRange(
                                    from position in positions
                                    where
                                    new Geometry.Polygon.Circle(
                                        position.UnitPosition,
                                        position.Hero.BoundingRadius * BoundingRadiusMultiplicator).Points.Any(
                                        p => circle.IsInside(p))
                                    select position.Hero);
                            }
                            else
                            {
                                lHits.AddRange(
                                    from position in positions
                                    where circle.IsInside(position.UnitPosition)
                                    select position.Hero);
                            }

                            if ((lHits.Count > hits.Count || lHits.Count == hits.Count && mec.Radius < radius ||
                                 lHits.Count == hits.Count &&
                                 spell.From.Distance(circle.Center.To3D()) < spell.From.Distance(center)) &&
                                lHits.Any(p => p.NetworkId == target.NetworkId))
                            {
                                center = circle.Center.To3D2();
                                radius = mec.Radius;
                                hits.Clear();
                                hits.AddRange(lHits);
                            }
                        }
                    }
                    if (!center.Equals(Vector3.Zero))
                    {
                        return(new Result(center, hits));
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return(new Result(Vector3.Zero, new List <Obj_AI_Hero>()));
        }