Exemple #1
0
        /// <summary>
        ///     Collideses the with wall.
        /// </summary>
        /// <param name="start">The start.</param>
        /// <param name="end">The end.</param>
        /// <returns></returns>
        internal static bool CollidesWithWall(Vector3 start, Vector3 end)
        {
            if (Environment.TickCount - _wallCastT > 4000)
            {
                return false;
            }

            GameObject wall = null;
            foreach (var gameObject in
                ObjectManager.Get<GameObject>()
                    .Where(
                        gameObject =>
                            gameObject.IsValid &&
                            Regex.IsMatch(
                                gameObject.Name, "_w_windwall_enemy_0.\\.troy", RegexOptions.IgnoreCase))
                )
            {
                wall = gameObject;
            }
            if (wall == null)
            {
                return false;
            }
            var level = wall.Name.Substring(wall.Name.Length - 6, 1);
            var wallWidth = 300 + 50*Convert.ToInt32(level);

            var wallDirection =
                (wall.Position.LSTo2D() - _yasuoWallCastedPos).Normalized().Perpendicular();
            var wallStart = wall.Position.LSTo2D() + wallWidth/2f*wallDirection;
            var wallEnd = wallStart - wallWidth*wallDirection;

            for (var i = 0; i < start.LSDistance(end); i += 30)
            {
                var currentPosition = start.LSExtend(end, i);
                if (wallStart.Intersection(wallEnd, currentPosition.LSTo2D(), start.LSTo2D()).Intersects)
                {
                    return true;
                }
            }

            return false;
        }
Exemple #2
0
 private static int CountEnemiesInRangeDeley(Vector3 position, float range, float delay)
 {
     return Program.Enemies.Where(t => t.LSIsValidTarget()).Select(t => Prediction.GetPrediction(t, delay).CastPosition).Count(prepos => position.LSDistance(prepos) < range);
 }
Exemple #3
0
 public static Vector3 ClosestWall(Vector3 StartPos, Vector3 EndPos)
 {
     var distance = StartPos.LSDistance(EndPos);
     for (int i = 1; i < 8; i++)
     {
         if (StartPos.LSExtend(EndPos, distance + 55 * i).LSIsWall())
         {
             return StartPos.LSExtend(EndPos, distance + 55 * i);
         }
     }
     return EndPos;
 }
Exemple #4
0
 public static bool CheckWalls(Vector3 player, Vector3 enemy)
 {
     var distance = player.LSDistance(enemy);
     for (var i = 1; i < 6; i++)
     {
         if (player.LSExtend(enemy, distance + 55*i).IsWall())
         {
             return true;
         }
     }
     return false;
 }
Exemple #5
0
 private static List<AIHeroClient> GetRTarget(Vector3 pos)
 {
     return
         HeroManager.Enemies.Where(
             i => i.LSIsValidTarget() && pos.LSDistance(Prediction.GetPrediction(i, 0.25f).UnitPosition) < RWidth)
             .ToList();
 }
Exemple #6
0
 public static bool CheckWalls(Vector3 from, Vector3 to)
 {
     var steps = 6f;
     var stepLength = from.LSDistance(to)/steps;
     for (var i = 1; i < steps + 1; i++)
     {
         if (from.Extend(to, stepLength*i).IsWall())
         {
             return true;
         }
     }
     return false;
 }
Exemple #7
0
 private void CastE(Vector3 target)
 {
     if (target.LSDistance(player.Position) > eRanges[E.Level - 1])
     {
         return;
     }
     if (E.IsCharging)
     {
         if (target.LSDistance(player.Position) < E.Range)
         {
             E.Cast(target, getCheckBoxItem(config, "packets"));
         }
     }
     else if (target.LSDistance(player.Position) < eRanges[E.Level - 1])
     {
         E.SetCharged("ZacE", "ZacE", 295, eRanges[E.Level - 1], eChannelTimes[E.Level - 1]);
         E.StartCharging(target);
     }
 }
Exemple #8
0
        static bool IsTurretPosition(Vector3 pos)
        {
            float mindistance = 2000;
            foreach (int NetID in AllEnemyTurret)
            {
                Obj_AI_Turret turret = ObjectManager.GetUnitByNetworkId<Obj_AI_Turret>((uint)NetID);
                if (turret != null && !turret.IsDead && !TurretHasAggro[NetID])
                {
                    float distance = pos.LSDistance(turret.Position);
                    if (mindistance >= distance)
                    {
                        mindistance = distance;

                    }

                }
            }
            return mindistance <= 950;
        }
