当前位置: 首页>>代码示例>>C#>>正文


C# Obj_AI_Base.IsDashing方法代码示例

本文整理汇总了C#中Obj_AI_Base.IsDashing方法的典型用法代码示例。如果您正苦于以下问题:C# Obj_AI_Base.IsDashing方法的具体用法?C# Obj_AI_Base.IsDashing怎么用?C# Obj_AI_Base.IsDashing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Obj_AI_Base的用法示例。


在下文中一共展示了Obj_AI_Base.IsDashing方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFastUnitPosition

        /// <summary>
        /// Gets fast-predicted unit position
        /// </summary>
        /// <param name="target">Target</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="from">Spell casted position</param>
        /// <returns></returns>
        public static Vector2 GetFastUnitPosition(Obj_AI_Base target, float delay, float missileSpeed = 0, Vector2? from = null, float distanceSet = 0)
        {
            List<Vector2> path = target.GetWaypoints();
            if (from == null)
                from = ObjectManager.Player.ServerPosition.To2D();

            if (path.Count <= 1 || (target is Obj_AI_Hero && ((Obj_AI_Hero)target).IsChannelingImportantSpell()) || Utility.IsImmobileTarget(target))
                return target.ServerPosition.To2D();

            if (target.IsDashing())
                return target.GetDashInfo().Path.Last();

            float distance = distanceSet;

            if (distance == 0)
            {
                float targetDistance = from.Value.Distance(target.ServerPosition);
                float flyTime = targetDistance / missileSpeed;

                if (missileSpeed != 0 && path.Count == 2)
                {
                    Vector2 Vt = (path[1] - path[0]).Normalized() * target.MoveSpeed;
                    Vector2 Vs = (target.ServerPosition.To2D() - from.Value).Normalized() * missileSpeed;
                    Vector2 Vr = Vt - Vs;

                    flyTime = targetDistance / Vr.Length();
                }

                float t = flyTime + delay + Game.Ping / 2000f;
                distance = t * target.MoveSpeed;
            }

            for (int i = 0; i < path.Count - 1; i++)
            {
                float d = path[i + 1].Distance(path[i]);
                if (distance == d)
                    return path[i + 1];
                else if (distance < d)
                    return path[i] + distance * (path[i + 1] - path[i]).Normalized();
                else distance -= d;
            }

            return path.Last();
        }
开发者ID:ShineSharp,项目名称:LeagueSharp,代码行数:52,代码来源:Prediction.cs

示例2: GetDashingPrediction

        /// <summary>
        /// Gets Prediction result while unit is dashing
        /// </summary>
        /// <param name="target">Target for spell</param>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="collisionable">Spell collisionable</param>
        /// <param name="type">Spell skillshot type</param>
        /// <param name="from">Spell casted position</param>
        /// <returns></returns>
        internal static Result GetDashingPrediction(Obj_AI_Base target, float width, float delay, float missileSpeed, float range, bool collisionable, SkillshotType type, Vector2 from)
        {
            Result result = new Result();

            if (target.IsDashing())
            {
                var dashInfo = target.GetDashInfo();
                if (dashInfo.IsBlink)
                {
                    result.HitChance = HitChance.Impossible;
                    return result;
                }

                //define hitboxes
                var dashHitBox = ClipperWrapper.MakePaths(ClipperWrapper.DefineRectangle(dashInfo.StartPos, dashInfo.EndPos + (dashInfo.EndPos - dashInfo.StartPos).Normalized() * 500, target.BoundingRadius * 2));
                var myHitBox = ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(from, from == ObjectManager.Player.ServerPosition.To2D() ? ObjectManager.Player.BoundingRadius : width));

                if (ClipperWrapper.IsIntersects(myHitBox, dashHitBox))
                {
                    result.HitChance = HitChance.Dashing;
                    result.CastPosition = target.ServerPosition.To2D();
                    result.UnitPosition = result.CastPosition;
                    result.CollisionResult = Collision.GetCollisions(from, result.CastPosition, width, delay, missileSpeed);

                    //check collisions
                    if (collisionable && result.CollisionResult.Objects.HasFlag(Collision.Flags.Minions))
                        result.HitChance = HitChance.Collision;

                    return result;
                }

                result.CastPosition = GetFastUnitPosition(target, dashInfo.Path, delay, missileSpeed, from, dashInfo.Speed);
                result.HitChance = HitChance.Dashing;

                //check range
                if (result.CastPosition.Distance(from) > range)
                    result.HitChance = HitChance.OutOfRange;

                //check collisions
                if (collisionable && (result.CollisionResult.Objects.HasFlag(Collision.Flags.Minions) || result.CollisionResult.Objects.HasFlag(Collision.Flags.YasuoWall)))
                    result.HitChance = HitChance.Collision;
            }
            else
                result.HitChance = HitChance.Impossible;
            return result;
        }
