Esempio n. 1
0
        public static void useWSmart(Skillshot skillShot)
        {
            //try doge with E if cant windWall
            var delay = MenuManager.DogeMenu["smartWD"].Cast<Slider>().CurrentValue;
            if (skillShot.IsAboutToHit(delay, Variables._Player))
            {
                if (!Program.W.IsReady() || skillShot.SpellData.Type == SkillShotType.SkillshotRing)
                    return;

                var sd = SpellDatabase.GetByMissileName(skillShot.SpellData.MissileSpellName);
                if (sd == null)
                    return;

                //If enabled
                if (!Variables.EvadeSpellEnabled(sd.MenuItemName))
                    return;

                //if only dangerous
                if (MenuManager.DogeMenu["wwDanger"].Cast<CheckBox>().CurrentValue &&
                    !Variables.skillShotIsDangerous(sd.MenuItemName))
                    return;

                Variables._Player.Spellbook.CastSpell(SpellSlot.W, skillShot.Start.To3D(), skillShot.End.To3D());
            }
        }
Esempio n. 2
0
        public static void useEtoSafe(Skillshot skillShot)
        {
            if (!Program.E.IsReady())
                return;
            float closest = float.MaxValue;
            Obj_AI_Base closestTarg = null;
            float currentDashSpeed = 700 + Variables._Player.MoveSpeed;
            foreach (
                Obj_AI_Base enemy in
                    ObjectManager.Get<Obj_AI_Base>()
                        .Where(
                            ob =>
                                ob.NetworkId != skillShot.Unit.NetworkId && Variables.enemyIsJumpable(ob) &&
                                ob.Distance(Variables._Player) < Program.E.Range)
                        .OrderBy(ene => ene.Distance(Game.CursorPos, true)))
            {
                var pPos = Variables._Player.Position.To2D();
                Vector2 posAfterE = Variables.V2E(Variables._Player.Position, enemy.Position, 475);
                Vector2 dashDir = (posAfterE - Variables._Player.Position.To2D()).Normalized();

                if (isSafePoint(posAfterE).IsSafe && Variables.wontHitOnDash(skillShot, enemy, skillShot, dashDir)
                    /*&& skillShot.IsSafePath(new List<Vector2>() { posAfterE }, 0, (int)currentDashSpeed, 0).IsSafe*/)
                {
                    float curDist = Vector2.DistanceSquared(Game.CursorPos.To2D(), posAfterE);
                    if (curDist < closest)
                    {
                        closestTarg = enemy;
                        closest = curDist;
                    }
                }
            }
            if (closestTarg != null)
                useENormal(closestTarg);
        }
Esempio n. 3
0
        public static void EvadeSkillShot(Skillshot sShot)
        {
            var sd = SpellDatabase.GetByMissileName(sShot.SpellData.MissileSpellName);
            if (LxOrbwalker.CurrentMode == LxOrbwalker.Mode.Combo &&
                (MasterSharp.SkillShotMustBeEvaded(sd.MenuItemName) ||
                 MasterSharp.SkillShotMustBeEvadedW(sd.MenuItemName)))
            {
                var spellDamage = (float) sShot.Unit.GetSpellDamage(Player, sd.SpellName);
                var willKill = Player.Health <= spellDamage;
                if (Q.IsReady() && JumpEnesAround() != 0 && (MasterSharp.SkillShotMustBeEvaded(sd.MenuItemName)) ||
                    willKill)
                {
                    UseQonBest();
                }
                else if ((!Q.IsReady(150) || !MasterSharp.SkillShotMustBeEvaded(sd.MenuItemName)) && W.IsReady() &&
                         (MasterSharp.SkillShotMustBeEvadedW(sd.MenuItemName)))
                {
                    LxOrbwalker.CantMoveTill = Environment.TickCount + 500;
                    W.Cast();
                }
            }

            if (LxOrbwalker.CurrentMode != LxOrbwalker.Mode.None &&
                (MasterSharp.SkillShotMustBeEvadedAllways(sd.MenuItemName) ||
                 MasterSharp.SkillShotMustBeEvadedWAllways(sd.MenuItemName)))
            {
                var spellDamage = (float) sShot.Unit.GetSpellDamage(Player, sd.SpellName);
                var willKill = Player.Health <= spellDamage;
                if (Q.IsReady() && JumpEnesAround() != 0 &&
                    (MasterSharp.SkillShotMustBeEvadedAllways(sd.MenuItemName) || willKill))
                {
                    UseQonBest();
                }
                else if ((!Q.IsReady() || !MasterSharp.SkillShotMustBeEvadedAllways(sd.MenuItemName)) && W.IsReady() &&
                         (MasterSharp.SkillShotMustBeEvadedWAllways(sd.MenuItemName) || willKill))
                {
                    LxOrbwalker.CantMoveTill = Environment.TickCount + 500;
                    W.Cast();
                }
            }
        }
Esempio n. 4
0
 public static void DeleteMissile(Skillshot skillshot, MissileClient missile)
 {
     if (skillshot.SpellData.SpellName == "VelkozQ")
     {
         var spellData = SpellDatabase.GetByName("VelkozQSplit");
         var direction = skillshot.Direction.Perpendicular();
         if (Variables.EvadeDetectedSkillshots.Count(s => s.SpellData.SpellName == "VelkozQSplit") == 0)
         {
             for (var i = -1; i <= 1; i = i + 2)
             {
                 var skillshotToAdd = new Skillshot(
                     DetectionType.ProcessSpell, spellData, Environment.TickCount, missile.Position.To2D(),
                     missile.Position.To2D() + i * direction * spellData.Range, skillshot.Unit);
                 Variables.EvadeDetectedSkillshots.Add(skillshotToAdd);
             }
         }
     }
 }
Esempio n. 5
0
        public static void DetectSkillshot(Skillshot skillshot)
        {
            //Check if the skillshot is already added.
            var alreadyAdded = false;

            foreach (var item in Variables.EvadeDetectedSkillshots)
            {
                if (item.SpellData.SpellName == skillshot.SpellData.SpellName &&
                    (item.Unit.NetworkId == skillshot.Unit.NetworkId &&
                     (skillshot.Direction).AngleBetween(item.Direction) < 5 &&
                     (skillshot.Start.Distance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0)))
                {
                    alreadyAdded = true;
                }
            }

            //Check if the skillshot is from an ally.
            if (skillshot.Unit.Team == ObjectManager.Player.Team)
            {
                return;
            }

            //Check if the skillshot is too far away.
            if (skillshot.Start.Distance(ObjectManager.Player.ServerPosition.To2D()) >
                (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5)
            {
                return;
            }

            //Add the skillshot to the detected skillshot list.
            if (!alreadyAdded)
            {
                //Multiple skillshots like twisted fate Q.
                if (skillshot.DetectionType == DetectionType.ProcessSpell)
                {
                    if (skillshot.SpellData.MultipleNumber != -1)
                    {
                        var originalDirection = skillshot.Direction;

                        for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2;
                            i <= (skillshot.SpellData.MultipleNumber - 1) / 2;
                            i++)
                        {
                            var end = skillshot.Start +
                                      skillshot.SpellData.Range *
                                      originalDirection.Rotated(skillshot.SpellData.MultipleAngle * i);
                            var skillshotToAdd = new Skillshot(
                                skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end,
                                skillshot.Unit);

                            Variables.EvadeDetectedSkillshots.Add(skillshotToAdd);
                        }
                        return;
                    }

                    if (skillshot.SpellData.Centered)
                    {
                        var start = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range;
                        var end = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range;
                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                            skillshot.Unit);
                        Variables.EvadeDetectedSkillshots.Add(skillshotToAdd);
                        return;
                    }

                    if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5")
                    {
                        const int angle = 60;
                        const int fraction = -angle / 2;
                        var edge1 =
                            (skillshot.End - skillshot.Unit.ServerPosition.To2D()).Rotated(
                                fraction * (float)Math.PI / 180);
                        var edge2 = edge1.Rotated(angle * (float)Math.PI / 180);

                        foreach (var minion in ObjectManager.Get<Obj_AI_Minion>())
                        {
                            var v = minion.ServerPosition.To2D() - skillshot.Unit.ServerPosition.To2D();
                            if (minion.Name == "Seed" && edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0 &&
                                minion.Distance(skillshot.Unit) < 800 &&
                                (minion.Team != ObjectManager.Player.Team))
                            {
                                var start = minion.ServerPosition.To2D();
                                var end = skillshot.Unit.ServerPosition.To2D()
                                    .Extend(
                                        minion.ServerPosition.To2D(),
                                        skillshot.Unit.Distance(minion) > 200 ? 1300 : 1000);

                                var skillshotToAdd = new Skillshot(
                                    skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                                    skillshot.Unit);
                                Variables.EvadeDetectedSkillshots.Add(skillshotToAdd);
                            }
                        }
                        return;
                    }

                    if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid")
                    {
                        var start = skillshot.End - skillshot.Direction.Perpendicular() * 400;
                        var end = skillshot.End + skillshot.Direction.Perpendicular() * 400;
                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                            skillshot.Unit);
                        Variables.EvadeDetectedSkillshots.Add(skillshotToAdd);
                        return;
                    }

                    if (skillshot.SpellData.SpellName == "ZiggsQ")
                    {
                        var d1 = skillshot.Start.Distance(skillshot.End);
                        var d2 = d1 * 0.4f;
                        var d3 = d2 * 0.69f;


                        var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1");
                        var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2");

                        var bounce1Pos = skillshot.End + skillshot.Direction * d2;
                        var bounce2Pos = bounce1Pos + skillshot.Direction * d3;

                        bounce1SpellData.Delay =
                            (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500);
                        bounce2SpellData.Delay =
                            (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500);

                        var bounce1 = new Skillshot(
                            skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End, bounce1Pos,
                            skillshot.Unit);
                        var bounce2 = new Skillshot(
                            skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos,
                            skillshot.Unit);

                        Variables.EvadeDetectedSkillshots.Add(bounce1);
                        Variables.EvadeDetectedSkillshots.Add(bounce2);
                    }

                    if (skillshot.SpellData.SpellName == "ZiggsR")
                    {
                        skillshot.SpellData.Delay =
                            (int)(1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range);
                    }

                }

                if (skillshot.SpellData.SpellName == "OriannasQ")
                {
                    var endCSpellData = SpellDatabase.GetByName("OriannaQend");

                    var skillshotToAdd = new Skillshot(
                        skillshot.DetectionType, endCSpellData, skillshot.StartTick, skillshot.Start, skillshot.End,
                        skillshot.Unit);

                    Variables.EvadeDetectedSkillshots.Add(skillshotToAdd);
                }


                //Dont allow fow detection.
                if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket)
                {
                    return;
                }

                Variables.EvadeDetectedSkillshots.Add(skillshot);
            }
        }