Exemple #9
0
 public bool Contains(Vector3 position)
 {
     return position.LSDistance(From) <= player.BoundingRadius;
 }
Exemple #10
0
 public static bool IsWallBetween(Vector3 start, Vector3 end, int step = 3)
 {
     if (start.IsValid() && end.IsValid() && step > 0)
     {
         var distance = start.LSDistance(end);
         for (var i = 0; i < distance; i = i + step)
         {
             if (NavMesh.GetCollisionFlags(start.LSExtend(end, i)) == CollisionFlags.Wall)
             {
                 return true;
             }
         }
     }
     return false;
 }
Exemple #11
0
 private bool Qhit(Vector3 target)
 {
     return Q.IsReady() && CombatHelper.IsFacing(player, target, 80) &&
            target.LSDistance(player.Position) < Q.Range;
 }
Exemple #12
0
 private void kill(Positions positions, Vector3 pos)
 {
     if (R.IsReady() && pos.LSDistance(positions.Player.Position) < 1200 &&
         ObjectManager.Get<AIHeroClient>()
             .Count(o => o.IsAlly && o.LSDistance(pos) < config["Alliesrange"].Cast<Slider>().CurrentValue) <
         1)
     {
         if (checkdmg(positions.Player, pos) && UltTime(pos) < positions.RecallData.GetRecallTime() &&
             !isColliding(pos))
         {
             if (player.ChampionName == "Xerath")
             {
                 xerathUlt(positions, pos);
             }
             R.Cast(pos);
             if (player.ChampionName == "Draven" && config["CallBack"].Cast<CheckBox>().CurrentValue)
             {
                 LeagueSharp.Common.Utility.DelayAction.Add((int) (UltTime(pos) - 300), () => R.Cast());
             }
         }
     }
 }
Exemple #13
0
 private static bool CheckQusage(Vector3 pos, AIHeroClient target)
 {
     return pos.IsValid() && pos.LSDistance(player.Position) < Q.Range &&
            (target.HasBuff("fiorapassivemanager") || target.HasBuff("fiorarmark")) && !pos.IsWall() &&
            Qradius > pos.LSDistance(target.Position);
 }
Exemple #14
0
        public static Geometry.Polygon GetPolyFromVector(Vector3 from, Vector3 to, float width)
        {
            var POS = to.Extend(from, from.LSDistance(to));
            var direction = (POS - to.LSTo2D()).Normalized();

            var pos1 = (to.LSTo2D() - direction.Perpendicular()*width/2f).To3D();

            var pos2 =
                (POS + (POS - to.LSTo2D()).Normalized() + direction.Perpendicular()*width/2f).To3D();

            var pos3 = (to.LSTo2D() + direction.Perpendicular()*width/2f).To3D();

            var pos4 =
                (POS + (POS - to.LSTo2D()).Normalized() - direction.Perpendicular()*width/2f).To3D();
            var poly = new Geometry.Polygon();
            poly.Add(pos1);
            poly.Add(pos3);
            poly.Add(pos2);
            poly.Add(pos4);
            return poly;
        }
Exemple #15
0
        private static List<Vector3> AimQ(Vector3 finalPos)
        {
            var CircleLineSegmentN = 36;
            var radius = 500;
            var position = Player.Position;

            var points = new List<Vector3>();
            for (var i = 1; i <= CircleLineSegmentN; i++)
            {
                var angle = i*2*Math.PI/CircleLineSegmentN;
                var point = new Vector3(position.X + radius*(float) Math.Cos(angle),
                    position.Y + radius*(float) Math.Sin(angle), position.Z);
                if (point.LSDistance(Player.Position.LSExtend(finalPos, radius)) < 430)
                {
                    points.Add(point);
                    //Utility.DrawCircle(point, 20, System.Drawing.Color.Aqua, 1, 1);
                }
            }

            var point2 = points.OrderBy(x => x.LSDistance(finalPos));
            points = point2.ToList();
            points.RemoveAt(0);
            points.RemoveAt(1);
            return points;
        }
