Example #1
0
        internal static void LCast(this Spell spell, Obj_AI_Base target, HitChance SelectedHitchance, float alpha = 0f, float colmini = float.MaxValue, bool HeroOnly = false, float BombRadius = 0f) //for Linar spells  사용예시 AIO_Func.LCast(Q,Qtarget,50,0)
        {                                                                                                                                                                                             //        AIO_Func.LCast(E,Etarget,Menu.Item("Misc.Etg").GetValue<Slider>().Value,float.MaxValue); <- 이런식으로 사용.
            if (spell.Type == SkillshotType.SkillshotLine)
            {
                if (spell != null && target != null)
                {
                    var pred      = LeagueSharp.Common.Prediction.GetPrediction(target, spell.Delay, spell.Width / 2, spell.Speed); //spell.Width/2
                    var collision = spell.GetCollision(Player.ServerPosition.To2D(), new List <SharpDX.Vector2> {
                        pred.CastPosition.To2D()
                    });
                    //var minioncol = collision.Where(x => !(x is AIHeroClient)).Count(x => x.IsMinion);
                    var             minioncol = collision.Count(x => (HeroOnly == false ? x.IsMinion : (x is AIHeroClient)));
                    SharpDX.Vector2 EditedVec = pred.UnitPosition.To2D() -
                                                SharpDX.Vector2.Normalize(pred.UnitPosition.To2D() - target.ServerPosition.To2D()) * (spell.Width * 2 / 5);
                    SharpDX.Vector2 EditedVec2 = (pred.UnitPosition.To2D() + target.ServerPosition.To2D()) / 2;

                    var collision2 = spell.GetCollision(Player.ServerPosition.To2D(), new List <SharpDX.Vector2> {
                        EditedVec
                    });
                    var minioncol2 = collision2.Count(x => (HeroOnly == false ? x.IsMinion : (x is AIHeroClient)));
                    var collision3 = spell.GetCollision(Player.ServerPosition.To2D(), new List <SharpDX.Vector2> {
                        EditedVec2
                    });
                    var minioncol3 = collision3.Count(x => (HeroOnly == false ? x.IsMinion : (x is AIHeroClient)));
                    if (pred.Hitchance >= SelectedHitchance)
                    {
                        if (target.IsValidTarget(spell.Range - target.MoveSpeed * (spell.Delay + Player.Distance(target.ServerPosition) / spell.Speed) + alpha) && minioncol2 <= colmini && pred.UnitPosition.Distance(target.ServerPosition) > spell.Width)
                        {
                            spell.Cast(EditedVec);
                        }
                        else if (target.IsValidTarget(spell.Range - target.MoveSpeed * (spell.Delay + Player.Distance(target.ServerPosition) / spell.Speed) + alpha) && minioncol3 <= colmini && pred.UnitPosition.Distance(target.ServerPosition) > spell.Width / 2)
                        {
                            spell.Cast(EditedVec2);
                        }
                        else if (target.IsValidTarget(spell.Range - target.MoveSpeed * (spell.Delay + Player.Distance(target.ServerPosition) / spell.Speed) + alpha) && minioncol <= colmini)
                        {
                            spell.Cast(pred.CastPosition);
                        }
                        else if (false == spell.Collision && colmini < 1 && minioncol >= 1)
                        {
                            var FirstMinion = collision.OrderBy(o => o.Distance(Player.ServerPosition)).FirstOrDefault();
                            if (FirstMinion.ServerPosition.Distance(pred.UnitPosition) <= BombRadius / 4)
                            {
                                spell.Cast(pred.CastPosition);
                            }
                        }
                    }
                }
            }
        }
Example #2
0
 private static void LastHitQ()
 {
     if (!_Q.IsReady())
     {
         return;
     }
     if (getCheckBoxItem(JungleClear, "Veigar_JUseQSet") || getCheckBoxItem(LaneClear, "Veigar_LUseQSet"))
     {
         var minions    = MinionManager.GetMinions(_Q.Range, MinionTypes.All, MinionTeam.NotAlly).Where(m => m.LSIsValidTarget() && m.Health > 5 && m.LSDistance(Player) < _Q.Range && m.Health < (_Q.GetDamage(m) - getSliderItem(Misc, "Veigar_LowerQ")));
         var objAiBases = from minion in minions let pred = _Q.GetCollision(Player.Position.LSTo2D(), new List <Vector2>()
         {
             Player.Position.LSExtend(minion.Position, _Q.Range).LSTo2D()
         }, 70f) orderby pred.Count descending select minion;
         if (objAiBases.Any())
         {
             foreach (var minion in objAiBases)
             {
                 var collision = _Q.GetCollision(Player.Position.LSTo2D(), new List <Vector2>()
                 {
                     Player.Position.LSExtend(minion.Position, _Q.Range).LSTo2D()
                 }, 70f).OrderBy(c => c.LSDistance(Player)).ToList();
                 if (collision.Count <= 2 || collision[0].NetworkId == minion.NetworkId || collision[1].NetworkId == minion.NetworkId)
                 {
                     if (collision.Count == 1)
                     {
                         _Q.Cast(minion);
                     }
                     else
                     {
                         _Q.Cast(minion);
                     }
                 }
             }
         }
     }
 }