Esempio n. 6
0
        public static Vector2 GetCollisionPoint(Skillshot skillshot)
        {
            var collisions = new List<DetectedCollision>();
            var from = skillshot.GetMissilePosition(0);
            skillshot.ForceDisabled = false;
            foreach (var cObject in skillshot.SpellData.CollisionObjects)
            {
                switch (cObject)
                {
                    case CollisionObjectTypes.Minion:

                        if (!Config.Menu.Item("MinionCollision").GetValue<bool>())
                        {
                            break;
                        }
                        foreach (var minion in
                            MinionManager.GetMinions(
                                from.To3D(), 1200, MinionTypes.All,
                                skillshot.Unit.Team == ObjectManager.Player.Team
                                    ? MinionTeam.NotAlly
                                    : MinionTeam.NotAllyForEnemy))
                        {
                            var pred = FastPrediction(
                                from, minion,
                                Math.Max(0, skillshot.SpellData.Delay - (Utils.TickCount - skillshot.StartTick)),
                                skillshot.SpellData.MissileSpeed);
                            var pos = pred.PredictedPos;
                            var w = skillshot.SpellData.RawRadius + (!pred.IsMoving ? (minion.BoundingRadius - 15) : 0) -
                                    pos.Distance(from, skillshot.End, true);
                            if (w > 0)
                            {
                                collisions.Add(
                                    new DetectedCollision
                                    {
                                        Position =
                                            pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint +
                                            skillshot.Direction * 30,
                                        Unit = minion,
                                        Type = CollisionObjectTypes.Minion,
                                        Distance = pos.Distance(from),
                                        Diff = w,
                                    });
                            }
                        }

                        break;

                    case CollisionObjectTypes.Champions:
                        if (!Config.Menu.Item("HeroCollision").GetValue<bool>())
                        {
                            break;
                        }
                        foreach (var hero in
                            ObjectManager.Get<Obj_AI_Hero>()
                                .Where(
                                    h =>
                                        (h.IsValidTarget(1200, false) && h.Team == ObjectManager.Player.Team && !h.IsMe)))
                        {
                            var pred = FastPrediction(
                                from, hero,
                                Math.Max(0, skillshot.SpellData.Delay - (Utils.TickCount - skillshot.StartTick)),
                                skillshot.SpellData.MissileSpeed);
                            var pos = pred.PredictedPos;

                            var w = skillshot.SpellData.RawRadius + 30 - pos.Distance(from, skillshot.End, true);
                            if (w > 0)
                            {
                                collisions.Add(
                                    new DetectedCollision
                                    {
                                        Position =
                                            pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint +
                                            skillshot.Direction * 30,
                                        Unit = hero,
                                        Type = CollisionObjectTypes.Minion,
                                        Distance = pos.Distance(from),
                                        Diff = w,
                                    });
                            }
                        }
                        break;

                    case CollisionObjectTypes.YasuoWall:
                        if (!Config.Menu.Item("YasuoCollision").GetValue<bool>())
                        {
                            break;
                        }
                        if (
                            !ObjectManager.Get<Obj_AI_Hero>()
                                .Any(
                                    hero =>
                                        hero.IsValidTarget(float.MaxValue, false) &&
                                        hero.Team == ObjectManager.Player.Team && hero.ChampionName == "Yasuo"))
                        {
                            break;
                        }
                        GameObject wall = null;
                        foreach (var gameObject in ObjectManager.Get<GameObject>())
                        {
                            if (gameObject.IsValid &&
                                System.Text.RegularExpressions.Regex.IsMatch(
                                    gameObject.Name, "_w_windwall.\\.troy",
                                    System.Text.RegularExpressions.RegexOptions.IgnoreCase))
                            {
                                wall = gameObject;
                            }
                        }
                        if (wall == null)
                        {
                            break;
                        }
                        var level = wall.Name.Substring(wall.Name.Length - 6, 1);
                        var wallWidth = (300 + 50 * Convert.ToInt32(level));

                        var wallDirection = (wall.Position.To2D() - YasuoWallCastedPos).Normalized().Perpendicular();
                        var wallStart = wall.Position.To2D() + wallWidth / 2 * wallDirection;
                        var wallEnd = wallStart - wallWidth * wallDirection;
                        var wallPolygon = new Geometry.Rectangle(wallStart, wallEnd, 75).ToPolygon();
                        var intersection = new Vector2();
                        var intersections = new List<Vector2>();

                        for (var i = 0; i < wallPolygon.Points.Count; i++)
                        {
                            var inter =
                                wallPolygon.Points[i].Intersection(
                                    wallPolygon.Points[i != wallPolygon.Points.Count - 1 ? i + 1 : 0], from,
                                    skillshot.End);
                            if (inter.Intersects)
                            {
                                intersections.Add(inter.Point);
                            }
                        }

                        if (intersections.Count > 0)
                        {
                            intersection = intersections.OrderBy(item => item.Distance(from)).ToList()[0];
                            var collisionT = Utils.TickCount +
                                             Math.Max(
                                                 0,
                                                 skillshot.SpellData.Delay -
                                                 (Utils.TickCount - skillshot.StartTick)) + 100 +
                                             (1000 * intersection.Distance(from)) / skillshot.SpellData.MissileSpeed;
                            if (collisionT - WallCastT < 4000)
                            {
                                if (skillshot.SpellData.Type != SkillShotType.SkillshotMissileLine)
                                {
                                    skillshot.ForceDisabled = true;
                                }
                                return intersection;
                            }
                        }

                        break;
                }
            }

            Vector2 result;
            if (collisions.Count > 0)
            {
                result = collisions.OrderBy(c => c.Distance).ToList()[0].Position;
            }
            else
            {
                result = new Vector2();
            }

            return result;
        }