Exemple #16
0
        public static bool goesThroughWall(Vector3 vec1, Vector3 vec2)
        {
            if (wall.endtime < Game.Time || wall.pointL == null || wall.pointL == null)
                return false;
            Vector2 inter = YasMath.LineIntersectionPoint(vec1.LSTo2D(), vec2.LSTo2D(), wall.pointL.Position.LSTo2D(), wall.pointR.Position.LSTo2D());
            float wallW = (300 + 50 * W.Level);
            if (wall.pointL.Position.LSTo2D().LSDistance(inter) > wallW ||
                wall.pointR.Position.LSTo2D().LSDistance(inter) > wallW)
                return false;
            var dist = vec1.LSDistance(vec2);
            if (vec1.LSTo2D().LSDistance(inter) + vec2.LSTo2D().LSDistance(inter) - 30 > dist)
                return false;

            return true;
        }
Exemple #17
0
        private static void BestAim(Vector3 predictionPos)
        {
            var start = Player.Position.LSTo2D();
            var c1 = predictionPos.LSDistance(Player.Position);
            var playerPos2d = Player.Position.LSTo2D();

            foreach (var point in pointList)
            {
                for (var j = 400; j <= 1100; j = j + 50)
                {
                    var posExtend = Player.Position.LSExtend(point, j);

                    var a1 = Player.LSDistance(posExtend);
                    var b1 = (float) Math.Sqrt(c1*c1 - a1*a1);

                    if (b1 > QSplit.Range)
                        continue;

                    var pointA = Player.Position.LSExtend(point, a1);

                    var end = pointA.LSTo2D();
                    var dir = (end - start).Normalized();
                    var pDir = dir.Perpendicular();

                    var rightEndPos = end + pDir*b1;
                    var leftEndPos = end - pDir*b1;

                    var rEndPos = new Vector3(rightEndPos.X, rightEndPos.Y, ObjectManager.Player.Position.Z);
                    var lEndPos = new Vector3(leftEndPos.X, leftEndPos.Y, ObjectManager.Player.Position.Z);

                    if (lEndPos.LSDistance(predictionPos) < QSplit.Width)
                    {
                        var collision = Q.GetCollision(playerPos2d, new List<Vector2> {posExtend.LSTo2D()});
                        if (collision.Count > 0)
                            break;

                        var collisionS = QSplit.GetCollision(pointA.LSTo2D(), new List<Vector2> {lEndPos.LSTo2D()});
                        if (collisionS.Count > 0)
                            break;

                        Q.Cast(pointA);
                        return;
                    }
                    if (rEndPos.LSDistance(predictionPos) < QSplit.Width)
                    {
                        var collision = Q.GetCollision(playerPos2d, new List<Vector2> {posExtend.LSTo2D()});
                        if (collision.Count > 0)
                            break;

                        var collisionR = QSplit.GetCollision(pointA.LSTo2D(), new List<Vector2> {rEndPos.LSTo2D()});
                        if (collisionR.Count > 0)
                            break;

                        Q.Cast(pointA);
                        return;
                    }
                }
            }
        }
Exemple #18
0
 /// <summary>
 /// Checks if player can orbwalk given target from custom position
 /// </summary>
 /// <param name="target">Target</param>
 /// <param name="position">Custom position</param>
 /// <returns>true if can orbwalk target</returns>
 public bool CanOrbwalkTarget(AttackableUnit target, Vector3 position)
 {
     if (target.LSIsValidTarget())
     {
         if (target.Type == GameObjectType.AIHeroClient)
         {
             AIHeroClient hero = target as AIHeroClient;
             return position.LSDistance(hero.ServerPosition) - hero.BoundingRadius - hero.GetScalingRange() < Utility.GetAARange();
         }
         else
             return position.LSDistance(target.Position) - target.BoundingRadius < Utility.GetAARange();
     }
     return false;
 }
Exemple #19
0
        private static void JumpUnderTurret(float extrarange, Vector3 objectPosition)
        {
            float mindistance = 100000;
            //Getting next Turret
            Obj_AI_Turret turretToJump = null;

            foreach (int NetID in AllAllyTurret)
            {
                Obj_AI_Turret turret = ObjectManager.GetUnitByNetworkId<Obj_AI_Turret>((uint)NetID);
                if (turret != null && !turret.IsDead)
                {
                    float distance = Player.Position.LSDistance(turret.Position);
                    if (mindistance >= distance)
                    {
                        mindistance = distance;
                        turretToJump = turret;
                    }

                }
            }
            if (turretToJump != null && !TurretHasAggro[turretToJump.NetworkId] && Player.Position.LSDistance(turretToJump.Position) < 1500)
            {
                int i = 0;

                do
                {
                    Vector3 extPos = Player.Position.LSExtend(turretToJump.Position, 685 - i);
                    float dist = objectPosition.LSDistance(extPos + extrarange);
                    Vector3 predictedPosition = objectPosition.LSExtend(extPos, dist);
                    if (predictedPosition.LSDistance(turretToJump.Position) <= 890 && !predictedPosition.LSIsWall())
                    {
                        WardJump(Player.Position.LSExtend(turretToJump.Position, 650 - i), false);
                        JumpPosition = Player.Position.LSExtend(turretToJump.Position, 650 - i);
                        ShallJumpNow = true;
                        break;
                    }

                    i += 50;
                } while (i <= 300 || !Player.Position.LSExtend(turretToJump.Position, 650 - i).LSIsWall());
            }
        }