开发者ID:MrWenzoxfs,项目名称:elobuddy,代码行数:58,代码来源:Prediction.cs

示例3: GetFastUnitPosition

        /// <summary>
        /// Gets fast-predicted unit position
        /// </summary>
        /// <param name="target">Target</param>
        /// <param name="path">Path</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="moveSpeed">Move speed</param>
        /// <param name="distanceSet"></param>
        /// <returns></returns>
        public static Vector2 GetFastUnitPosition(Obj_AI_Base target, List<Vector2> path, float delay, float missileSpeed = 0, Vector2? from = null, float moveSpeed = 0, float distanceSet = 0)
        {
            if (from == null)
                from = target.ServerPosition.To2D();

            if (moveSpeed == 0)
                moveSpeed = target.MoveSpeed;

            if (path.Count <= 1 || (target is Obj_AI_Hero && ((Obj_AI_Hero)target).IsChannelingImportantSpell()) || Utility.IsImmobileTarget(target))
                return target.ServerPosition.To2D();

            if (target.IsDashing())
                return target.GetDashInfo().Path.Last();

            float distance = distanceSet;

            if (distance == 0)
            {
                float targetDistance = from.Value.Distance(target.ServerPosition);
                float flyTime = 0f;

                if (missileSpeed != 0) //skillshot with a missile
                {
                    Vector2 Vt = (path[path.Count - 1] - path[0]).Normalized() * moveSpeed;
                    Vector2 Vs = (target.ServerPosition.To2D() - from.Value).Normalized() * missileSpeed;
                    Vector2 Vr = Vs - Vt;

                    flyTime = targetDistance / Vr.Length();

                    if (path.Count > 5) //complicated movement
                        flyTime = targetDistance / missileSpeed;
                }

                float t = flyTime + delay + Game.Ping / 2000f + SpellDelay / 1000f;
                distance = t * moveSpeed;
            }

            for (int i = 0; i < path.Count - 1; i++)
            {
                float d = path[i + 1].Distance(path[i]);
                if (distance == d)
                    return path[i + 1];
                else if (distance < d)
                    return path[i] + distance * (path[i + 1] - path[i]).Normalized();
                else distance -= d;
            }

            return path.Last();
        }
开发者ID:MrWenzoxfs,项目名称:elobuddy,代码行数:60,代码来源:Prediction.cs

示例4: Obj_AI_Base_OnProcessSpellCast2

        private static void Obj_AI_Base_OnProcessSpellCast2(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (sender == null || !Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Harass))
            {
               return;
            }
            CurrentTarget = TargetSelector.GetTarget(Q.Range, DamageType.Magical);
            if (!sender.IsFacing(Player.Instance) && sender == CurrentTarget && !sender.IsDashing() && sender.Type == GameObjectType.AIHeroClient && sender.IsValidTarget(Q.Range) && Q.IsReady() && sender.IsEnemy)
            {

                {
                    Q.Cast(sender);
                }

            }
        }
开发者ID:FireBuddy,项目名称:karthus,代码行数:16,代码来源:Program.cs

示例5: GetPrediction

 public static Vector3 GetPrediction(Vector3 from, Obj_AI_Base target, Spells spell)
 {
     Vector3 chuot = Prediction.GetPrediction(target, 1).CastPosition;
     float dis = from.Distance(target.Position);
     float rad = target.BoundingRadius + spell.radius - 50;
     double x = math.t(target.MoveSpeed, spell.speed, dis, spell.delay + Game.Ping / 2 / 1000, rad, from, target.Position, chuot);
     if (x != 0 && !target.IsDashing()) { return target.Position.Extend(chuot, (float)x * target.MoveSpeed - rad); }
     else return target.Position;
 }
开发者ID:uio25371555,项目名称:Leaguesharp-3,代码行数:9,代码来源:Predictioncs.cs

示例6: QLogic

        //------------------------------------|| Extension ||--------------------------------------

        //----------------------------------------QLogic()-----------------------------------------

        void QLogic(Obj_AI_Base Target)
        {
            if (Target.IsDashing()) Q.Cast(Target);
            if (Target.HealthPercent <= 30) Q.Cast(Target);
            if (Player.HealthPercent <= 30) Q.Cast(Target);
            if (DamageUtil.GetSpellDamage(Target, SpellSlot.Q) >= Target.Health) Q.Cast(Target);
        }
开发者ID:himrengod,项目名称:Elobuddy-1,代码行数:11,代码来源:MasterYi.cs

