예제 #1
0
        public static Output Basic(Character target, SkillBase spell)
        {
            var output = new Output();

            if (spell.SkillType == SkillType.Line && LocalPlayer.Instance.CheckCollisionToTarget(target, spell.SpellCollisionRadius))
            {
                output.CanHit              = false;
                output.Hitchance           = HitChance.Collision;
                output.HitchancePercentage = 0;
                output.CastPosition        = Vector2.Zero;
            }
            else
            {
                var distance = target.Distance(LocalPlayer.Instance);
                output.CanHit              = true;
                output.Hitchance           = HitChance.High;
                output.HitchancePercentage = 75;
                output.CastPosition        = spell.FixedDelay > 0
                    ? new Vector2(target.Pos().X + target.NetworkMovement.Velocity.X * spell.FixedDelay,
                                  target.Pos().Y + target.NetworkMovement.Velocity.Y * spell.FixedDelay)
                    : new Vector2(target.Pos().X + target.NetworkMovement.Velocity.X * (distance / spell.Speed),
                                  target.Pos().Y + target.NetworkMovement.Velocity.Y * (distance / spell.Speed));
            }

            output.Target = target;
            if (spell.SkillType == SkillType.Line && UseClosestPointOnLine)
            {
                output.CastPosition = GeometryLib.NearestPointOnFiniteLine(LocalPlayer.Instance.Pos().Extend(output.CastPosition, 0.6f),
                                                                           output.CastPosition, Main.MouseWorldPos);
            }
            return(output);
        }
예제 #2
0
        public void Update()
        {
            var pos = LocalPlayer.Instance.Pos();

            ClosestPoint = GeometryLib.NearestPointOnFiniteLine(DashObject.StartPosition,
                                                                DashObject.TargetPosition, pos);
            if (Data.StartDelay > 0)
            {
                var age = DashObject.GameObject.Get <AgeObject>().Age;
                if (age > Data.StartDelay)
                {
                    EstimatedImpact = Time.time + (pos.Distance(DashObject.GameObject.Get <BaseGameObject>().Owner as Character) -
                                                   LocalPlayer.Instance.MapCollision.MapCollisionRadius) /
                                      Data.Speed;
                }
                else
                {
                    EstimatedImpact = Time.time + Data.StartDelay - age +
                                      (pos.Distance(DashObject.GameObject.Get <BaseGameObject>().Owner as Character) -
                                       LocalPlayer.Instance.MapCollision.MapCollisionRadius) /
                                      Data.Speed;
                }
            }
            else
            {
                EstimatedImpact = Time.time + (pos.Distance(DashObject.GameObject.Get <BaseGameObject>().Owner as Character) -
                                               LocalPlayer.Instance.MapCollision.MapCollisionRadius) /
                                  Data.Speed;
            }

            IsDangerous = GetIsDangerous(pos);
        }
예제 #3
0
                private static void InGameObject_OnCreate(InGameObject inGameObject)
                {
                    var baseTypes = inGameObject.GetBaseTypes().ToArray();

                    if (baseTypes.Contains("CurveProjectile") || baseTypes.Contains("CurveProjectile2"))
                    {
                        var data = AbilityDatabase.Get(inGameObject.ObjectName);
                        if (data == null)
                        {
                            return;
                        }
                        var pos        = LocalPlayer.Instance.Pos();
                        var projectile = inGameObject.Get <CurveProjectileObject>();

                        var closest = GeometryLib.NearestPointOnFiniteLine(projectile.Position,
                                                                           projectile.TargetPosition, pos);
                        if (pos.Distance(closest) > 6)
                        {
                            return;
                        }

                        var tp = new TrackedCurveProjectile(projectile, data);
                        AddAfterFrame.Add(tp);
                    }
                }