Esempio n. 7
0
 private static void OnDetectSkillshot(Skillshot skillshot)
 {
     if (skillshot.Unit.Team == Program.Player.Team)
     {
         return;
     }
     var alreadyAdded =
         DetectedSkillshots.Where(
             i => i.SpellData.SpellName == skillshot.SpellData.SpellName && i.Unit.Compare(skillshot.Unit))
             .Any(
                 i =>
                 i.Direction.AngleBetween(skillshot.Direction) < 5
                 && (i.Start.Distance(skillshot.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0));
     if (skillshot.Start.Distance(PlayerPosition)
         > (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5)
     {
         return;
     }
     if (alreadyAdded && !skillshot.SpellData.DontCheckForDuplicates)
     {
         return;
     }
     if (skillshot.DetectionType == DetectionType.ProcessSpell)
     {
         if (skillshot.SpellData.MultipleNumber != -1)
         {
             var originalDirection = skillshot.Direction;
             for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2;
                  i <= (skillshot.SpellData.MultipleNumber - 1) / 2;
                  i++)
             {
                 var end = skillshot.Start
                           + skillshot.SpellData.Range
                           * originalDirection.LSRotated(skillshot.SpellData.MultipleAngle * i);
                 DetectedSkillshots.Add(
                     new Skillshot(
                         skillshot.DetectionType,
                         skillshot.SpellData,
                         skillshot.StartTick,
                         skillshot.Start,
                         end,
                         skillshot.Unit));
             }
             return;
         }
         if (skillshot.SpellData.SpellName == "UFSlash")
         {
             skillshot.SpellData.MissileSpeed = 1600 + (int)skillshot.Unit.MoveSpeed;
         }
         if (skillshot.SpellData.SpellName == "SionR")
         {
             skillshot.SpellData.MissileSpeed = (int)skillshot.Unit.MoveSpeed;
         }
         if (skillshot.SpellData.Invert)
         {
             var newDirection = -(skillshot.End - skillshot.Start).LSNormalized();
             var end = skillshot.Start + newDirection * skillshot.Start.Distance(skillshot.End);
             DetectedSkillshots.Add(
                 new Skillshot(
                     skillshot.DetectionType,
                     skillshot.SpellData,
                     skillshot.StartTick,
                     skillshot.Start,
                     end,
                     skillshot.Unit));
             return;
         }
         if (skillshot.SpellData.Centered)
         {
             var start = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range;
             var end = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range;
             DetectedSkillshots.Add(
                 new Skillshot(
                     skillshot.DetectionType,
                     skillshot.SpellData,
                     skillshot.StartTick,
                     start,
                     end,
                     skillshot.Unit));
             return;
         }
         if (skillshot.SpellData.SpellName == "TaricE")
         {
             var source = skillshot.Unit as AIHeroClient;
             if (source != null && source.ChampionName == "Taric")
             {
                 var target =
                     GameObjects.Heroes.FirstOrDefault(
                         h => h.Team == source.Team && h.HasBuff("taricwleashactive"));
                 if (target != null)
                 {
                     var start = target.ServerPosition.ToVector2();
                     var direction = (skillshot.OriginalEnd - start).LSNormalized();
                     var end = start + direction * skillshot.SpellData.Range;
                     DetectedSkillshots.Add(
                         new Skillshot(
                             skillshot.DetectionType,
                             skillshot.SpellData,
                             skillshot.StartTick,
                             start,
                             end,
                             target)
                         { OriginalEnd = skillshot.OriginalEnd });
                 }
             }
         }
         if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5")
         {
             const int Angle = 60;
             var edge1 =
                 (skillshot.End - skillshot.Unit.ServerPosition.ToVector2()).LSRotated(
                     -Angle / 2f * (float)Math.PI / 180);
             var edge2 = edge1.LSRotated(Angle * (float)Math.PI / 180);
             var positions = new List<Vector2>();
             var explodingQ = DetectedSkillshots.FirstOrDefault(s => s.SpellData.SpellName == "SyndraQ");
             if (explodingQ != null)
             {
                 positions.Add(explodingQ.End);
             }
             positions.AddRange(
                 GameObjects.EnemyMinions.Where(i => !i.IsDead && i.Name == "Seed")
                     .Select(minion => minion.ServerPosition.ToVector2()));
             foreach (var pos in positions.Where(i => skillshot.Unit.Distance(i) < 800))
             {
                 var v = pos - skillshot.Unit.ServerPosition.ToVector2();
                 if (edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0)
                 {
                     var start = pos;
                     var end = skillshot.Unit.ServerPosition.ToVector2()
                         .Extend(pos, skillshot.Unit.Distance(pos) > 200 ? 1300 : 1000);
                     DetectedSkillshots.Add(
                         new Skillshot(
                             skillshot.DetectionType,
                             skillshot.SpellData,
                             skillshot.StartTick + (int)(150 + skillshot.Unit.Distance(pos) / 2.5),
                             start,
                             end,
                             skillshot.Unit));
                 }
             }
             return;
         }
         if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid")
         {
             var start = skillshot.End - skillshot.Direction.Perpendicular() * 400;
             var end = skillshot.End + skillshot.Direction.Perpendicular() * 400;
             DetectedSkillshots.Add(
                 new Skillshot(
                     skillshot.DetectionType,
                     skillshot.SpellData,
                     skillshot.StartTick,
                     start,
                     end,
                     skillshot.Unit));
             return;
         }
         if (skillshot.SpellData.SpellName == "DianaArc")
         {
             DetectedSkillshots.Add(
                 new Skillshot(
                     skillshot.DetectionType,
                     SpellDatabase.GetByName("DianaArcArc"),
                     skillshot.StartTick,
                     skillshot.Start,
                     skillshot.End,
                     skillshot.Unit));
         }
         if (skillshot.SpellData.SpellName == "ZiggsQ")
         {
             var d1 = skillshot.Start.Distance(skillshot.End);
             var d2 = d1 * 0.4f;
             var d3 = d2 * 0.69f;
             var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1");
             var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2");
             var bounce1Pos = skillshot.End + skillshot.Direction * d2;
             var bounce2Pos = bounce1Pos + skillshot.Direction * d3;
             bounce1SpellData.Delay =
                 (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500);
             bounce2SpellData.Delay =
                 (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500);
             DetectedSkillshots.Add(
                 new Skillshot(
                     skillshot.DetectionType,
                     bounce1SpellData,
                     skillshot.StartTick,
                     skillshot.End,
                     bounce1Pos,
                     skillshot.Unit));
             DetectedSkillshots.Add(
                 new Skillshot(
                     skillshot.DetectionType,
                     bounce2SpellData,
                     skillshot.StartTick,
                     bounce1Pos,
                     bounce2Pos,
                     skillshot.Unit));
         }
         if (skillshot.SpellData.SpellName == "ZiggsR")
         {
             skillshot.SpellData.Delay =
                 (int)(1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range);
         }
         if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike")
         {
             var endPos = new Vector2();
             foreach (var s in
                 DetectedSkillshots.Where(i => i.SpellData.Slot == SpellSlot.E))
             {
                 if (!s.Unit.Compare(skillshot.Unit))
                 {
                     continue;
                 }
                 var extendedE = new Skillshot(
                     skillshot.DetectionType,
                     skillshot.SpellData,
                     skillshot.StartTick,
                     skillshot.Start,
                     skillshot.End + skillshot.Direction * 100,
                     skillshot.Unit);
                 if (!extendedE.IsSafe(s.End))
                 {
                     endPos = s.End;
                 }
                 break;
             }
             foreach (var m in
                 ObjectManager.Get<Obj_AI_Minion>().Where(i => i.CharData.BaseSkinName == "jarvanivstandard"))
             {
                 if (m.Team != skillshot.Unit.Team)
                 {
                     continue;
                 }
                 var extendedE = new Skillshot(
                     skillshot.DetectionType,
                     skillshot.SpellData,
                     skillshot.StartTick,
                     skillshot.Start,
                     skillshot.End + skillshot.Direction * 100,
                     skillshot.Unit);
                 if (!extendedE.IsSafe(m.Position.ToVector2()))
                 {
                     endPos = m.Position.ToVector2();
                 }
                 break;
             }
             if (endPos.IsValid())
             {
                 skillshot = new Skillshot(
                     DetectionType.ProcessSpell,
                     SpellDatabase.GetByName("JarvanIVEQ"),
                     Variables.TickCount,
                     skillshot.Start,
                     endPos,
                     skillshot.Unit);
                 skillshot.End = endPos + 200 * (endPos - skillshot.Start).LSNormalized();
                 skillshot.Direction = (skillshot.End - skillshot.Start).LSNormalized();
             }
         }
     }
     if (skillshot.SpellData.SpellName == "OriannasQ")
     {
         DetectedSkillshots.Add(
             new Skillshot(
                 skillshot.DetectionType,
                 SpellDatabase.GetByName("OriannaQend"),
                 skillshot.StartTick,
                 skillshot.Start,
                 skillshot.End,
                 skillshot.Unit,
                 skillshot.DetectionType == DetectionType.RecvPacket && skillshot.Missile != null
                     ? skillshot.Missile
                     : null));
     }
     if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket)
     {
         return;
     }
     DetectedSkillshots.Add(skillshot);
 }