Exemple #20
0
 public static float GetKnockBackRange(Vector3 to, Vector3 from)
 {
     return R.Range - from.LSDistance(to);
 }
        public static void CreateSpellData(Obj_AI_Base hero, Vector3 spellStartPos, Vector3 spellEndPos,
            SpellData spellData, GameObject obj = null, float extraEndTick = 0.0f, bool processSpell = true,
            SpellType spellType = SpellType.None, bool checkEndExplosion = true, float spellRadius = 0)
        {
            if (checkEndExplosion && spellData.hasEndExplosion)
            {
                CreateSpellData(hero, spellStartPos, spellEndPos,
            spellData, obj, extraEndTick, false,
            spellData.spellType, false);

                CreateSpellData(hero, spellStartPos, spellEndPos,
            spellData, obj, extraEndTick, true,
            SpellType.Circular, false);

                return;
            }

            if (spellStartPos.LSDistance(myHero.Position) < spellData.range + 1000)
            {
                Vector2 startPosition = spellStartPos.LSTo2D();
                Vector2 endPosition = spellEndPos.LSTo2D();
                Vector2 direction = (endPosition - startPosition).LSNormalized();
                float endTick = 0;

                if (spellType == SpellType.None)
                {
                    spellType = spellData.spellType;
                }

                if (spellData.fixedRange) //for diana q
                {
                    if (endPosition.LSDistance(startPosition) > spellData.range)
                    {
                        //var heroCastPos = hero.ServerPosition.LSTo2D();
                        //direction = (endPosition - heroCastPos).LSNormalized();
                        endPosition = startPosition + direction * spellData.range;
                    }
                }

                if (spellType == SpellType.Line)
                {
                    endTick = spellData.spellDelay + (spellData.range / spellData.projectileSpeed) * 1000;
                    endPosition = startPosition + direction * spellData.range;

                    if (spellData.useEndPosition)
                    {
                        var range = spellEndPos.LSTo2D().LSDistance(spellStartPos.LSTo2D());
                        endTick = spellData.spellDelay + (range / spellData.projectileSpeed) * 1000;
                        endPosition = spellEndPos.LSTo2D();
                    }

                    if (obj != null)
                        endTick -= spellData.spellDelay;
                }
                else if (spellType == SpellType.Circular)
                {
                    endTick = spellData.spellDelay;

                    if (spellData.projectileSpeed == 0)
                    {
                        endPosition = hero.ServerPosition.LSTo2D();
                    }
                    else if (spellData.projectileSpeed > 0)
                    {
                        if (spellData.spellType == SpellType.Line &&
                            spellData.hasEndExplosion &&
                            spellData.useEndPosition == false)
                        {
                            endPosition = startPosition + direction * spellData.range;
                        }

                        endTick = endTick + 1000 * startPosition.LSDistance(endPosition) / spellData.projectileSpeed;
                    }
                }
                else if (spellType == SpellType.Arc)
                {
                    endTick = endTick + 1000 * startPosition.LSDistance(endPosition) / spellData.projectileSpeed;

                    if (obj != null)
                        endTick -= spellData.spellDelay;
                }
                else if (spellType == SpellType.Cone)
                {
                    return;
                }
                else
                {
                    return;
                }

                if (spellData.invert)
                {
                    var dir = (startPosition - endPosition).LSNormalized();
                    endPosition = startPosition + dir * startPosition.LSDistance(endPosition);
                }

                if (spellData.isPerpendicular)
                {
                    startPosition = spellEndPos.LSTo2D() - direction.LSPerpendicular() * spellData.secondaryRadius;
                    endPosition = spellEndPos.LSTo2D() + direction.LSPerpendicular() * spellData.secondaryRadius;
                }

                endTick += extraEndTick;

                Spell newSpell = new Spell();

                newSpell.startTime = EvadeUtils.TickCount;
                newSpell.endTime = EvadeUtils.TickCount + endTick;
                newSpell.startPos = startPosition;
                newSpell.endPos = endPosition;
                newSpell.height = spellEndPos.Z + spellData.extraDrawHeight;
                newSpell.direction = direction;
                newSpell.heroID = hero.NetworkId;
                newSpell.info = spellData;
                newSpell.spellType = spellType;
                newSpell.radius = spellRadius > 0 ? spellRadius : newSpell.GetSpellRadius();

                if (obj != null)
                {
                    newSpell.spellObject = obj;
                    newSpell.projectileID = obj.NetworkId;
                }

                int spellID = CreateSpell(newSpell, processSpell);

                DelayAction.Add((int)(endTick + spellData.extraEndTime), () => DeleteSpell(spellID));
            }
        }