예제 #4
0
        private static bool OrbLogic(SkillBase skill, bool shouldCheckHover = false)
        {
            var orb = EntitiesManager.CenterOrb;

            if (orb == null || !orb.IsValid || !orb.IsActiveObject)
            {
                return(false);
            }
            var livingObj = orb.Get <LivingObject>();

            if (livingObj.IsDead)
            {
                return(false);
            }

            var orbMapObj = orb.Get <MapGameObject>();
            var orbPos    = orbMapObj.Position;

            if (!TargetSelection.CursorDistCheck(orbPos))
            {
                return(false);
            }

            if (livingObj.Health <= 14 && skill.Slot == AbilitySlot.Ability1)
            {
                Main.DebugOutput            = "Attacking orb (Orb Steal)";
                LocalPlayer.EditAimPosition = true;
                LocalPlayer.Aim(orbPos);
                return(true);
            }
            if (livingObj.Health <= 22 && skill.Slot == AbilitySlot.Ability2)
            {
                Main.DebugOutput            = "Attacking orb (Orb Steal)";
                LocalPlayer.EditAimPosition = true;
                LocalPlayer.Aim(orbPos);
                return(true);
            }
            if (orbPos.Distance(LocalPlayer.Instance) > skill.Range ||
                shouldCheckHover && !orbMapObj.IsHoveringNear())
            {
                return(false);
            }

            if (shouldCheckHover)
            {
                Main.DebugOutput = "Attacking orb (mouse hovering)";
            }
            if (skill.SkillType == SkillType.Line && Prediction.UseClosestPointOnLine)
            {
                orbPos = GeometryLib.NearestPointOnFiniteLine(LocalPlayer.Instance.Pos().Extend(orbPos, 0.6f),
                                                              orbPos, Base.Main.MouseWorldPos);
            }
            LocalPlayer.EditAimPosition = true;
            LocalPlayer.Aim(orbPos);
            return(true);
        }
예제 #5
0
        public void Update()
        {
            var pos = LocalPlayer.Instance.Pos();

            ClosestPoint = GeometryLib.NearestPointOnFiniteLine(Projectile.StartPosition,
                                                                Projectile.CalculatedEndPosition, pos);
            EstimatedImpact = Time.time + (pos.Distance(Projectile.LastPosition) -
                                           LocalPlayer.Instance.MapCollision.MapCollisionRadius) /
                              Data.Speed;
            IsDangerous = GetIsDangerous(pos);
        }
예제 #6
0
        public void Update()
        {
            var pos = LocalPlayer.Instance.Pos();

            ClosestPoint = GeometryLib.NearestPointOnFiniteLine(StartPosition,
                                                                EndPosition, pos);
            EstimatedImpact = Time.time + (pos.Distance(Projectile.GameObject.Get <BaseGameObject>().Owner as Character) -
                                           LocalPlayer.Instance.MapCollision.MapCollisionRadius) /
                              Data.Speed;
            IsDangerous = GetIsDangerous(pos);
        }
예제 #7
0
        private static Output TestPred(Character target, SkillBase spell)
        {
            if (spell.SkillType == SkillType.Line)
            {
                var output = TestPrediction.GetPrediction(LocalPlayer.Instance.Pos(), target, spell.Range, spell.Speed, spell.SpellCollisionRadius,
                                                          spell.FixedDelay, 1.75f, true, IgnoreFlags);
                if (UseClosestPointOnLine)
                {
                    output.CastPosition = GeometryLib.NearestPointOnFiniteLine(LocalPlayer.Instance.Pos().Extend(output.CastPosition, 0.6f),
                                                                               output.CastPosition, Main.MouseWorldPos);
                }
                return(output);
            }

            return(TestPrediction.GetPrediction(LocalPlayer.Instance.Pos(), target, spell.Range, spell.Speed, spell.SpellCollisionRadius,
                                                spell.FixedDelay));
        }
예제 #8
0
        private static Output SDK(Character target, SkillBase spell)
        {
            if (spell.SkillType == SkillType.Line)
            {
                var sdkOutput = new PredictionInput(LocalPlayer.Instance, target, spell.Range, spell.Speed, spell.SpellCollisionRadius,
                                                    SkillType.Line, 0, IgnoreFlags).GetLinePrediction();

                var output = new Output
                {
                    CanHit              = sdkOutput.HitChancePercent > 1,
                    CastPosition        = sdkOutput.PredictedPosition,
                    CollisionResult     = sdkOutput.CollisionResult,
                    Hitchance           = sdkOutput.HitChance,
                    HitchancePercentage = sdkOutput.HitChancePercent,
                    Target              = target
                };
                if (UseClosestPointOnLine)
                {
                    output.CastPosition = GeometryLib.NearestPointOnFiniteLine(LocalPlayer.Instance.Pos().Extend(output.CastPosition, 0.6f),
                                                                               output.CastPosition, Main.MouseWorldPos);
                }
                return(output);
            }
            else
            {
                var output = new PredictionInput(LocalPlayer.Instance, target, spell.Range, spell.Speed, spell.SpellCollisionRadius, SkillType.Circle,
                                                 spell.FixedDelay).GetCirclePrediction();
                return(new Output
                {
                    CanHit = output.HitChancePercent > 1,
                    CastPosition = output.PredictedPosition,
                    CollisionResult = output.CollisionResult,
                    Hitchance = output.HitChance,
                    HitchancePercentage = output.HitChancePercent,
                    Target = target
                });
            }
        }