Esempio n. 8
0
        private static void OnDetectSkillshot(Skillshot skillshot)
        {
            //Check if the skillshot is already added.
            var alreadyAdded = false;

            if (Config.Menu.Item("DisableFow").GetValue<bool>() && !skillshot.Unit.IsVisible)
            {
                return;
            }
                
            foreach (var item in DetectedSkillshots)
            {
                if (item.SpellData.SpellName == skillshot.SpellData.SpellName &&
                    (item.Unit.NetworkId == skillshot.Unit.NetworkId &&
                     (skillshot.Direction).AngleBetween(item.Direction) < 5 &&
                     (skillshot.Start.Distance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0)))
                {
                    alreadyAdded = true;
                }
            }

            //Check if the skillshot is from an ally.
            if (skillshot.Unit.Team == ObjectManager.Player.Team && !Config.TestOnAllies)
            {
                return;
            }

            //Check if the skillshot is too far away.
            if (skillshot.Start.Distance(ObjectManager.Player.ServerPosition.To2D()) >
                (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5)
            {
                return;
            }

            //Add the skillshot to the detected skillshot list.
            if (!alreadyAdded || skillshot.SpellData.DontCheckForDuplicates)
            {
                //Multiple skillshots like twisted fate Q.
                if (skillshot.DetectionType == DetectionType.ProcessSpell)
                {
                    if (skillshot.SpellData.MultipleNumber != -1)
                    {
                        var originalDirection = skillshot.Direction;

                        for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2;
                            i <= (skillshot.SpellData.MultipleNumber - 1) / 2;
                            i++)
                        {
                            var end = skillshot.Start +
                                      skillshot.SpellData.Range *
                                      originalDirection.Rotated(skillshot.SpellData.MultipleAngle * i);
                            var skillshotToAdd = new Skillshot(
                                skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end,
                                skillshot.Unit);

                            DetectedSkillshots.Add(skillshotToAdd);
                        }
                        return;
                    }

                    if (skillshot.SpellData.SpellName == "UFSlash")
                    {
                        skillshot.SpellData.MissileSpeed = 1600 + (int) skillshot.Unit.MoveSpeed;
                    }

                    if (skillshot.SpellData.SpellName == "SionR")
                    {
                        skillshot.SpellData.MissileSpeed = (int)skillshot.Unit.MoveSpeed;
                    }

                    if (skillshot.SpellData.Invert)
                    {
                        var newDirection = -(skillshot.End - skillshot.Start).Normalized();
                        var end = skillshot.Start + newDirection * skillshot.Start.Distance(skillshot.End);
                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end,
                            skillshot.Unit);
                        DetectedSkillshots.Add(skillshotToAdd);
                        return;
                    }

                    if (skillshot.SpellData.Centered)
                    {
                        var start = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range;
                        var end = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range;
                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                            skillshot.Unit);
                        DetectedSkillshots.Add(skillshotToAdd);
                        return;
                    }

                    if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5")
                    {
                        var angle = 60;
                        var edge1 =
                            (skillshot.End - skillshot.Unit.ServerPosition.To2D()).Rotated(
                                -angle / 2 * (float) Math.PI / 180);
                        var edge2 = edge1.Rotated(angle * (float) Math.PI / 180);

                        foreach (var skillshotToAdd in from minion in ObjectManager.Get<Obj_AI_Minion>()
                            let v =
                                minion.ServerPosition.To2D() -
                                skillshot.Unit.ServerPosition.To2D()
                            where minion.Name == "Seed" && edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0 &&
                                  minion.Distance(skillshot.Unit) < 800 &&
                                  (minion.Team != ObjectManager.Player.Team || Config.TestOnAllies)
                            let start = LeagueSharp.Common.Geometry.To2D((Vector3) minion.ServerPosition)
                            let end = skillshot.Unit.ServerPosition.To2D()
                                .Extend(
                                    LeagueSharp.Common.Geometry.To2D((Vector3) minion.ServerPosition),
                                    skillshot.Unit.Distance(minion) > 200 ? 1300 : 1000)
                            select new Skillshot(
                                skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                                skillshot.Unit))
                        {
                            DetectedSkillshots.Add(skillshotToAdd);
                        }
                        return;
                    }

                    if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid")
                    {
                        var start = skillshot.End - skillshot.Direction.Perpendicular() * 400;
                        var end = skillshot.End + skillshot.Direction.Perpendicular() * 400;
                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                            skillshot.Unit);
                        DetectedSkillshots.Add(skillshotToAdd);
                        return;
                    }

                    if (skillshot.SpellData.SpellName == "ZiggsQ")
                    {
                        var d1 = skillshot.Start.Distance(skillshot.End);
                        var d2 = d1 * 0.4f;
                        var d3 = d2 * 0.69f;


                        var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1");
                        var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2");

                        var bounce1Pos = skillshot.End + skillshot.Direction * d2;
                        var bounce2Pos = bounce1Pos + skillshot.Direction * d3;

                        bounce1SpellData.Delay =
                            (int) (skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500);
                        bounce2SpellData.Delay =
                            (int) (bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500);

                        var bounce1 = new Skillshot(
                            skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End, bounce1Pos,
                            skillshot.Unit);
                        var bounce2 = new Skillshot(
                            skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos,
                            skillshot.Unit);

                        DetectedSkillshots.Add(bounce1);
                        DetectedSkillshots.Add(bounce2);
                    }

                    if (skillshot.SpellData.SpellName == "ZiggsR")
                    {
                        skillshot.SpellData.Delay =
                            (int) (1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range);
                    }

                    if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike")
                    {
                        var endPos = new Vector2();

                        foreach (var s in DetectedSkillshots)
                        {
                            if (s.Unit.NetworkId == skillshot.Unit.NetworkId && s.SpellData.Slot == SpellSlot.E)
                            {
                                var extendedE = new Skillshot(
                                    skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start,
                                    skillshot.End + skillshot.Direction * 100, skillshot.Unit);
                                if (!extendedE.IsSafe(s.End))
                                {
                                    endPos = s.End;
                                }
                                break;
                            }
                        }

                        foreach (var m in ObjectManager.Get<Obj_AI_Minion>())
                        {
                            if (m.CharData.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Unit.Team)
                            {
                                
                                var extendedE = new Skillshot(
                                    skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start,
                                    skillshot.End + skillshot.Direction * 100, skillshot.Unit);
                                if (!extendedE.IsSafe(m.Position.To2D()))
                                {
                                    endPos = m.Position.To2D();
                                }
                                break;
                            }
                        }

                        if (endPos.IsValid())
                        {
                            skillshot = new Skillshot(DetectionType.ProcessSpell, SpellDatabase.GetByName("JarvanIVEQ"), Utils.TickCount, skillshot.Start, endPos, skillshot.Unit);
                            skillshot.End = endPos + 200 * (endPos - skillshot.Start).Normalized();
                            skillshot.Direction = (skillshot.End - skillshot.Start).Normalized();
                        }
                    }
                }

                if (skillshot.SpellData.SpellName == "OriannasQ")
                {
                    var skillshotToAdd = new Skillshot(
                        skillshot.DetectionType, SpellDatabase.GetByName("OriannaQend"), skillshot.StartTick, skillshot.Start, skillshot.End,
                        skillshot.Unit);

                    DetectedSkillshots.Add(skillshotToAdd);
                }


                //Dont allow fow detection.
                if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket)
                {
                    return;
                }
#if DEBUG
                Console.WriteLine(Utils.TickCount + "Adding new skillshot: " + skillshot.SpellData.SpellName);
#endif

                DetectedSkillshots.Add(skillshot);
            }
        }
        private static void Evade_OnDetectSkillshot(Skillshot skillshot)
        {
            //Check if the skillshot is already added.
            var alreadyAdded = false;

            foreach (var item in Yasuo.EvadeDetectedSkillshots)
            {
                if (item.SpellData.SpellName == skillshot.SpellData.SpellName &&
                    (item.Unit.NetworkId == skillshot.Unit.NetworkId &&
                     (skillshot.Direction).AngleBetween(item.Direction) < 5 &&
                     (skillshot.Start.Distance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0)))
                {
                    alreadyAdded = true;
                }
            }

            //Check if the skillshot is from an ally.
            if (skillshot.Unit.Team == ObjectManager.Player.Team)
            {
                return;
            }

            //Check if the skillshot is too far away.
            if (skillshot.Start.Distance(ObjectManager.Player.ServerPosition.To2D()) >
                (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5)
            {
                return;
            }

            //Add the skillshot to the detected skillshot list.
            if (!alreadyAdded)
            {
                //Multiple skillshots like twisted fate Q.
                if (skillshot.DetectionType == DetectionType.ProcessSpell)
                {
                    if (skillshot.SpellData.MultipleNumber != -1)
                    {
                        var originalDirection = skillshot.Direction;

                        for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2;
                             i <= (skillshot.SpellData.MultipleNumber - 1) / 2;
                             i++)
                        {
                            var end = skillshot.Start +
                                      skillshot.SpellData.Range *
                                      originalDirection.Rotated(skillshot.SpellData.MultipleAngle * i);
                            var skillshotToAdd = new Skillshot(
                                skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end,
                                skillshot.Unit);

                            Yasuo.EvadeDetectedSkillshots.Add(skillshotToAdd);
                        }
                        return;
                    }

                    if (skillshot.SpellData.Centered)
                    {
                        var start          = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range;
                        var end            = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range;
                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                            skillshot.Unit);
                        Yasuo.EvadeDetectedSkillshots.Add(skillshotToAdd);
                        return;
                    }

                    if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5")
                    {
                        const int angle    = 60;
                        const int fraction = -angle / 2;
                        var       edge1    =
                            (skillshot.End - skillshot.Unit.ServerPosition.To2D()).Rotated(
                                fraction * (float)Math.PI / 180);
                        var edge2 = edge1.Rotated(angle * (float)Math.PI / 180);

                        foreach (var minion in ObjectManager.Get <Obj_AI_Minion>())
                        {
                            var v = minion.ServerPosition.To2D() - skillshot.Unit.ServerPosition.To2D();
                            if (minion.Name == "Seed" && edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0 &&
                                minion.Distance3D(skillshot.Unit) < 800 &&
                                (minion.Team != ObjectManager.Player.Team))
                            {
                                var start = minion.ServerPosition.To2D();
                                var end   = skillshot.Unit.ServerPosition.To2D()
                                            .Extend(
                                    minion.ServerPosition.To2D(),
                                    skillshot.Unit.Distance3D(minion) > 200 ? 1300 : 1000);

                                var skillshotToAdd = new Skillshot(
                                    skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                                    skillshot.Unit);
                                Yasuo.EvadeDetectedSkillshots.Add(skillshotToAdd);
                            }
                        }
                        return;
                    }

                    if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid")
                    {
                        var start          = skillshot.End - skillshot.Direction.Perpendicular() * 400;
                        var end            = skillshot.End + skillshot.Direction.Perpendicular() * 400;
                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                            skillshot.Unit);
                        Yasuo.EvadeDetectedSkillshots.Add(skillshotToAdd);
                        return;
                    }

                    if (skillshot.SpellData.SpellName == "ZiggsQ")
                    {
                        var d1 = skillshot.Start.Distance(skillshot.End);
                        var d2 = d1 * 0.4f;
                        var d3 = d2 * 0.69f;


                        var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1");
                        var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2");

                        var bounce1Pos = skillshot.End + skillshot.Direction * d2;
                        var bounce2Pos = bounce1Pos + skillshot.Direction * d3;

                        bounce1SpellData.Delay =
                            (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500);
                        bounce2SpellData.Delay =
                            (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500);

                        var bounce1 = new Skillshot(
                            skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End, bounce1Pos,
                            skillshot.Unit);
                        var bounce2 = new Skillshot(
                            skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos,
                            skillshot.Unit);

                        Yasuo.EvadeDetectedSkillshots.Add(bounce1);
                        Yasuo.EvadeDetectedSkillshots.Add(bounce2);
                    }

                    if (skillshot.SpellData.SpellName == "ZiggsR")
                    {
                        skillshot.SpellData.Delay =
                            (int)(1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range);
                    }
                }

                if (skillshot.SpellData.SpellName == "OriannasQ")
                {
                    var endCSpellData = SpellDatabase.GetByName("OriannaQend");

                    var skillshotToAdd = new Skillshot(
                        skillshot.DetectionType, endCSpellData, skillshot.StartTick, skillshot.Start, skillshot.End,
                        skillshot.Unit);

                    Yasuo.EvadeDetectedSkillshots.Add(skillshotToAdd);
                }


                //Dont allow fow detection.
                if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket)
                {
                    return;
                }

                Yasuo.EvadeDetectedSkillshots.Add(skillshot);
            }
        }