示例7: GetPrediction

        /// <summary>
        /// Gets Prediction result
        /// </summary>
        /// <param name="target">Target for spell</param>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="collisionable">Spell collisionable</param>
        /// <param name="type">Spell skillshot type</param>
        /// <param name="path">Waypoints of target</param>
        /// <param name="avgt">Average reaction time (in ms)</param>
        /// <param name="movt">Passed time from last movement change (in ms)</param>
        /// <param name="avgp">Average Path Lenght</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
        public static Prediction.Result GetPrediction(Obj_AI_Base target, float width, float delay, float missileSpeed, float range, bool collisionable, List<Vector2> path, float avgt, float movt, float avgp, float anglediff, Vector2 from, Vector2 rangeCheckFrom, bool arconly = true)
        {
            Prediction.AssertInitializationMode();

            if (arconly)
            {
                if (target.Distance(from) < width)
                    return CirclePrediction.GetPrediction(target, width, delay, missileSpeed, range, collisionable, path, avgt, movt, avgp, anglediff, from, rangeCheckFrom);

                var pred = LinePrediction.GetPrediction(target, 80f, delay, missileSpeed, range, collisionable, path, avgt, movt, avgp, anglediff, from, rangeCheckFrom);
                if (pred.HitChance >= HitChance.Low)
                {
                    pred.CastPosition = (from + (pred.CastPosition - from).Normalized() * range)/*.RotateAroundPoint(from, (1 - pred.UnitPosition.Distance(ObjectManager.Player.ServerPosition.To2D()) / 820f) * (float)Math.PI / 2f)*/;
                    float cos = (float)Math.Cos((1 - pred.UnitPosition.Distance(from) / 820f) * Math.PI / 2);
                    float sin = (float)Math.Sin((1 - pred.UnitPosition.Distance(from) / 820f) * Math.PI / 2);
                    float x = cos * (pred.CastPosition.X - from.X) - sin * (pred.CastPosition.Y - from.Y) + from.X;
                    float y = sin * (pred.CastPosition.X - from.X) + cos * (pred.CastPosition.Y - from.Y) + from.Y;
                    pred.CastPosition = new Vector2(x, y);
                }

                return pred;
            }
            else
            {
                Prediction.Result result = new Prediction.Result();

                if (path.Count <= 1) //if target is not moving, easy to hit
                {
                    result.HitChance = HitChance.Immobile;
                    result.CastPosition = target.ServerPosition.To2D();
                    result.UnitPosition = result.CastPosition;
                    return result;
                }

                if (target is Obj_AI_Hero && ((Obj_AI_Hero)target).IsChannelingImportantSpell())
                {
                    result.HitChance = HitChance.Immobile;
                    result.CastPosition = target.ServerPosition.To2D();
                    result.UnitPosition = result.CastPosition;
                    return result;
                }

                if (Utility.IsImmobileTarget(target))
                    return Prediction.GetImmobilePrediction(target, width, delay, missileSpeed, range, collisionable, SkillshotType.SkillshotCircle, from, rangeCheckFrom);

                if (target.IsDashing())
                    return Prediction.GetDashingPrediction(target, width, delay, missileSpeed, range, collisionable, SkillshotType.SkillshotCircle, from, rangeCheckFrom);

                float targetDistance = rangeCheckFrom.Distance(target.ServerPosition);
                float flyTime = 0f;

                if (missileSpeed != 0)
                {
                    Vector2 Vt = (path[path.Count - 1] - path[0]).Normalized() * target.MoveSpeed;
                    Vector2 Vs = (target.ServerPosition.To2D() - rangeCheckFrom).Normalized() * missileSpeed;
                    Vector2 Vr = Vs - Vt;

                    flyTime = targetDistance / Vr.Length();

                    if (path.Count > 5)
                        flyTime = targetDistance / missileSpeed;
                }

                float t = flyTime + delay + Game.Ping / 2000f + ConfigMenu.SpellDelay / 1000f;

                result.HitChance = Prediction.GetHitChance(t * 1000f, avgt, movt, avgp, anglediff);

                #region arc collision test
                if (result.HitChance > HitChance.Low)
                {
                    for (int i = 1; i < path.Count; i++)
                    {
                        Vector2 senderPos = rangeCheckFrom;
                        Vector2 testPos = path[i];

                        float multp = (testPos.Distance(senderPos) / 875.0f);

                        var dianaArc = new SPrediction.Geometry.Polygon(
                                        ClipperWrapper.DefineArc(senderPos - new Vector2(875 / 2f, 20), testPos, (float)Math.PI * multp, 410, 200 * multp),
                                        ClipperWrapper.DefineArc(senderPos - new Vector2(875 / 2f, 20), testPos, (float)Math.PI * multp, 410, 320 * multp));

                        if (!ClipperWrapper.IsOutside(dianaArc, target.ServerPosition.To2D()))
                        {
//.........这里部分代码省略.........
开发者ID:superjo1508,项目名称:LeagueRepo,代码行数:101,代码来源:ArcPrediction.cs

示例8: GetPredictionMethod2

        /// <summary>
        /// beta
        /// </summary>
        /// <param name="target"></param>
        /// <param name="s"></param>
        /// <param name="path"></param>
        /// <param name="avgt"></param>
        /// <param name="avgp"></param>
        /// <param name="movt"></param>
        /// <param name="hc"></param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns></returns>
        public static Vector2 GetPredictionMethod2(Obj_AI_Base target, Spell s, List<Vector2> path, float avgt, float movt, float avgp, out HitChance hc, Vector3 rangeCheckFrom)
        {
            try
            {
                if (!blInitialized)
                    throw new InvalidOperationException("Prediction is not initalized");

                //to do: hook logic ? by storing average movement direction etc
                if (path.Count <= 1) //if target is not moving, easy to hit
                {
                    hc = HitChance.VeryHigh;
                    return target.ServerPosition.To2D();
                }

                if (target is Obj_AI_Hero)
                {
                    if (((Obj_AI_Hero)target).IsChannelingImportantSpell())
                    {
                        hc = HitChance.VeryHigh;
                        return target.ServerPosition.To2D();
                    }

                    //to do: find a fuking logic
                    if (avgp < 400 && movt < 100)
                    {
                        hc = HitChance.High;
                        return target.ServerPosition.To2D();
                    }
                }

                if (IsImmobileTarget(target))
                    return GetImmobilePrediction(target, s, out hc, rangeCheckFrom);

                if (target.IsDashing())
                    return GetDashingPrediction(target, s, out hc, rangeCheckFrom);

                float targetDistance = rangeCheckFrom.Distance(target.ServerPosition);
                float flyTimeMin = 0f;
                float flyTimeMax = 0f;

                if (s.Speed != 0) //skillshot with a missile
                {
                    flyTimeMin = targetDistance / s.Speed;
                    flyTimeMax = s.Range / s.Speed;
                }

                //PATCH WARNING
                float tMin = 0f + s.Delay + Game.Ping / 2000f + SpellDelay / 1000f; //0f => flyTimeMin
                float tMax = flyTimeMax + s.Delay + Game.Ping / 1000f + SpellDelay / 1000f;
                float pathTime = 0f;
                int[] x = new int[] { -1, -1 };

                for (int i = 0; i < path.Count - 1; i++)
                {
                    float t = path[i + 1].Distance(path[i]) / target.MoveSpeed;

                    if (pathTime <= tMin && pathTime + t >= tMin)
                        x[0] = i;
                    if (pathTime <= tMax && pathTime + t >= tMax)
                        x[1] = i;

                    if (x[0] != -1 && x[1] != -1)
                        break;

                    pathTime += t;
                }

                //PATCH WARNING
                if (x[0] != -1 && x[1] != -1)
                {
                    for (int k = x[0]; k <= x[1]; k++)
                    {
                        Vector2 direction = (path[k + 1] - path[k]).Normalized();
                        float distance = s.Width;
                        int steps = (int)Math.Floor(path[k].Distance(path[k + 1]) / distance);
                        for (int i = 0; i < steps; i++)
                        {
                            Vector2 pA = path[k] + (direction * distance * i);
                            Vector2 pB = path[k] + (direction * distance * (i + 1));
                            Vector2 center = (pA + pB) / 2f;

                            float flytime = s.Speed != 0 ? rangeCheckFrom.To2D().Distance(center) / s.Speed : 0f;
                            float t = flytime + s.Delay + Game.Ping / 2000f + SpellDelay / 1000f;

                            float arriveTimeA = target.ServerPosition.To2D().Distance(pA) / target.MoveSpeed;
                            float arriveTimeB = target.ServerPosition.To2D().Distance(pB) / target.MoveSpeed;

                            if (Math.Min(arriveTimeA, arriveTimeB) <= t && Math.Max(arriveTimeA, arriveTimeB) >= t)
//.........这里部分代码省略.........
开发者ID:47110572,项目名称:LeagueSharp,代码行数:101,代码来源:Prediction.cs

示例9: GetPrediction

        /// <summary>
        /// Gets Prediction result
        /// </summary>
        /// <param name="target">Target for spell</param>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="collisionable">Spell collisionable</param>
        /// <param name="type">Spell skillshot type</param>
        /// <param name="path">Waypoints of target</param>
        /// <param name="avgt">Average reaction time (in ms)</param>
        /// <param name="movt">Passed time from last movement change (in ms)</param>
        /// <param name="avgp">Average Path Lenght</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
        internal static Result GetPrediction(Obj_AI_Base target, float width, float delay, float missileSpeed, float range, bool collisionable, SkillshotType type, List<Vector2> path, float avgt, float movt, float avgp, float anglediff, Vector2 from, Vector2 rangeCheckFrom)
        {
            Prediction.AssertInitializationMode();

            Result result = new Result();
            result.Input = new Input(target, delay, missileSpeed, width, range, collisionable, type, from.To3D2(), rangeCheckFrom.To3D2());
            result.Unit = target;

            try
            {
                if (type == SkillshotType.SkillshotCircle)
                    range += width;

                //to do: hook logic ? by storing average movement direction etc
                if (path.Count <= 1 && movt > 100 && (Environment.TickCount - PathTracker.EnemyInfo[target.NetworkId].LastAATick > 300 || !ConfigMenu.CheckAAWindUp)) //if target is not moving, easy to hit (and not aaing)
                {
                    result.HitChance = HitChance.VeryHigh;
                    result.CastPosition = target.ServerPosition.To2D();
                    result.UnitPosition = result.CastPosition;
                    result.Lock();

                    return result;
                }

                if (target is Obj_AI_Hero)
                {
                    if (((Obj_AI_Hero)target).IsChannelingImportantSpell())
                    {
                        result.HitChance = HitChance.VeryHigh;
                        result.CastPosition = target.ServerPosition.To2D();
                        result.UnitPosition = result.CastPosition;
                        result.Lock();

                        return result;
                    }

                    if (Environment.TickCount - PathTracker.EnemyInfo[target.NetworkId].LastAATick < 300 && ConfigMenu.CheckAAWindUp)
                    {
                        if (target.AttackCastDelay * 1000 + PathTracker.EnemyInfo[target.NetworkId].AvgOrbwalkTime + avgt - width / 2f / target.MoveSpeed >= GetArrivalTime(target.ServerPosition.To2D().Distance(from), delay, missileSpeed))
                        {
                            result.HitChance = HitChance.High;
                            result.CastPosition = target.ServerPosition.To2D();
                            result.UnitPosition = result.CastPosition;
                            result.Lock();

                            return result;
                        }
                    }

                    //to do: find a fuking logic
                    if (avgp < 400 && movt < 100 && path.PathLength() <= avgp)
                    {
                        result.HitChance = HitChance.High;
                        result.CastPosition = path.Last();
                        result.UnitPosition = result.CastPosition;
                        result.Lock();

                        return result;
                    }
                }

                if (target.IsDashing()) //if unit is dashing
                    return GetDashingPrediction(target, width, delay, missileSpeed, range, collisionable, type, from, rangeCheckFrom);

                if (Utility.IsImmobileTarget(target)) //if unit is immobile
                    return GetImmobilePrediction(target, width, delay, missileSpeed, range, collisionable, type, from, rangeCheckFrom);

                result = WaypointAnlysis(target, width, delay, missileSpeed, range, collisionable, type, path, avgt, movt, avgp, anglediff, from);

                float d = result.CastPosition.Distance(target.ServerPosition.To2D());
                if (d >= (avgt - movt) * target.MoveSpeed && d >= avgp)
                    result.HitChance = HitChance.Medium;

                result.Lock();

                return result;
            }
            finally
            {
                //check if movement changed while prediction calculations
                if (!target.GetWaypoints().SequenceEqual(path))
                    result.HitChance = HitChance.Medium;
            }
//.........这里部分代码省略.........
开发者ID:ShineSharp,项目名称:LeagueSharp,代码行数:101,代码来源:Prediction.cs

示例10: Obj_AI_Base_OnProcessSpellCast2

        private static void Obj_AI_Base_OnProcessSpellCast2(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            //|| (CurrentTarget.Hero == Champion.Yasuo && sender.Mana >= 90)
            CurrentTarget = TargetSelector.GetTarget(W.Range + 500, DamageType.Magical);
            if (sender == null || !Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Harass) || (CurrentTarget.Hero == Champion.Yasuo && sender.Mana >= 90))
            {
               return;
            }
            if (W.IsReady() && !sender.IsInvulnerable && args.Target != CurrentTarget && !sender.IsDashing() && sender == CurrentTarget)
            {

                if (args.End.Distance(Player.Instance.Position) >= 100 || args.SData.TargettingType == SpellDataTargetType.Unit)
                {
                    if (HarassMenu[args.SData.Name].Cast<CheckBox>().CurrentValue)
                    {
                        if (sender.IsValidTarget(900) && !LaneClearMenu[args.SData.Name].Cast<CheckBox>().CurrentValue)
                        {
                            //Chat.Print("Pos Cast:"+args.SData.Name);
                            W.Cast(sender.ServerPosition);
                        }
                        else if (args.End.Distance(Player.Instance.Position) <= 900 && LaneClearMenu[args.SData.Name].Cast<CheckBox>().CurrentValue)
                        {
                            //Chat.Print("End Cast:"+args.SData.Name);
                            W.Cast(args.End);
                        }
                    }

                }

            }
        }
开发者ID:FireBuddy,项目名称:kappa-s-aio,代码行数:31,代码来源:Brand.cs

示例11: GetDashingPrediction

        /// <summary>
        /// Gets Prediction result while unit is dashing
        /// </summary>
        /// <param name="target">Target for spell</param>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="collisionable">Spell collisionable</param>
        /// <param name="type">Spell skillshot type</param>
        /// <param name="from">Spell casted position</param>
        /// <returns></returns>
        internal static Result GetDashingPrediction(Obj_AI_Base target, float width, float delay, float missileSpeed, float range, bool collisionable, SkillshotType type, Vector2 from, Vector2 rangeCheckFrom)
        {
            Result result = new Result();
            result.Input = new Input(target, delay, missileSpeed, width, range, collisionable, type, from.To3D2(), rangeCheckFrom.To3D2());
            result.Unit = target;

            if (target.IsDashing())
            {
                var dashInfo = target.GetDashInfo();
                if (dashInfo.IsBlink)
                {
                    result.HitChance = HitChance.Impossible;
                    result.CastPosition = dashInfo.EndPos;
                    return result;
                }

                result.CastPosition = GetFastUnitPosition(target, dashInfo.Path, delay, missileSpeed, from, dashInfo.Speed);
                result.HitChance = HitChance.Dashing;

                result.Lock(false);
            }
            else
            {
                result = GetPrediction(target, width, delay, missileSpeed, range, collisionable, type, target.GetWaypoints(), 0, 0, 0, 0, from, rangeCheckFrom);
                result.Lock(false);
            }
            return result;
        }
开发者ID:ShineSharp,项目名称:LeagueSharp,代码行数:40,代码来源:Prediction.cs

示例12: Obj_AI_Base_OnBasicAttack

        private static void Obj_AI_Base_OnBasicAttack(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            CurrentTarget = TargetSelector.GetTarget(W.Range, DamageType.Magical);
            //(CurrentTarget.Hero != Champion.Yasuo && sender.Mana <= 90)//
            if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Harass) && sender == CurrentTarget && !sender.IsDashing() && sender.Type == GameObjectType.AIHeroClient && sender.IsValidTarget(W.Range) && W.IsReady() && sender.IsEnemy)
            {

                    if (CurrentTarget.Hero != Champion.Yasuo)
                    {
                    W.Cast(sender.ServerPosition);
                    //Chat.Print("Basic Attack:"+args.SData.Name);
                    }
                    else if (sender.Mana <= 90)
                    {
                    W.Cast(sender.ServerPosition);
                    }

            }
            if (sender.brandpassive() && Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Harass) && sender == CurrentTarget && !sender.IsDashing() && sender.Type == GameObjectType.AIHeroClient && sender.IsValidTarget(Q.Range) && Q.IsReady() && sender.IsEnemy)
            {

                    if (CurrentTarget.Hero != Champion.Yasuo && Q.GetPrediction(sender).HitChance >= HitChance.Medium)
                    {
                      Q.Cast(sender.ServerPosition);
                    //Chat.Print("Basic Attack:"+args.SData.Name);
                    }
                    else if (sender.Mana <= 90 && Q.GetPrediction(sender).HitChance >= HitChance.Medium)
                    {
                      Q.Cast(sender.ServerPosition);
                    }

            }
        }
开发者ID:FireBuddy,项目名称:kappa-s-aio,代码行数:33,代码来源:Brand.cs

示例13: GetPrediction

        /// <summary>
        /// Gets Prediction result
        /// </summary>
        /// <param name="target">Target for spell</param>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="collisionable">Spell collisionable</param>
        /// <param name="type">Spell skillshot type</param>
        /// <param name="path">Waypoints of target</param>
        /// <param name="avgt">Average reaction time (in ms)</param>
        /// <param name="movt">Passed time from last movement change (in ms)</param>
        /// <param name="avgp">Average Path Lenght</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
        public static Prediction.Result GetPrediction(Obj_AI_Base target, float width, float delay, float missileSpeed, float range, bool collisionable, List<Vector2> path, float avgt, float movt, float avgp, float anglediff, Vector2 from, Vector2 rangeCheckFrom)
        {
            Prediction.AssertInitializationMode();

            Prediction.Result result = new Prediction.Result();

            if (path.Count <= 1) //if target is not moving, easy to hit
            {
                result.HitChance = HitChance.Immobile;
                result.CastPosition = target.ServerPosition.To2D();
                result.UnitPosition = result.CastPosition;
                return result;
            }

            if (target is Obj_AI_Hero && ((Obj_AI_Hero)target).IsChannelingImportantSpell())
            {
                result.HitChance = HitChance.Immobile;
                result.CastPosition = target.ServerPosition.To2D();
                result.UnitPosition = result.CastPosition;
                return result;
            }

            if (Utility.IsImmobileTarget(target))
                return Prediction.GetImmobilePrediction(target, width, delay, missileSpeed, range, collisionable, SkillshotType.SkillshotCircle, from);

            if (target.IsDashing())
                return Prediction.GetDashingPrediction(target, width, delay, missileSpeed, range, collisionable, SkillshotType.SkillshotCircle, from);

            float targetDistance = rangeCheckFrom.Distance(target.ServerPosition);
            float flyTime = 0f;

            if (missileSpeed != 0)
            {
                Vector2 Vt = (path[path.Count - 1] - path[0]).Normalized() * target.MoveSpeed;
                Vector2 Vs = (target.ServerPosition.To2D() - rangeCheckFrom).Normalized() * missileSpeed;
                Vector2 Vr = Vs - Vt;

                flyTime = targetDistance / Vr.Length();

                if (path.Count > 5)
                    flyTime = targetDistance / missileSpeed;
            }

            float t = flyTime + delay + Game.Ping / 2000f + Prediction.SpellDelay / 1000f;

            result.HitChance = Prediction.GetHitChance(t * 1000f, avgt, movt, avgp, anglediff);

            #region arc collision test
            if (result.HitChance > HitChance.Low)
            {
                for (int i = 1; i < path.Count; i++)
                {
                    Vector2 senderPos = rangeCheckFrom;
                    Vector2 testPos = path[i];

                    float multp = (testPos.Distance(senderPos) / 875.0f);

                    var dianaArc = new SCommon.Maths.Geometry.Polygon(
                                    ClipperWrapper.DefineArc(senderPos - new Vector2(875 / 2f, 20), testPos, (float)Math.PI * multp, 410, 200 * multp),
                                    ClipperWrapper.DefineArc(senderPos - new Vector2(875 / 2f, 20), testPos, (float)Math.PI * multp, 410, 320 * multp));

                    if (!ClipperWrapper.IsOutside(dianaArc, target.ServerPosition.To2D()))
                    {
                        result.HitChance = HitChance.VeryHigh;
                        result.CastPosition = testPos;
                        result.UnitPosition = testPos;
                        return result;
                    }
                }
            }
            #endregion

            return CirclePrediction.GetPrediction(target, width, delay, missileSpeed, range, collisionable, path, avgt, movt, avgp, anglediff, from, rangeCheckFrom);
        }
开发者ID:JelloBeans,项目名称:SAC,代码行数:91,代码来源:ArcPrediction.cs

示例14: GetBadaoPrediction

        public static PredictionOutput GetBadaoPrediction(this Spell spell, Obj_AI_Base target, bool collideyasuowall = true)
        {
            PredictionOutput result = null;

            if (!target.IsValidTarget(float.MaxValue, false))
            {
                return new PredictionOutput();
            }
            if (target.IsDashing())
            {
                var dashDtata = target.GetDashInfo();
                result = spell.GetBadaoStandarPrediction(target,
                    new List<Vector2>() { target.ServerPosition.ToVector2(), dashDtata.Path.Last() }, dashDtata.Speed);
                if (result.Hitchance >= HitChance.High)
                    result.Hitchance = HitChance.Dashing;
            }
            else
            {
                //Unit is immobile.
                var remainingImmobileT = UnitIsImmobileUntil(target);
                if (remainingImmobileT >= 0d)
                {
                    var timeToReachTargetPosition = spell.Delay + target.Position.ToVector2().Distance(spell.From.ToVector2()) / spell.Speed;
                    if (spell.RangeCheckFrom.ToVector2().Distance(target.Position.ToVector2()) <= spell.Range)
                    {
                        if (timeToReachTargetPosition <=
                            remainingImmobileT + (target.BoundingRadius + spell.Width - 40) / target.MoveSpeed)
                        {
                            result = new PredictionOutput
                            {
                                CastPosition = target.ServerPosition,
                                UnitPosition = target.ServerPosition,
                                Hitchance = HitChance.Immobile
                            };
                        }

                        else result = new PredictionOutput
                        {
                            CastPosition = target.ServerPosition,
                            UnitPosition = target.ServerPosition,
                            Hitchance = HitChance.High
                            /*timeToReachTargetPosition - remainingImmobileT + input.RealRadius / input.Unit.MoveSpeed < 0.4d ? HitChance.High : HitChance.Medium*/
                        };
                    }
                    else
                    {
                        result = new PredictionOutput();
                    }
                }
            }
            //Normal prediction
            if (result == null)
            {
                result = spell.GetBadaoStandarPrediction(target, target.GetWaypoints());
            }
            //Check for collision
            if (spell.Collision)
            {
                var positions = new List<Vector3> { result.UnitPosition, result.CastPosition, target.Position };
                var originalUnit = target;
                result.CollisionObjects = spell.GetCollision(positions);
                result.CollisionObjects.RemoveAll(x => x.NetworkId == originalUnit.NetworkId);
                result.Hitchance = result.CollisionObjects.Count > 0 ? HitChance.Collision : result.Hitchance;
            }
            //Check yasuo wall collision
            else if (collideyasuowall)
            {
                var positions = new List<Vector3> { result.UnitPosition, result.CastPosition, target.Position };
                var originalUnit = target;
                result.CollisionObjects = spell.GetCollision(positions);
                result.CollisionObjects.Any(x => x.NetworkId == ObjectManager.Player.NetworkId);
                result.Hitchance = result.CollisionObjects.Any(x => x.NetworkId == ObjectManager.Player.NetworkId) ? HitChance.Collision : result.Hitchance;
            }
            return result;
        }
开发者ID:badao,项目名称:BadaoAIO,代码行数:75,代码来源:BadaoPrediction.cs

示例15: GetArcPrediction

        /// <summary>
        /// Gets Predicted position for arc
        /// </summary>
        /// <param name="target">Target for spell</param>
        /// <param name="s">Spell to cast</param>
        /// <param name="avgt">Average reaction time (in ms)</param>
        /// <param name="avgp">Average Path Lenght</param>
        /// <param name="movt">Passed time from last movement change (in ms)</param>
        /// <param name="hc">Predicted HitChance</param>
        /// <param name="rangeCheckFrom">Position where spell will be casted from</param>
        /// <returns>Predicted position and HitChance out value</returns>
        public static Vector2 GetArcPrediction(Obj_AI_Base target, Spell s, List<Vector2> path, float avgt, float movt, float avgp, out HitChance hc, Vector3 rangeCheckFrom)
        {
            if (!blInitialized)
                throw new InvalidOperationException("Prediction is not initalized");

            if (path.Count <= 1) //if target is not moving, easy to hit
            {
                hc = HitChance.Immobile;
                return target.ServerPosition.To2D();
            }

            if (target is Obj_AI_Hero && ((Obj_AI_Hero)target).IsChannelingImportantSpell())
            {
                hc = HitChance.VeryHigh;
                return target.ServerPosition.To2D();
            }

            if (IsImmobileTarget(target))
                return GetImmobilePrediction(target, s, out hc, rangeCheckFrom);

            if (target.IsDashing())
                return GetDashingPrediction(target, s, out hc, rangeCheckFrom);

            float targetDistance = rangeCheckFrom.Distance(target.ServerPosition);
            float flyTime = 0f;

            if (s.Speed != 0)
            {
                Vector2 Vt = (path[path.Count - 1] - path[0]).Normalized() * target.MoveSpeed;
                Vector2 Vs = (target.ServerPosition.To2D() - rangeCheckFrom.To2D()).Normalized() * s.Speed;
                Vector2 Vr = Vs - Vt;

                flyTime = targetDistance / Vr.Length();

                if (path.Count > 5)
                    flyTime = targetDistance / s.Speed;
            }

            float t = flyTime + s.Delay + Game.Ping / 1000f + SpellDelay / 1000f;
            float distance = t * target.MoveSpeed;

            hc = GetHitChance(t * 1000f, avgt, movt, avgp);

            #region arc collision test
            for (int i = 1; i < path.Count; i++)
            {
                Vector2 senderPos = rangeCheckFrom.To2D();
                Vector2 testPos = path[i];

                float multp = (testPos.Distance(senderPos) / 875.0f);

                var dianaArc = new SPrediction.Geometry.Polygon(
                                ClipperWrapper.DefineArc(senderPos - new Vector2(875 / 2f, 20), testPos, (float)Math.PI * multp, 410, 200 * multp),
                                ClipperWrapper.DefineArc(senderPos - new Vector2(875 / 2f, 20), testPos, (float)Math.PI * multp, 410, 320 * multp));

                if (!ClipperWrapper.IsOutside(dianaArc, target.ServerPosition.To2D()))
                {
                    hc = HitChance.VeryHigh;
                    return testPos;
                }
            }
            #endregion

            for (int i = 0; i < path.Count - 1; i++)
            {
                float d = path[i + 1].Distance(path[i]);
                if (distance == d)
                    return path[i + 1];
                else if (distance < d)
                    return path[i] + distance * (path[i + 1] - path[i]).Normalized();
                else distance -= d;
            }

            if (s.Type != SkillshotType.SkillshotCircle)
                hc = HitChance.Impossible;

            return path[path.Count - 1];
        }
开发者ID:47110572,项目名称:LeagueSharp,代码行数:89,代码来源:Prediction.cs


注:本文中的Obj_AI_Base.IsDashing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。