예제 #9
0
                private static void InGameObject_OnCreate(InGameObject inGameObject)
                {
                    var baseTypes = inGameObject.GetBaseTypes().ToArray();

                    if (baseTypes.Contains("Dash"))
                    {
                        var dashObj = inGameObject.Get <DashObject>();
                        var data    = dashObj.Data();
                        if (data == null)
                        {
                            return;
                        }
                        var pos     = LocalPlayer.Instance.Pos();
                        var closest = GeometryLib.NearestPointOnFiniteLine(dashObj.StartPosition,
                                                                           dashObj.TargetPosition, pos);
                        if (pos.Distance(closest) > 5)
                        {
                            return;
                        }
                        var dash = new TrackedDash(dashObj, data);
                        AddAfterFrame.Add(dash);
                    }
                }
예제 #10
0
                private static void InGameObject_OnCreate(InGameObject inGameObject)
                {
                    var projectile = inGameObject as Projectile;

                    if (projectile != null)
                    {
                        var data = AbilityDatabase.Get(inGameObject.ObjectName);
                        if (data == null)
                        {
                            return;
                        }
                        var pos = LocalPlayer.Instance.Pos();

                        var closest = GeometryLib.NearestPointOnFiniteLine(projectile.StartPosition,
                                                                           projectile.CalculatedEndPosition, pos);
                        if (pos.Distance(closest) > 5)
                        {
                            return;
                        }

                        var tp = new TrackedProjectile(projectile, data);
                        AddAfterFrame.Add(tp);
                    }
                }
예제 #11
0
        private static bool SkillAimLogic()
        {
            var dangerousProjectiles = new List <TrackedProjectile>();

            dangerousProjectiles.AddRange(ObjectTracker.Enemy.Projectiles.TrackedObjects);
            dangerousProjectiles = dangerousProjectiles.Where(p => p.IsDangerous).ToList();
            if (_castingLastFrame != null && LocalPlayer.Instance.AbilitySystem.IsCasting &&
                LocalPlayer.Instance.AbilitySystem.CastingAbilityId == _castingLastFrame.AbilityId)
            {
                var casting = _castingLastFrame;
                casting.SetStatus(true);

                if (casting.OverrideValue() != 0)
                {
                    return(false);
                }

                if (casting.AbilityType == DodgeAbilityType.Jump && casting.UsesMousePos)
                {
                    LocalPlayer.EditAimPosition = true;
                    LocalPlayer.Aim(casting.GetJumpPos());
                }
                else if (casting.AbilityType == DodgeAbilityType.Obstacle && dangerousProjectiles.Any())
                {
                    LocalPlayer.EditAimPosition = true;
                    var projectile = dangerousProjectiles
                                     .OrderByDescending(p => p.Data.Danger)
                                     .First().Projectile;
                    var pos = LocalPlayer.Instance.Pos().Extend(projectile.MapObject.Position, 1.5f);
                    LocalPlayer.Aim(pos);
                }
                else if (casting.AbilityType == DodgeAbilityType.Shield && casting.UsesMousePos && dangerousProjectiles.Any())
                {
                    var projectile = dangerousProjectiles
                                     .OrderByDescending(p => p.Data.Danger)
                                     .First().Projectile;
                    var pos = GeometryLib.NearestPointOnFiniteLine(projectile.MapObject.Position,
                                                                   LocalPlayer.Instance.Pos(), Main.MouseWorldPos);
                    if (LocalPlayer.Instance.Distance(pos) < 1)
                    {
                        pos = LocalPlayer.Instance.Pos().Extend(projectile.MapObject.Position, 1);
                    }
                    LocalPlayer.Aim(pos);
                }
                else if (casting.NeedsSelfCast)
                {
                    LocalPlayer.EditAimPosition = true;
                    LocalPlayer.Aim(LocalPlayer.Instance.Pos());
                }

                return(true);
            }

            if (!LocalPlayer.Instance.AbilitySystem.IsCasting && _castingLastFrame != null)
            {
                _castingLastFrame.SetStatus(false);
                _castingLastFrame           = null;
                LocalPlayer.EditAimPosition = false;
            }

            return(false);
        }