Esempio n. 10
0
 public static void Init()
 {
     Config.CreateMenu(Program.MainMenu);
     Collision.Init();
     Game.OnUpdate += args =>
         {
             DetectedSkillshots.RemoveAll(i => !i.IsActive);
             DetectedSkillshots.ForEach(i => i.OnUpdate());
             if (!Program.MainMenu["Evade"]["Enabled"].GetValue<MenuKeyBind>().Active)
             {
                 return;
             }
             if (ObjectManager.Player.IsDead)
             {
                 return;
             }
             if (ObjectManager.Player.IsCastingInterruptableSpell(true))
             {
                 return;
             }
             if (ObjectManager.Player.HasBuffOfType(BuffType.SpellShield)
                 || ObjectManager.Player.HasBuffOfType(BuffType.SpellImmunity))
             {
                 return;
             }
             Evading?.Invoke(ObjectManager.Player);
             var currentPath = ObjectManager.Player.GetWaypoints();
             var safePoint = IsSafePoint(PlayerPosition);
             var safePath = IsSafePath(currentPath, 100);
             if (!safePath.IsSafe && !safePoint.IsSafe)
             {
                 TryEvading?.Invoke(safePoint.SkillshotList, Game.CursorPos.ToVector2());
             }
         };
     SkillshotDetector.OnDetectSkillshot += OnDetectSkillshot;
     SkillshotDetector.OnDeleteSkillshot += (skillshot, missile) =>
         {
             if (skillshot.SpellData.SpellName == "VelkozQ")
             {
                 var spellData = SpellDatabase.GetByName("VelkozQSplit");
                 var direction = skillshot.Direction.Perpendicular();
                 if (DetectedSkillshots.Count(i => i.SpellData.SpellName == "VelkozQSplit") == 0)
                 {
                     for (var i = -1; i <= 1; i = i + 2)
                     {
                         var skillshotToAdd = new Skillshot(
                             DetectionType.ProcessSpell,
                             spellData,
                             Variables.TickCount,
                             missile.Position.ToVector2(),
                             missile.Position.ToVector2() + i * direction * spellData.Range,
                             skillshot.Unit);
                         DetectedSkillshots.Add(skillshotToAdd);
                     }
                 }
             }
         };
     Drawing.OnDraw += args =>
         {
             if (Program.MainMenu["Evade"]["Draw"]["Status"])
             {
                 var active = Program.MainMenu["Evade"]["Enabled"].GetValue<MenuKeyBind>().Active;
                 var text =
                     $"Evade Skillshot: {(active ? (Program.MainMenu["Evade"]["OnlyDangerous"].GetValue<MenuKeyBind>().Active ? "Dangerous" : "On") : "Off")}";
                 var pos = Drawing.WorldToScreen(ObjectManager.Player.Position);
                 Drawing.DrawText(
                     pos.X - (float)Drawing.GetTextExtent(text).Width / 2,
                     pos.Y + 40,
                     active
                         ? (Program.MainMenu["Evade"]["OnlyDangerous"].GetValue<MenuKeyBind>().Active
                                ? Color.Yellow
                                : Color.White)
                         : Color.Gray,
                     text);
             }
             if (Program.MainMenu["Evade"]["Draw"]["Skillshot"])
             {
                 DetectedSkillshots.ForEach(
                     i =>
                     i.Draw(
                         i.Enable && Program.MainMenu["Evade"]["Enabled"].GetValue<MenuKeyBind>().Active
                             ? Color.White
                             : Color.Red,
                         Color.LimeGreen));
             }
         };
 }
Esempio n. 11
0
 public static Vector2 GetCollisionPoint(Skillshot skillshot)
 {
     var collisions = new List<DetectedCollision>();
     var from = skillshot.GetMissilePosition(0);
     skillshot.ForceDisabled = false;
     if (skillshot.SpellData.CollisionObjects.HasFlag(CollisionableObjects.Minions))
     {
         var minions = new List<Obj_AI_Minion>();
         minions.AddRange(GameObjects.Jungle.Where(i => i.IsValidTarget(1200, true, from.ToVector3())));
         minions.AddRange(
             GameObjects.Minions.Where(
                 i =>
                 i.IsValidTarget(1200, false, @from.ToVector3())
                 && (skillshot.Unit.Team == ObjectManager.Player.Team
                         ? i.Team != ObjectManager.Player.Team
                         : i.Team == ObjectManager.Player.Team) && (i.IsMinion() || i.IsPet())));
         collisions.AddRange(
             from minion in minions
             let pred =
                 FastPrediction(
                     @from,
                     minion,
                     Math.Max(0, skillshot.SpellData.Delay - (Variables.TickCount - skillshot.StartTick)),
                     skillshot.SpellData.MissileSpeed)
             let pos = pred.PredictedPos
             let w =
                 skillshot.SpellData.RawRadius + (!pred.IsMoving ? minion.BoundingRadius - 15 : 0)
                 - pos.Distance(@from, skillshot.End, true)
             where w > 0
             select
                 new DetectedCollision
                     {
                         Position =
                             pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint + skillshot.Direction * 30,
                         Unit = minion, Type = CollisionableObjects.Minions, Distance = pos.Distance(@from),
                         Diff = w
                     });
     }
     if (skillshot.SpellData.CollisionObjects.HasFlag(CollisionableObjects.Heroes))
     {
         collisions.AddRange(
             from hero in GameObjects.AllyHeroes.Where(i => i.IsValidTarget(1200, false) && !i.IsMe)
             let pred =
                 FastPrediction(
                     @from,
                     hero,
                     Math.Max(0, skillshot.SpellData.Delay - (Variables.TickCount - skillshot.StartTick)),
                     skillshot.SpellData.MissileSpeed)
             let pos = pred.PredictedPos
             let w = skillshot.SpellData.RawRadius + 30 - pos.Distance(@from, skillshot.End, true)
             where w > 0
             select
                 new DetectedCollision
                     {
                         Position =
                             pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint + skillshot.Direction * 30,
                         Unit = hero, Type = CollisionableObjects.Heroes, Distance = pos.Distance(@from),
                         Diff = w
                     });
     }
     if (skillshot.SpellData.CollisionObjects.HasFlag(CollisionableObjects.YasuoWall)
         && GameObjects.AllyHeroes.Any(i => i.ChampionName == "Yasuo"))
     {
         var wall =
             GameObjects.AllGameObjects.FirstOrDefault(
                 i => i.IsValid && Regex.IsMatch(i.Name, "_w_windwall.\\.troy", RegexOptions.IgnoreCase));
         if (wall != null)
         {
             var level = wall.Name.Substring(wall.Name.Length - 6, 1);
             var wallWidth = 300 + 50 * Convert.ToInt32(level);
             var wallDirection = (wall.Position.ToVector2() - wallCastedPos).Normalized().Perpendicular();
             var wallStart = wall.Position.ToVector2() + wallWidth / 2f * wallDirection;
             var wallEnd = wallStart - wallWidth * wallDirection;
             var wallPolygon = new Geometry.Rectangle(wallStart, wallEnd, 75).ToPolygon();
             var intersections = new List<Vector2>();
             for (var i = 0; i < wallPolygon.Points.Count; i++)
             {
                 var inter =
                     wallPolygon.Points[i].Intersection(
                         wallPolygon.Points[i != wallPolygon.Points.Count - 1 ? i + 1 : 0],
                         @from,
                         skillshot.End);
                 if (inter.Intersects)
                 {
                     intersections.Add(inter.Point);
                 }
             }
             if (intersections.Count > 0)
             {
                 var intersection = intersections.OrderBy(item => item.Distance(@from)).ToList()[0];
                 var collisionT = Variables.TickCount
                                  + Math.Max(
                                      0,
                                      skillshot.SpellData.Delay - (Variables.TickCount - skillshot.StartTick))
                                  + 100 + 1000 * intersection.Distance(@from) / skillshot.SpellData.MissileSpeed;
                 if (collisionT - wallCastT < 4000)
                 {
                     if (skillshot.SpellData.Type != SkillShotType.SkillshotMissileLine)
                     {
                         skillshot.ForceDisabled = true;
                     }
                     return intersection;
                 }
             }
         }
     }
     return collisions.Count > 0 ? collisions.OrderBy(i => i.Distance).First().Position : new Vector2();
 }