Exemple #22
0
        /// <summary>
        ///     Moves to the position.
        /// </summary>
        /// <param name="position">The position.</param>
        /// <param name="holdAreaRadius">The hold area radius.</param>
        /// <param name="overrideTimer">if set to <c>true</c> [override timer].</param>
        /// <param name="useFixedDistance">if set to <c>true</c> [use fixed distance].</param>
        /// <param name="randomizeMinDistance">if set to <c>true</c> [randomize minimum distance].</param>
        public static void MoveTo(Vector3 position,
            float holdAreaRadius = 0,
            bool overrideTimer = false,
            bool useFixedDistance = true,
            bool randomizeMinDistance = true)
        {
            if (BlockOrdersUntilTick - TickCount > 0)
            {
                return;
            }

            if (TickCount - LastMovementOrderTick < 0)
            {
                return;
            }

            if (!position.IsValid())
            {
                return;
            }

            var playerPosition = Player.ServerPosition;

            if (position.LSDistance(Player.Position) < Player.BoundingRadius + holdAreaRadius)
            {
                if (Player.Path.Length > 0)
                {
                    EloBuddy.Player.IssueOrder(GameObjectOrder.Stop, Player.Position);
                    LastMovementOrderTick = TickCount - 70;
                }
                return;
            }

            var point = position;

            if (position.Distance(Player.ServerPosition) < Player.BoundingRadius)
            {
                point = Player.ServerPosition.LSExtend(position, Player.BoundingRadius + random.Next(0, 51));
            }

            if (Player.LSDistance(point, true) < 150 * 150)
            {
                point = playerPosition.LSExtend(position, randomizeMinDistance ? (_random.NextFloat(0.6f, 1) + 0.2f) * _minDistance : _minDistance);
            }

            var maximumDistance = 1500;
            if (position.Distance(Player.ServerPosition) > maximumDistance)
            {
                position = Player.ServerPosition.LSExtend(
                    position,
                    maximumDistance + 25 - random.Next(0, 51));
            }

            if (Player.Distance(position) > 350f)
            {
                var rAngle = 2D * Math.PI * random.NextDouble();
                var radius = Player.BoundingRadius / 2f;
                var x = (float)(position.X + (radius * Math.Cos(rAngle)));
                var y = (float)(position.Y + (radius * Math.Sin(rAngle)));
                position = new Vector3(x, y, NavMesh.GetHeightForPosition(x, y));
            }

            var angle = 0f;
            var currentPath = MathUtils.GetWaypoints(Player);
            if (currentPath.Count > 1 && currentPath.PathLength() > 100)
            {
                var movePath = Player.GetPath(position);
                if (movePath.Length > 1)
                {
                    var v1 = currentPath[1] - currentPath[0];
                    var v2 = movePath[1] - movePath[0];
                    angle = v1.AngleBetween(v2.To2D());
                    var distance = movePath.Last().DistanceSquared(currentPath.Last());
                    if ((angle < 10 && distance < 500 * 500) || distance < 50 * 50)
                    {
                        return;
                    }
                }
            }

            if (TickCount - LastMovementOrderTick < 70 + Math.Min(60, Game.Ping) && angle < 60)
            {
                return;
            }

            if (angle >= 60 && TickCount - LastMovementOrderTick < 60)
            {
                return;
            }

            EloBuddy.Player.IssueOrder(GameObjectOrder.MoveTo, point);
            LastMovementOrderTick = TickCount;
            LastMoveCommandPosition = point;
            LastMoveCommandT = Utils.GameTimeTickCount;
        }