Esempio n. 1
0
        public static Vector3 PredictedXYZ(Hero hero, Target target, float delay)
        {
            if (IsIdle(target.Hero))
            {
                return(target.Position);
            }

            if (target.IsVsisible && target.FindAngle(hero.Position) < 0.5f)
            {
                delay /= 2;
            }

            var targetSpeed = new Vector3();

            if (!LastRotRDictionary.ContainsKey(target.Handle))
            {
                LastRotRDictionary.Add(target.Handle, target.RotationRad);
            }

            var straightTime = StraightTime(target.Hero);

            if (straightTime > 180)
            {
                LastRotRDictionary[target.Handle] = target.RotationRad;
            }

            LastRotRDictionary[target.Handle] = target.RotationRad;
            if ((target.ClassId == ClassId.CDOTA_Unit_Hero_StormSpirit ||
                 target.ClassId == ClassId.CDOTA_Unit_Hero_Rubick) &&
                target.HasModifier("modifier_storm_spirit_ball_lightning"))
            {
                var ballLightning  = target.FindSpell("storm_spirit_ball_lightning", true);
                var firstOrDefault =
                    ballLightning.AbilitySpecialData.FirstOrDefault(x => x.Name == "ball_lightning_move_speed");
                if (firstOrDefault != null)
                {
                    var ballSpeed  = firstOrDefault.GetValue(ballLightning.Level - 1);
                    var newpredict = target.Vector3FromPolarAngle() * (ballSpeed / 1000f);
                    targetSpeed = newpredict;
                }
            }
            else
            {
                targetSpeed = target.Vector3FromPolarAngle() * (target.MovementSpeed / 1000f);
            }

            var v = target.GetPosition() + targetSpeed * delay;

            return(new Vector3(v.X, v.Y, 0));
        }
Esempio n. 2
0
        public static Vector3 PredictedXYZ(Target target, float delay)
        {
            if (IsIdle(target.Hero))
            {
                return target.Position;
            }

            var targetSpeed = new Vector3();
            if (!LastRotRDictionary.ContainsKey(target.Handle))
            {
                LastRotRDictionary.Add(target.Handle, target.RotationRad);
            }

            var straightTime = StraightTime(target.Hero);
            if (straightTime > 180)
            {
                LastRotRDictionary[target.Handle] = target.RotationRad;
            }

            LastRotRDictionary[target.Handle] = target.RotationRad;
            if ((target.ClassID == ClassID.CDOTA_Unit_Hero_StormSpirit
                 || target.ClassID == ClassID.CDOTA_Unit_Hero_Rubick)
                && target.HasModifier("modifier_storm_spirit_ball_lightning"))
            {
                var ballLightning = target.FindSpell("storm_spirit_ball_lightning", true);
                var firstOrDefault =
                    ballLightning.AbilitySpecialData.FirstOrDefault(x => x.Name == "ball_lightning_move_speed");
                if (firstOrDefault != null)
                {
                    var ballSpeed = firstOrDefault.GetValue(ballLightning.Level - 1);
                    var newpredict = target.Vector3FromPolarAngle() * (ballSpeed / 1000f);
                    targetSpeed = newpredict;
                }
            }
            else
            {
                targetSpeed = target.Vector3FromPolarAngle() * (target.MovementSpeed / 1000f);
            }

            var v = target.GetPosition() + targetSpeed * delay;
            return new Vector3(v.X, v.Y, 0);
        }
Esempio n. 3
0
        public static Vector3 PredictedXYZ(Target target, float delay)
        {
            if (IsIdle(target.Hero))
            {
                return(target.Position);
            }

            var targetSpeed = new Vector3();

            if (!lastRotRDictionary.ContainsKey(target.Handle))
            {
                lastRotRDictionary.Add(target.Handle, target.RotationRad);
            }

            var straightTime = StraightTime(target.Hero);

            if (straightTime > 180)
            {
                lastRotRDictionary[target.Handle] = target.RotationRad;
            }

            if (straightTime < 10 || IsTurning(target.Hero, 0.18))
            {
                var rotDiff = lastRotRDictionary[target.Handle] - target.RotationRad;
                var a       = 10 * straightTime * Math.Pow(rotDiff, 2);
                if (a >= 0 && a <= 1300)
                {
                    a = 1300 + a;
                }
                else if (a <= 0 && a >= -1300)
                {
                    a = 1300 - a;
                }

                targetSpeed =
                    (Vector3)
                    VectorExtensions.FromPolarAngle((lastRotRDictionary[target.Handle] + target.RotationRad * 2) / 2)
                    * target.MovementSpeed / (float)Math.Abs(a);
            }
            else if (straightTime < 180)
            {
                var rotDiff = lastRotRDictionary[target.Handle] - target.RotationRad;
                var a       = straightTime * Math.Pow(rotDiff, 2);
                if (a >= 0 && a <= 1000)
                {
                    a = 1000 + a;
                }
                else if (a <= 0 && a >= -1000)
                {
                    a = 1000 - a;
                }

                targetSpeed =
                    (Vector3)
                    (VectorExtensions.FromPolarAngle((lastRotRDictionary[target.Handle] + target.RotationRad) / 2)
                     * target.MovementSpeed / (float)Math.Abs(a));
            }
            else
            {
                lastRotRDictionary[target.Handle] = target.RotationRad;
                if ((target.ClassID == ClassID.CDOTA_Unit_Hero_StormSpirit ||
                     target.ClassID == ClassID.CDOTA_Unit_Hero_Rubick) &&
                    target.HasModifier("modifier_storm_spirit_ball_lightning"))
                {
                    var ballLightning  = target.FindSpell("storm_spirit_ball_lightning", true);
                    var firstOrDefault =
                        ballLightning.AbilitySpecialData.FirstOrDefault(x => x.Name == "ball_lightning_move_speed");
                    if (firstOrDefault != null)
                    {
                        var ballSpeed  = firstOrDefault.GetValue(ballLightning.Level - 1);
                        var newpredict = target.Vector3FromPolarAngle() * (ballSpeed / 1000);
                        targetSpeed = newpredict;
                    }
                }
                else
                {
                    targetSpeed =
                        (Vector3)(VectorExtensions.FromPolarAngle(target.RotationRad) * target.MovementSpeed / 1000);
                }
            }

            var v = target.GetPosition() + targetSpeed * delay;

            return(new Vector3(v.X, v.Y, 0));
        }