Esempio n. 12
0
        public static Vector2 GetCollisionPoint(Skillshot skillshot)
        {
            var collisions = new List <DetectedCollision>();
            var from       = skillshot.GetMissilePosition(0);

            skillshot.ForceDisabled = false;
            foreach (var cObject in skillshot.SkillshotData.CollisionObjects)
            {
                switch (cObject)
                {
                case CollisionObjectTypes.Minion:

                    foreach (var minion in
                             MinionManager.GetMinions(
                                 from.To3D(), 1200, MinionTypes.All,
                                 skillshot.Caster.Team == ObjectManager.Player.Team
                                    ? MinionTeam.NotAlly
                                    : MinionTeam.NotAllyForEnemy))
                    {
                        var pred = FastPrediction(
                            from, minion,
                            Math.Max(0,
                                     skillshot.SkillshotData.Delay - (Environment.TickCount - skillshot.StartTick)),
                            skillshot.SkillshotData.MissileSpeed);
                        var pos = pred.PredictedPos;
                        var w   = skillshot.SkillshotData.RawRadius +
                                  (!pred.IsMoving ? (minion.BoundingRadius - 15) : 0) -
                                  pos.Distance(from, skillshot.EndPosition, true);
                        if (w > 0)
                        {
                            collisions.Add(
                                new DetectedCollision
                            {
                                Position =
                                    pos.ProjectOn(skillshot.EndPosition, skillshot.StartPosition).LinePoint +
                                    skillshot.Direction * 30,
                                Unit     = minion,
                                Type     = CollisionObjectTypes.Minion,
                                Distance = pos.Distance(from),
                                Diff     = w,
                            });
                        }
                    }

                    break;

                case CollisionObjectTypes.Champions:
                    foreach (var hero in
                             ObjectManager.Get <Obj_AI_Hero>()
                             .Where(
                                 h =>
                                 (h.IsValidTarget(1200, false) && h.Team == ObjectManager.Player.Team && !h.IsMe ||
                                  h.Team != ObjectManager.Player.Team)))
                    {
                        var pred = FastPrediction(
                            from, hero,
                            Math.Max(0,
                                     skillshot.SkillshotData.Delay - (Environment.TickCount - skillshot.StartTick)),
                            skillshot.SkillshotData.MissileSpeed);
                        var pos = pred.PredictedPos;

                        var w = skillshot.SkillshotData.RawRadius + 30 - pos.Distance(from, skillshot.EndPosition, true);
                        if (w > 0)
                        {
                            collisions.Add(
                                new DetectedCollision
                            {
                                Position =
                                    pos.ProjectOn(skillshot.EndPosition, skillshot.StartPosition).LinePoint +
                                    skillshot.Direction * 30,
                                Unit     = hero,
                                Type     = CollisionObjectTypes.Minion,
                                Distance = pos.Distance(from),
                                Diff     = w,
                            });
                        }
                    }
                    break;

                case CollisionObjectTypes.YasuoWall:
                    if (
                        !ObjectManager.Get <Obj_AI_Hero>()
                        .Any(
                            hero =>
                            hero.IsValidTarget(float.MaxValue, false) &&
                            hero.Team == ObjectManager.Player.Team && hero.ChampionName == "Yasuo"))
                    {
                        break;
                    }
                    GameObject wall = null;
                    foreach (var gameObject in ObjectManager.Get <GameObject>())
                    {
                        if (gameObject.IsValid &&
                            Regex.IsMatch(
                                gameObject.Name, "_w_windwall.\\.troy",
                                RegexOptions.IgnoreCase))
                        {
                            wall = gameObject;
                        }
                    }
                    if (wall == null)
                    {
                        break;
                    }
                    var level     = wall.Name.Substring(wall.Name.Length - 6, 1);
                    var wallWidth = (300 + 50 * Convert.ToInt32(level));


                    var wallDirection = (wall.Position.To2D() - _yasuoWallCastedPos).Normalized().Perpendicular();
                    var wallStart     = wall.Position.To2D() + wallWidth / 2 * wallDirection;
                    var wallEnd       = wallStart - wallWidth * wallDirection;
                    var wallPolygon   = new SkillshotGeometry.Rectangle(wallStart, wallEnd, 75).ToPolygon();
                    var intersection  = new Vector2();
                    var intersections = new List <Vector2>();

                    for (var i = 0; i < wallPolygon.Points.Count; i++)
                    {
                        var inter =
                            wallPolygon.Points[i].Intersection(
                                wallPolygon.Points[i != wallPolygon.Points.Count - 1 ? i + 1 : 0], from,
                                skillshot.EndPosition);
                        if (inter.Intersects)
                        {
                            intersections.Add(inter.Point);
                        }
                    }

                    if (intersections.Count > 0)
                    {
                        intersection = intersections.OrderBy(item => item.Distance(from)).ToList()[0];
                        var collisionT = Environment.TickCount +
                                         Math.Max(
                            0,
                            skillshot.SkillshotData.Delay -
                            (Environment.TickCount - skillshot.StartTick)) + 100 +
                                         (1000 * intersection.Distance(from)) / skillshot.SkillshotData.MissileSpeed;
                        if (collisionT - _wallCastT < 4000)
                        {
                            if (skillshot.SkillshotData.Type != SkillShotType.SkillshotMissileLine)
                            {
                                skillshot.ForceDisabled = true;
                            }
                            return(intersection);
                        }
                    }

                    break;
                }
            }

            Vector2 result;

            if (collisions.Count > 0)
            {
                result = collisions.OrderBy(c => c.Distance).ToList()[0].Position;
            }
            else
            {
                result = new Vector2();
            }

            return(result);
        }