Example #3
0
 private void CastQHero(AIHeroClient target)
 {
     if (Program.IsSPrediction)
     {
         var pred = Q.GetSPrediction(target);
         if (pred.CollisionResult.Units.Count < 2)
         {
             Q.Cast(pred.CastPosition);
         }
     }
     else
     {
         var targQ     = Q.GetPrediction(target, true);
         var collision = Q.GetCollision(
             player.Position.To2D(), new List <Vector2>()
         {
             targQ.CastPosition.To2D()
         });
         if (Q.Range - 100 > targQ.CastPosition.Distance(player.Position) && collision.Count < 2)
         {
             Q.CastIfHitchanceEquals(target, HitChance.High);
         }
     }
 }
Example #4
0
 internal static void ConeCast(this Spell spell, Obj_AI_Base target, HitChance SelectedHitchance, float alpha = 0f, float colmini = float.MaxValue, bool HeroOnly = false)
 {
     if (spell.Type == SkillshotType.SkillshotCone)
     {
         if (spell != null && target != null)
         {
             var pred      = LeagueSharp.Common.Prediction.GetPrediction(target, spell.Delay, spell.Width / 2, spell.Speed); //spell.Width/2
             var collision = spell.GetCollision(Player.ServerPosition.To2D(), new List <SharpDX.Vector2> {
                 pred.CastPosition.To2D()
             });
             var minioncol = collision.Count(x => (HeroOnly == false ? x.IsMinion : (x is AIHeroClient)));
             if (target.IsValidTarget(spell.Range - target.MoveSpeed * (spell.Delay + Player.Distance(target.ServerPosition) / spell.Speed) + alpha) && minioncol <= colmini && pred.Hitchance >= SelectedHitchance)
             {
                 spell.Cast(pred.CastPosition);
             }
         }
     }
 }
Example #5
0
        private static void Unit_OnDash(Obj_AI_Base sender, Dash.DashItem args)
        {
            if (sender.IsEnemy && Player.LSDistance(args.EndPos) > Player.LSDistance(args.StartPos))
            {
                if (E.IsInRange(args.StartPos))
                {
                    E.Cast(sender);
                }

                if (getCheckBoxItem(SpellConfig, "autoQ") && SpellQ.GetState() == QState.ThreshQ && Q.IsInRange(args.EndPos) && !E.IsInRange(args.EndPos) && Math.Abs(args.Duration - args.EndPos.LSDistance(sender) / Q.Speed * 1000) < 150)
                {
                    List <Vector2> to = new List <Vector2>();
                    to.Add(args.EndPos);
                    var QCollision = Q.GetCollision(Player.Position.LSTo2D(), to);
                    if (QCollision == null || QCollision.Count == 0 || QCollision.All(a => !a.IsMinion))
                    {
                        if (Q.Cast(args.EndPos))
                        {
                            return;
                        }
                    }
                }
            }
        }
Example #6
0
            /// <summary>
            /// Casts aoe spell
            /// </summary>
            /// <param name="s">Spell to cast</param>
            /// <param name="t">Target for spell</param>
            /// <param name="hc">Minimum HitChance to cast</param>
            /// <param name="minHit">Minimum Hit Count to cast</param>
            /// <param name="rangeCheckFrom">Position where spell will be casted from</param>
            /// <param name="filterHPPercent">Minimum HP Percent to cast (for target)</param>
            /// <returns>true if spell has casted</returns>
            public static bool Cast(Spell s, Obj_AI_Hero t, HitChance hc, int reactionIgnoreDelay = 0, byte minHit = 2, Vector3? rangeCheckFrom = null, float filterHPPercent = 0)
            {
                if (!blInitialized)
                    throw new Exception("Prediction is not initalized");

                if (rangeCheckFrom == null)
                    rangeCheckFrom = ObjectManager.Player.ServerPosition;

                if (Monitor.TryEnter(EnemyInfo[t.NetworkId].m_lock))
                {
                    try
                    {
                        HitChance predictedhc = HitChance.Impossible;
                        float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay;
                        float movt = t.LastMovChangeTime();
                        Vector2 pos = ObjectManager.Player.ServerPosition.To2D();
                        switch (s.Type)
                        {
                            case SkillshotType.SkillshotLine:   pos = Line.GetPrediction(t, s, t.GetWaypoints(), avgt, movt, filterHPPercent, minHit, out predictedhc, rangeCheckFrom.Value);
                                break;
                            case SkillshotType.SkillshotCircle: pos = Circle.GetPrediction(t, s, t.GetWaypoints(), avgt, movt, filterHPPercent, minHit, out predictedhc, rangeCheckFrom.Value);
                                break;
                            case SkillshotType.SkillshotCone:   pos = Cone.GetPrediction(t, s, t.GetWaypoints(), avgt, movt, filterHPPercent, minHit, out predictedhc, rangeCheckFrom.Value);
                                break;
                        }

                        //pos = pos + pos.Perpendicular() * s.Width / 2; //need moar test (for lineaar skillshots)
                        if (s.Collision && s.GetCollision(rangeCheckFrom.Value.To2D(), new List<Vector2> { pos }).Exists(q => q.IsEnemy)) //needs update
                        {
                            Monitor.Pulse(EnemyInfo[t.NetworkId].m_lock);
                            return false;
                        }

                        if (predictedhc >= hc)
                        {
                            s.Cast(pos);

                            return true;
                        }

                        Monitor.Pulse(EnemyInfo[t.NetworkId].m_lock);
                        return false;
                    }
                    finally
                    {
                        Monitor.Exit(EnemyInfo[t.NetworkId].m_lock);
                    }
                }
                return false;
            }