Esempio n. 13
0
        private static void OnDetectSkillshot(Skillshot skillshot)
        {
            try
            {
                //Check if the skillshot is already added.
                var alreadyAdded = false;

                // Integration disabled
                if (!Menu.Item("SkillshotsActive").GetValue <bool>())
                {
                    return;
                }

                foreach (var item in DetectedSkillshots)
                {
                    if (item.SpellData.SpellName == skillshot.SpellData.SpellName &&
                        (item.Unit.NetworkId == skillshot.Unit.NetworkId &&
                         (skillshot.Direction).AngleBetween(item.Direction) < 5 &&
                         (skillshot.Start.Distance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0)))
                    {
                        alreadyAdded = true;
                    }
                }

                //Check if the skillshot is from an ally.
                if (skillshot.Unit.IsAlly)
                {
                    return;
                }

                //Check if the skillshot is too far away.
                if (skillshot.Start.Distance(ObjectManager.Player.ServerPosition.To2D()) >
                    (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5)
                {
                    return;
                }


                //Add the skillshot to the detected skillshot list.
                if (!alreadyAdded)
                {
                    //Multiple skillshots like twisted fate Q.
                    if (skillshot.DetectionType == DetectionType.ProcessSpell)
                    {
                        if (skillshot.SpellData.MultipleNumber != -1)
                        {
                            var originalDirection = skillshot.Direction;

                            for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2;
                                 i <= (skillshot.SpellData.MultipleNumber - 1) / 2;
                                 i++)
                            {
                                var end = skillshot.Start +
                                          skillshot.SpellData.Range *
                                          originalDirection.Rotated(skillshot.SpellData.MultipleAngle * i);
                                var skillshotToAdd = new Skillshot(
                                    skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start,
                                    end, skillshot.Unit);

                                DetectedSkillshots.Add(skillshotToAdd);
                            }
                            return;
                        }

                        if (skillshot.SpellData.SpellName == "UFSlash")
                        {
                            skillshot.SpellData.MissileSpeed = 1600 + (int)skillshot.Unit.MoveSpeed;
                        }

                        if (skillshot.SpellData.Invert)
                        {
                            var newDirection   = -(skillshot.End - skillshot.Start).Normalized();
                            var end            = skillshot.Start + newDirection * skillshot.Start.Distance(skillshot.End);
                            var skillshotToAdd = new Skillshot(
                                skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end,
                                skillshot.Unit);
                            DetectedSkillshots.Add(skillshotToAdd);
                            return;
                        }

                        if (skillshot.SpellData.Centered)
                        {
                            var start          = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range;
                            var end            = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range;
                            var skillshotToAdd = new Skillshot(
                                skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                                skillshot.Unit);
                            DetectedSkillshots.Add(skillshotToAdd);
                            return;
                        }

                        if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5")
                        {
                            var angle = 60;
                            var edge1 =
                                (skillshot.End - skillshot.Unit.ServerPosition.To2D()).Rotated(
                                    -angle / 2 * (float)Math.PI / 180);
                            var edge2 = edge1.Rotated(angle * (float)Math.PI / 180);

                            foreach (var minion in ObjectManager.Get <Obj_AI_Minion>())
                            {
                                var v = minion.ServerPosition.To2D() - skillshot.Unit.ServerPosition.To2D();
                                if (minion.Name == "Seed" && edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0 &&
                                    minion.Distance(skillshot.Unit, false) < 800 && (minion.Team != ObjectManager.Player.Team))
                                {
                                    var start = minion.ServerPosition.To2D();
                                    var end   = skillshot.Unit.ServerPosition.To2D()
                                                .Extend(
                                        minion.ServerPosition.To2D(),
                                        skillshot.Unit.Distance(minion, false) > 200 ? 1300 : 1000);

                                    var skillshotToAdd = new Skillshot(
                                        skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                                        skillshot.Unit);
                                    DetectedSkillshots.Add(skillshotToAdd);
                                }
                            }
                            return;
                        }

                        if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid")
                        {
                            var start          = skillshot.End - skillshot.Direction.Perpendicular() * 400;
                            var end            = skillshot.End + skillshot.Direction.Perpendicular() * 400;
                            var skillshotToAdd = new Skillshot(
                                skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                                skillshot.Unit);
                            DetectedSkillshots.Add(skillshotToAdd);
                            return;
                        }

                        if (skillshot.SpellData.SpellName == "ZiggsQ")
                        {
                            var d1 = skillshot.Start.Distance(skillshot.End);
                            var d2 = d1 * 0.4f;
                            var d3 = d2 * 0.69f;


                            var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1");
                            var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2");

                            var bounce1Pos = skillshot.End + skillshot.Direction * d2;
                            var bounce2Pos = bounce1Pos + skillshot.Direction * d3;

                            bounce1SpellData.Delay =
                                (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500);
                            bounce2SpellData.Delay =
                                (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500);

                            var bounce1 = new Skillshot(
                                skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End,
                                bounce1Pos, skillshot.Unit);
                            var bounce2 = new Skillshot(
                                skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos,
                                skillshot.Unit);

                            DetectedSkillshots.Add(bounce1);
                            DetectedSkillshots.Add(bounce2);
                        }

                        if (skillshot.SpellData.SpellName == "ZiggsR")
                        {
                            skillshot.SpellData.Delay =
                                (int)
                                (1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range);
                        }

                        if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike")
                        {
                            var endPos = new Vector2();

                            foreach (var s in DetectedSkillshots)
                            {
                                if (s.Unit.NetworkId == skillshot.Unit.NetworkId && s.SpellData.Slot == SpellSlot.E)
                                {
                                    endPos = s.End;
                                }
                            }

                            foreach (var m in ObjectManager.Get <Obj_AI_Minion>())
                            {
                                if (m.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Unit.Team &&
                                    skillshot.IsDanger(m.Position.To2D()))
                                {
                                    endPos = m.Position.To2D();
                                }
                            }

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

                            skillshot.End       = endPos + 200 * (endPos - skillshot.Start).Normalized();
                            skillshot.Direction = (skillshot.End - skillshot.Start).Normalized();
                        }
                    }

                    if (skillshot.SpellData.SpellName == "OriannasQ")
                    {
                        var endCSpellData = SpellDatabase.GetByName("OriannaQend");

                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType, endCSpellData, skillshot.StartTick, skillshot.Start, skillshot.End,
                            skillshot.Unit);

                        DetectedSkillshots.Add(skillshotToAdd);
                    }


                    //Dont allow fow detection.
                    if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket)
                    {
                        return;
                    }

                    DetectedSkillshots.Add(skillshot);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 14
0
        private static void SkillshotDetector_OnDeleteMissile(Skillshot skillshot, Obj_SpellMissile missile)
        {
            if (skillshot.SpellData.SpellName != "VelkozQ")
            {
                return;
            }

            var spellData = SpellDatabase.GetByName("VelkozQSplit");
            var direction = skillshot.Direction.Perpendicular();
            if (DetectedSkillshots.Count(s => s.SpellData.SpellName == "VelkozQSplit") != 0)
            {
                return;
            }

            for (var i = -1; i <= 1; i = i + 2)
            {
                var skillshotToAdd = new Skillshot(
                    DetectionType.ProcessSpell, spellData, Environment.TickCount, missile.Position.To2D(),
                    missile.Position.To2D() + i*direction*spellData.Range, skillshot.Unit);
                DetectedSkillshots.Add(skillshotToAdd);
            }
        }
Esempio n. 15
0
        private static void Obj_AI_Base_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (sender.IsMe)
            {
                foreach (var o in SkillshotDatabase.Spells.Where(x => x.SpellName == args.SData.Name))
                {
                    foreach (var i in Damage.Spells
                             .Where(d => d.Key == o.ChampionName)
                             .SelectMany(item => item.Value).Where(i => i.Slot == (SpellSlot)o.Slot))
                    {
                        if (i.DamageType == Damage.DamageType.Physical)
                        {
                            CanManamune = true;
                        }
                    }
                }

                foreach (var o in TargetSpellDatabase.Spells.Where(x => x.Name == args.SData.Name.ToLower()))
                {
                    foreach (var i in Damage.Spells.Where(d => d.Key == o.ChampionName)
                             .SelectMany(item => item.Value).Where(i => i.Slot == (SpellSlot)o.Spellslot))
                    {
                        if (i.DamageType == Damage.DamageType.Physical)
                        {
                            CanManamune = true;
                        }
                    }
                }

                if (Me.GetSpellSlot(args.SData.Name) == SpellSlot.Unknown &&
                    (Origin.Item("usecombo").GetValue <KeyBind>().Active || args.Target.Type == Me.Type))
                {
                    CanManamune = true;
                }
                else
                {
                    Utility.DelayAction.Add(400, () => CanManamune = false);
                }
            }

            Attacker = null;
            if (sender.Type == GameObjectType.obj_AI_Hero && sender.IsEnemy)
            {
                var heroSender = ObjectManager.Get <Obj_AI_Hero>().First(x => x.NetworkId == sender.NetworkId);
                if (heroSender.GetSpellSlot(args.SData.Name) == SpellSlot.Unknown && args.Target.Type == Me.Type)
                {
                    Danger      = false; Dangercc = false; DangerUlt = false;
                    AggroTarget = ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(args.Target.NetworkId);

                    IncomeDamage = (float)heroSender.GetAutoAttackDamage(AggroTarget);
                    Logger(LogType.Damage, heroSender.SkinName + " hit (AA) " + AggroTarget.SkinName + " for: " + IncomeDamage);
                }

                Attacker = heroSender;
                foreach (var o in TargetSpellDatabase.Spells.Where(x => x.Name == args.SData.Name.ToLower()))
                {
                    Stealth = o.Stealth;
                    if (o.Type == SpellType.Skillshot)
                    {
                        continue;
                    }

                    if (o.Type == SpellType.Self)
                    {
                        Utility.DelayAction.Add((int)(o.Delay), delegate
                        {
                            var vulnerableTarget =
                                ObjectManager.Get <Obj_AI_Hero>().OrderBy(x => x.Distance(heroSender.ServerPosition))
                                .FirstOrDefault(x => x.IsAlly);

                            if (vulnerableTarget != null && vulnerableTarget.Distance(heroSender.ServerPosition, true) <= o.Range * o.Range)
                            {
                                AggroTarget  = vulnerableTarget;
                                IncomeDamage = (float)heroSender.GetSpellDamage(AggroTarget, (SpellSlot)o.Spellslot);

                                if (o.Wait)
                                {
                                    return;
                                }

                                Spell     = true;
                                Danger    = Origin.Item(o.Name.ToLower() + "ccc").GetValue <bool>();
                                DangerUlt = Origin.Item(o.Name.ToLower() + "ccc").GetValue <bool>() && o.Spellslot.ToString() == "R";
                                Dangercc  = o.CcType != CcType.No && o.Type != SpellType.AutoAttack && Origin.Item(o.Name.ToLower() + "ccc").GetValue <bool>();

                                Logger(LogType.Damage, "Danger (Self: " + o.Spellslot + "): " + Danger);
                                Logger(LogType.Damage,
                                       heroSender.SkinName + " hit (Self: " + o.Spellslot + ") " + AggroTarget.SkinName + " for: " + IncomeDamage);
                            }
                        });
                    }

                    if (o.Type == SpellType.Targeted && args.Target.Type == Me.Type)
                    {
                        Utility.DelayAction.Add((int)(o.Delay), delegate
                        {
                            AggroTarget =
                                ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(args.Target.NetworkId);

                            IncomeDamage = (float)heroSender.GetSpellDamage(AggroTarget, (SpellSlot)o.Spellslot);

                            Logger(LogType.Damage, "Dangerous (Targetd: " + o.Spellslot + "): " + Danger);
                            Logger(LogType.Damage,
                                   heroSender.SkinName + " hit (Targeted: " + o.Spellslot + ") " + AggroTarget.SkinName + " for: " + IncomeDamage);

                            if (o.Wait)
                            {
                                return;
                            }

                            Spell     = true;
                            Danger    = Origin.Item(o.Name.ToLower() + "ccc").GetValue <bool>();
                            DangerUlt = Origin.Item(o.Name.ToLower() + "ccc").GetValue <bool>() && o.Spellslot.ToString() == "R";
                            Dangercc  = o.CcType != CcType.No && o.Type != SpellType.AutoAttack;
                        });
                    }
                }

                foreach (var o in SkillshotDatabase.Spells.Where(x => x.SpellName == args.SData.Name))
                {
                    var skillData =
                        new SkillshotData(o.ChampionName, o.SpellName, o.Slot, o.Type, o.Delay, o.Range,
                                          o.Radius, o.MissileSpeed, o.AddHitbox, o.FixedRange, o.DangerValue);

                    var endPosition = args.Start.To2D() +
                                      o.Range * (args.End.To2D() - heroSender.ServerPosition.To2D()).Normalized();

                    var skillShot = new Skillshot(DetectionType.ProcessSpell, skillData, Environment.TickCount,
                                                  heroSender.ServerPosition.To2D(), endPosition, heroSender);

                    var castTime = (o.DontAddExtraDuration ? 0 : o.ExtraDuration) + o.Delay +
                                   (int)(1000 * heroSender.Distance(Friendly().ServerPosition) / o.MissileSpeed) -
                                   (Environment.TickCount - skillShot.StartTick);

                    var vulnerableTarget =
                        ObjectManager.Get <Obj_AI_Hero>()
                        .FirstOrDefault(x => !skillShot.IsSafe(x.ServerPosition.To2D()) && x.IsAlly);

                    if (vulnerableTarget != null && vulnerableTarget.Distance(heroSender.ServerPosition, true) <= o.Range * o.Range)
                    {
                        Utility.DelayAction.Add(castTime - 400, delegate
                        {
                            AggroTarget  = vulnerableTarget;
                            IncomeDamage = (float)heroSender.GetSpellDamage(AggroTarget, (SpellSlot)skillShot.SkillshotData.Slot);

                            Spell     = true;
                            Danger    = Origin.Item(o.SpellName.ToLower() + "ccc").GetValue <bool>();
                            DangerUlt = Origin.Item(o.SpellName.ToLower() + "ccc").GetValue <bool>() && o.Slot.ToString() == "R";

                            Logger(LogType.Damage, "Dangerous (Skillshot " + o.Slot + "): " + Danger);
                            Logger(LogType.Damage,
                                   heroSender.SkinName + " may hit (SkillShot: " + o.Slot + ") " + AggroTarget.SkinName + " for: " + IncomeDamage);
                        });
                    }
                }
            }

            if (sender.Type == GameObjectType.obj_AI_Minion && sender.IsEnemy)
            {
                if (args.Target.Type == Me.Type)
                {
                    Danger      = false; Dangercc = false; DangerUlt = false;
                    AggroTarget = ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(args.Target.NetworkId);

                    MinionDamage =
                        (float)sender.CalcDamage(AggroTarget, Damage.DamageType.Physical,
                                                 sender.BaseAttackDamage + sender.FlatPhysicalDamageMod);
                }
            }

            if (sender.Type == GameObjectType.obj_AI_Turret && sender.IsEnemy)
            {
                if (args.Target.Type == Me.Type)
                {
                    Danger = false; Dangercc = false; DangerUlt = false;
                    if (sender.Distance(Friendly().ServerPosition, true) <= 900 * 900)
                    {
                        AggroTarget = ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(args.Target.NetworkId);

                        IncomeDamage =
                            (float)sender.CalcDamage(AggroTarget, Damage.DamageType.Physical,
                                                     sender.BaseAttackDamage + sender.FlatPhysicalDamageMod);

                        Logger(LogType.Damage,
                               sender.Name + " (Turret Attack) " + AggroTarget.SkinName + " for: " + IncomeDamage);
                    }
                }
            }
        }
Esempio n. 16
0
        private static void TriggerOnDetectSkillshot(DetectionType detectionType,
            SpellData spellData,
            int startT,
            Vector2 start,
            Vector2 end,
            Obj_AI_Base unit)
        {
            var skillshot = new Skillshot(detectionType, spellData, startT, start, end, unit);

            if (OnDetectSkillshot != null)
            {
                OnDetectSkillshot(skillshot);
            }
        }
Esempio n. 17
0
            private static void OnDetectSkillshot(Skillshot skillshot)
            {
                var alreadyAdded = false;

                foreach (var i in SkillshotDetector.DetectedSkillshots)
                {
                    if (i.SpellData.SpellName == skillshot.SpellData.SpellName &&
                        i.Unit.NetworkId == skillshot.Unit.NetworkId &&
                        skillshot.Direction.AngleBetween(i.Direction) < 5 &&
                        (skillshot.Start.Distance(i.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0))
                    {
                        alreadyAdded = true;
                    }
                }
                if (skillshot.Unit.Team == ObjectManager.Player.Team)
                {
                    return;
                }
                if (skillshot.Start.Distance(ObjectManager.Player.ServerPosition.To2D())
                    > (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5)
                {
                    return;
                }
                if (alreadyAdded && !skillshot.SpellData.DontCheckForDuplicates)
                {
                    return;
                }
                if (skillshot.DetectionType == DetectionType.ProcessSpell)
                {
                    if (skillshot.SpellData.MultipleNumber != -1)
                    {
                        var originalDirection = skillshot.Direction;
                        for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2;
                             i <= (skillshot.SpellData.MultipleNumber - 1) / 2;
                             i++)
                        {
                            SkillshotDetector.DetectedSkillshots.Add(
                                new Skillshot(
                                    skillshot.DetectionType,
                                    skillshot.SpellData,
                                    skillshot.StartTick,
                                    skillshot.Start,
                                    skillshot.Start
                                    + skillshot.SpellData.Range
                                    * originalDirection.Rotated(skillshot.SpellData.MultipleAngle * i),
                                    skillshot.Unit));
                        }
                        return;
                    }
                    if (skillshot.SpellData.SpellName == "UFSlash")
                    {
                        skillshot.SpellData.MissileSpeed = 1600 + (int)skillshot.Unit.MoveSpeed;
                    }
                    if (skillshot.SpellData.SpellName == "SionR")
                    {
                        skillshot.SpellData.MissileSpeed = (int)skillshot.Unit.MoveSpeed;
                    }
                    if (skillshot.SpellData.Invert)
                    {
                        SkillshotDetector.DetectedSkillshots.Add(
                            new Skillshot(
                                skillshot.DetectionType,
                                skillshot.SpellData,
                                skillshot.StartTick,
                                skillshot.Start,
                                skillshot.Start
                                + -(skillshot.End - skillshot.Start).Normalized()
                                * skillshot.Start.Distance(skillshot.End),
                                skillshot.Unit));
                        return;
                    }
                    if (skillshot.SpellData.Centered)
                    {
                        SkillshotDetector.DetectedSkillshots.Add(
                            new Skillshot(
                                skillshot.DetectionType,
                                skillshot.SpellData,
                                skillshot.StartTick,
                                skillshot.Start - skillshot.Direction * skillshot.SpellData.Range,
                                skillshot.Start + skillshot.Direction * skillshot.SpellData.Range,
                                skillshot.Unit));
                        return;
                    }
                    if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5")
                    {
                        const int Angle = 60;
                        var       edge1 =
                            (skillshot.End - skillshot.Unit.ServerPosition.To2D()).Rotated(
                                -Angle / 2f * (float)Math.PI / 180);
                        var edge2 = edge1.Rotated(Angle * (float)Math.PI / 180);
                        foreach (var skillshotToAdd in from minion in ObjectManager.Get <Obj_AI_Minion>()
                                 let v =
                                     (minion.ServerPosition - skillshot.Unit.ServerPosition).To2D(
                                         )
                                     where
                                     minion.Name == "Seed" && edge1.CrossProduct(v) > 0 &&
                                     v.CrossProduct(edge2) > 0 &&
                                     minion.Distance(skillshot.Unit) < 800 &&
                                     minion.Team != ObjectManager.Player.Team
                                     let start = minion.ServerPosition.To2D()
                                                 let end =
                                         skillshot.Unit.ServerPosition.Extend(
                                             minion.ServerPosition,
                                             skillshot.Unit.Distance(minion) > 200 ? 1300 : 1000)
                                         select
                                         new Skillshot(
                                             skillshot.DetectionType,
                                             skillshot.SpellData,
                                             skillshot.StartTick,
                                             start,
                                             end,
                                             skillshot.Unit))
                        {
                            SkillshotDetector.DetectedSkillshots.Add(skillshotToAdd);
                        }
                        return;
                    }
                    if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid")
                    {
                        SkillshotDetector.DetectedSkillshots.Add(
                            new Skillshot(
                                skillshot.DetectionType,
                                skillshot.SpellData,
                                skillshot.StartTick,
                                skillshot.End - skillshot.Perpendicular * 400,
                                skillshot.End + skillshot.Perpendicular * 400,
                                skillshot.Unit));
                        return;
                    }
                    if (skillshot.SpellData.SpellName == "DianaArc")
                    {
                        SkillshotDetector.DetectedSkillshots.Add(
                            new Skillshot(
                                skillshot.DetectionType,
                                SpellDatabase.GetByName("DianaArcArc"),
                                skillshot.StartTick,
                                skillshot.Start,
                                skillshot.End,
                                skillshot.Unit));
                    }
                    if (skillshot.SpellData.SpellName == "ZiggsQ")
                    {
                        var d1 = skillshot.Start.Distance(skillshot.End);
                        var d2 = d1 * 0.4f;
                        var d3 = d2 * 0.69f;
                        var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1");
                        var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2");
                        var bounce1Pos       = skillshot.End + skillshot.Direction * d2;
                        var bounce2Pos       = bounce1Pos + skillshot.Direction * d3;
                        bounce1SpellData.Delay =
                            (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500);
                        bounce2SpellData.Delay =
                            (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500);
                        SkillshotDetector.DetectedSkillshots.Add(
                            new Skillshot(
                                skillshot.DetectionType,
                                bounce1SpellData,
                                skillshot.StartTick,
                                skillshot.End,
                                bounce1Pos,
                                skillshot.Unit));
                        SkillshotDetector.DetectedSkillshots.Add(
                            new Skillshot(
                                skillshot.DetectionType,
                                bounce2SpellData,
                                skillshot.StartTick,
                                bounce1Pos,
                                bounce2Pos,
                                skillshot.Unit));
                    }
                    if (skillshot.SpellData.SpellName == "ZiggsR")
                    {
                        skillshot.SpellData.Delay =
                            (int)(1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range);
                    }
                    if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike")
                    {
                        var endPos = new Vector2();
                        foreach (var s in SkillshotDetector.DetectedSkillshots)
                        {
                            if (s.Unit.NetworkId == skillshot.Unit.NetworkId && s.SpellData.Slot == SpellSlot.E)
                            {
                                var extendedE = new Skillshot(
                                    skillshot.DetectionType,
                                    skillshot.SpellData,
                                    skillshot.StartTick,
                                    skillshot.Start,
                                    skillshot.End + skillshot.Direction * 100,
                                    skillshot.Unit);
                                if (!extendedE.IsSafePoint(s.End))
                                {
                                    endPos = s.End;
                                }
                                break;
                            }
                        }
                        foreach (var m in ObjectManager.Get <Obj_AI_Minion>())
                        {
                            if (m.CharData.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Unit.Team)
                            {
                                var extendedE = new Skillshot(
                                    skillshot.DetectionType,
                                    skillshot.SpellData,
                                    skillshot.StartTick,
                                    skillshot.Start,
                                    skillshot.End + skillshot.Direction * 100,
                                    skillshot.Unit);
                                if (!extendedE.IsSafePoint(m.Position.To2D()))
                                {
                                    endPos = m.Position.To2D();
                                }
                                break;
                            }
                        }
                        if (endPos.IsValid())
                        {
                            skillshot = new Skillshot(
                                DetectionType.ProcessSpell,
                                SpellDatabase.GetByName("JarvanIVEQ"),
                                AkaLib.Evade.Extensions.GameTimeTickCount,
                                skillshot.Start,
                                endPos + 200 * (endPos - skillshot.Start).Normalized(),
                                skillshot.Unit);
                        }
                    }
                }
                if (skillshot.SpellData.SpellName == "OriannasQ")
                {
                    SkillshotDetector.DetectedSkillshots.Add(
                        new Skillshot(
                            skillshot.DetectionType,
                            SpellDatabase.GetByName("OriannaQend"),
                            skillshot.StartTick,
                            skillshot.Start,
                            skillshot.End,
                            skillshot.Unit));
                }
                if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket)
                {
                    return;
                }
                SkillshotDetector.DetectedSkillshots.Add(skillshot);
            }