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


C# Polygon.Rectangle类代码示例

本文整理汇总了C#中LeagueSharp.Common.Geometry.Polygon.Rectangle的典型用法代码示例。如果您正苦于以下问题:C# Geometry.Polygon.Rectangle类的具体用法?C# Geometry.Polygon.Rectangle怎么用?C# Geometry.Polygon.Rectangle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Geometry.Polygon.Rectangle类属于LeagueSharp.Common命名空间,在下文中一共展示了Geometry.Polygon.Rectangle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AutoUlti

        public static void AutoUlti()
        {
            // Hoes code below
            if (GetBool("wardinsec", typeof(KeyBind))) return;

            var target =
                HeroManager.Enemies.Where(x => x.Distance(Player) < R.Range && !x.IsDead && x.IsValidTarget(R.Range))
                    .OrderBy(x => x.Distance(Player)).FirstOrDefault();
            if (target == null || Player.IsDead)
            {
                UltPoly = null;
                _ultPolyExpectedPos = null;
                return;
            }

            UltPoly = new Geometry.Polygon.Rectangle(Player.ServerPosition,
                Player.ServerPosition.Extend(target.Position, 1100),
                target.BoundingRadius + 10);

            var counts =
                HeroManager.Enemies.Where(x => x.Distance(Player) < 1100 && x.IsValidTarget(1100))
                    .Count(h => h.NetworkId != target.NetworkId && UltPoly.IsInside(h.ServerPosition));

            if (counts >= GetValue("autoron") && R.IsReady())
            {
                R.Cast(target);
            }
        }
开发者ID:Faqer,项目名称:LeagueSharp-3,代码行数:28,代码来源:AutoUlt.cs

示例2: GetPredictedHealth

        /// <summary>
        ///     Gets the predicted health of a unit.
        /// </summary>
        /// <param name="target">Target</param>
        /// <param name="time">Time in miliseconds</param>
        /// <returns>Predicted Health.</returns>
        public static float GetPredictedHealth(Obj_AI_Base target, float time)
        {
            var health = target.Health;

            foreach (var missile in Missiles)
            {
                var missileArriveTime = 1000 * missile.Position.Distance(target.ServerPosition) / missile.SData.MissileSpeed;
                var missileRectangle = new Geometry.Polygon.Rectangle(missile.StartPosition, missile.EndPosition, missile.SData.LineWidth);

                if (missileRectangle.IsInside(target) && missileArriveTime >= time)
                {
                    health -= (float) missile.SpellCaster.GetSpellDamage(target, missile.SData.Name);
                }
            }

            return health;
        }
开发者ID:uio25371555,项目名称:ChewyMoonScripts,代码行数:23,代码来源:MissileHealthPrediction.cs

示例3: Drawing_OnDraw

 public static void Drawing_OnDraw(EventArgs args)
 {
     try
     {
         if (Player.IsDead) return;
         if (Program.EndPos != null)
         {
             var Range = new Geometry.Polygon.Rectangle(Program.StartPos, Program.EndPos, 150);
             Range.Draw(Color.Red);
         }
     }
     catch (Exception e)
     {
         Console.Write(e);
         Game.PrintChat("FreshTahmKench is not working. plz send message by KorFresh (Code 5)");
     }
 }
开发者ID:qq2128969,项目名称:LeagueSharp,代码行数:17,代码来源:OnDraw.cs

示例4: QMinionExtend

        public bool QMinionExtend(Obj_AI_Base minion)
        {
            var target = HeroManager.Enemies.FirstOrDefault(x => x.IsValidTarget(Spell.Range));

            if (minion == null || target == null)
            {
                return false;
            }

            var prediction = Spell.GetPrediction(target);

            if (prediction.Hitchance < HitChance.Medium)
            {
                return false;
            }

            var hit = new Geometry.Polygon.Rectangle(ObjectManager.Player.Position, ObjectManager.Player.Position.Extend(minion.Position, Spell.Range), Spell.Width);

            return !hit.IsOutside(QPred(target).To2D());
        }
开发者ID:Nechrito,项目名称:Leaguesharp,代码行数:20,代码来源:Q2Spell.cs

示例5: DrawingOnOnDraw

        private static void DrawingOnOnDraw(EventArgs args)
        {
            if (!Menu.Item("DrawSpell").IsActive())
            {
                return;
            }

            var rectangle = new Geometry.Polygon.Rectangle(new Vector3(), new Vector3(), 0);
            foreach (var missile in ObjectManager.Get<Obj_SpellMissile>().Where(x => x.SpellCaster.IsMe /*&& CastedSpellsNames.Any(y => y == x.SData.Name)*/))
            {
                var missilePosition = missile.Position.To2D();
                var unitPosition = missile.StartPosition.To2D();
                var endPos = missile.EndPosition.To2D();

                //Calculate the real end Point:
                var direction = (endPos - unitPosition).Normalized();
                if (unitPosition.Distance(endPos) > missile.SData.CastRange)
                {
                    endPos = unitPosition + direction * missile.SData.CastRange;
                }

                rectangle.Start = unitPosition;
                rectangle.End = endPos;
                rectangle.Width = missile.SData.LineWidth;

                rectangle.UpdatePolygon();
                rectangle.Draw(Color.LightYellow);

                // Draw Line
                var start = missilePosition + missile.SData.LineWidth * rectangle.Direction.Perpendicular();
                var end = missilePosition - missile.SData.LineWidth * rectangle.Direction.Perpendicular();

                Drawing.DrawLine(Drawing.WorldToScreen(start.To3D()), Drawing.WorldToScreen(end.To3D()), 3, Color.Chartreuse);
            }
        }
开发者ID:uio25371555,项目名称:ChewyMoonScripts,代码行数:35,代码来源:Program.cs

示例6: ExtendedQ

        /// <summary>
        ///     TODO The extended q.
        /// </summary>
        /// <param name="mode">
        ///     TODO The mode.
        /// </param>
        private static void ExtendedQ(Mode mode)
        {
            if (
                !MenuHelper.IsMenuEnabled(
                    "com.idzlucian." + MenuHelper.GetFullNameFromMode(mode).ToLowerInvariant() + ".useextendedq")
                || ObjectManager.Player.ManaPercent
                < MenuHelper.GetSliderValue(
                    "com.idzlucian.manamanager.qmana" + MenuHelper.GetStringFromMode(mode).ToLowerInvariant()))
            {
                return;
            }

            var target = TargetSelector.GetTarget(Spells[SpellSlot.Q].Range, TargetSelector.DamageType.Physical);
            var targetExtended = TargetSelector.GetTarget(qExtended.Range, TargetSelector.DamageType.Physical);
            if (target.IsValidTarget(Spells[SpellSlot.Q].Range) || !targetExtended.IsValidTarget(qExtended.Range)
                || (HasPassive() && Orbwalking.InAutoAttackRange(target)))
            {
                return;
            }

            var targetPrediction = qExtended.GetPrediction(targetExtended).UnitPosition.To2D();
            var minions = MinionManager.GetMinions(
                player.ServerPosition, 
                Spells[SpellSlot.Q].Range, 
                MinionTypes.All, 
                MinionTeam.NotAlly);

            if (!minions.Any() || !targetExtended.IsMoving)
            {
                return;
            }

            if (MenuHelper.IsMenuEnabled("com.idzlucian.misc.noextq." + targetExtended.ChampionName.ToLowerInvariant()) && mode == Mode.Harass)
            {
                return;
            }

            // Credits xSalice
            foreach (var minion in minions)
            {
                var polygon = new Geometry.Polygon.Rectangle(
                    player.ServerPosition, 
                    player.ServerPosition.Extend(minion.ServerPosition, qExtended.Range), 
                    qExtended.Width);

                if (polygon.IsInside(targetPrediction)
                    && Spells[SpellSlot.Q].Cast(minion) == Spell.CastStates.SuccessfullyCasted)
                {
                    Spells[SpellSlot.Q].LastCastAttemptT = Environment.TickCount;
                }
            }
        }
开发者ID:firas500,项目名称:LSharpDZiJava,代码行数:58,代码来源:iDZLucian.cs

示例7: LineFarm

        private static void LineFarm(Spell spell, List<Obj_AI_Base> minions, int min, float overrideWidth = -1f)
        {
            var spellWidth = overrideWidth > 0 ? overrideWidth : spell.Width;
            var totalHits = 0;
            var castPos = Vector3.Zero;

            var positions = (from minion in minions
                let pred = spell.GetPrediction(minion)
                where pred.Hitchance >= HitChance.Medium
                select new Tuple<Obj_AI_Base, Vector3>(minion, pred.UnitPosition)).ToList();

            if (positions.Any())
            {
                foreach (var position in positions)
                {
                    var rect = new Geometry.Polygon.Rectangle(
                        ObjectManager.Player.Position, ObjectManager.Player.Position.Extend(position.Item2, spell.Range),
                        spellWidth);
                    var count =
                        positions.Select(
                            position2 =>
                                new Geometry.Polygon.Circle(position2.Item2, position2.Item1.BoundingRadius * 0.9f))
                            .Count(circle => circle.Points.Any(p => rect.IsInside(p)));
                    if (count > totalHits)
                    {
                        totalHits = count;
                        castPos = position.Item2;
                    }
                    if (totalHits == minions.Count)
                    {
                        break;
                    }
                }
                if (!castPos.Equals(Vector3.Zero) && totalHits >= min)
                {
                    spell.Cast(castPos);
                }
            }
        }
开发者ID:4859aa,项目名称:LeagueSharp-Dev,代码行数:39,代码来源:Casting.cs

示例8: ELogic

        private bool ELogic(Obj_AI_Hero mainTarget, List<Obj_AI_Base> targets, HitChance hitChance, int minHits)
        {
            try
            {
                var input = new PredictionInput
                {
                    Range = ELength,
                    Delay = E.Delay,
                    Radius = E.Width,
                    Speed = E.Speed,
                    Type = E.Type
                };
                var input2 = new PredictionInput
                {
                    Range = E.Range + ELength,
                    Delay = E.Delay,
                    Radius = E.Width,
                    Speed = E.Speed,
                    Type = E.Type
                };
                var startPos = Vector3.Zero;
                var endPos = Vector3.Zero;
                var hits = 0;
                targets = targets.Where(t => t.IsValidTarget(E.Range + ELength + E.Width * 1.1f)).ToList();
                var targetCount = targets.Count;

                foreach (var target in targets)
                {
                    bool containsTarget;
                    var lTarget = target;
                    if (target.Distance(Player.Position) <= E.Range)
                    {
                        containsTarget = mainTarget == null || lTarget.NetworkId == mainTarget.NetworkId;
                        var cCastPos = target.Position;
                        foreach (var t in targets.Where(t => t.NetworkId != lTarget.NetworkId))
                        {
                            var count = 1;
                            var cTarget = t;
                            input.Unit = t;
                            input.From = cCastPos;
                            input.RangeCheckFrom = cCastPos;
                            var pred = Prediction.GetPrediction(input);
                            if (pred.Hitchance >= (hitChance - 1))
                            {
                                count++;
                                if (!containsTarget)
                                {
                                    containsTarget = t.NetworkId == mainTarget.NetworkId;
                                }
                                var rect = new Geometry.Polygon.Rectangle(
                                    cCastPos.To2D(), cCastPos.Extend(pred.CastPosition, ELength).To2D(), E.Width);
                                foreach (var c in
                                    targets.Where(
                                        c => c.NetworkId != cTarget.NetworkId && c.NetworkId != lTarget.NetworkId))
                                {
                                    input.Unit = c;
                                    var cPredPos = c.Type == GameObjectType.obj_AI_Minion
                                        ? c.Position
                                        : Prediction.GetPrediction(input).UnitPosition;
                                    if (
                                        new Geometry.Polygon.Circle(
                                            cPredPos,
                                            (c.Type == GameObjectType.obj_AI_Minion && c.IsMoving
                                                ? (c.BoundingRadius / 2f)
                                                : (c.BoundingRadius) * 0.9f)).Points.Any(p => rect.IsInside(p)))
                                    {
                                        count++;
                                        if (!containsTarget && c.NetworkId == mainTarget.NetworkId)
                                        {
                                            containsTarget = true;
                                        }
                                    }
                                }
                                if (count > hits && containsTarget)
                                {
                                    hits = count;
                                    startPos = cCastPos;
                                    endPos = cCastPos.Extend(pred.CastPosition, ELength);
                                    if (hits == targetCount)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                        if (endPos.Equals(Vector3.Zero) && containsTarget)
                        {
                            startPos = target.IsFacing(Player) && IsSpellUpgraded(E)
                                ? Player.Position.Extend(cCastPos, Player.Distance(cCastPos) - (ELength / 10f))
                                : cCastPos;
                            endPos = Player.Position.Extend(cCastPos, ELength);
                            hits = 1;
                        }
                    }
                    else
                    {
                        input2.Unit = lTarget;
                        var castPos = Prediction.GetPrediction(input2).CastPosition;
                        var sCastPos = Player.Position.Extend(castPos, E.Range);

//.........这里部分代码省略.........
开发者ID:juan2202,项目名称:LeagueSharp-Standalones,代码行数:101,代码来源:Viktor.cs

示例9: ELogicHero

 private bool ELogicHero(Obj_AI_Hero mainTarget, HitChance hitChance)
 {
     try
     {
         if (mainTarget == null)
         {
             return false;
         }
         var input = new PredictionInput
         {
             Range = ELength,
             Delay = E.Delay,
             Radius = E.Width,
             Speed = E.Speed,
             Type = E.Type,
             UseBoundingRadius = true
         };
         var input2 = new PredictionInput
         {
             Range = E.Range + ELength,
             Delay = E.Delay,
             Radius = E.Width,
             Speed = E.Speed,
             Type = E.Type,
             UseBoundingRadius = true
         };
         var startPosition = Vector3.Zero;
         var endPosition = Vector3.Zero;
         var targets =
             GameObjects.EnemyHeroes.Where(t => t.IsValidTarget((E.Range + ELength + E.Width) * 1.25f)).ToList();
         if (mainTarget.ServerPosition.Distance(Player.ServerPosition) <= E.Range)
         {
             var castPosition = mainTarget.ServerPosition;
             var maxAdditionalHits = 0;
             foreach (var target in targets.Where(t => t.NetworkId != mainTarget.NetworkId))
             {
                 var lTarget = target;
                 var additionalHits = 0;
                 input.Unit = lTarget;
                 input.From = castPosition;
                 input.RangeCheckFrom = castPosition;
                 var pred = Prediction.GetPrediction(input);
                 if (pred.Hitchance >= HitChance.High)
                 {
                     additionalHits++;
                     var rect = new Geometry.Polygon.Rectangle(
                         castPosition, castPosition.Extend(pred.CastPosition, ELength), E.Width);
                     foreach (var target2 in
                         targets.Where(
                             t => t.NetworkId != mainTarget.NetworkId && t.NetworkId != lTarget.NetworkId))
                     {
                         input.Unit = target2;
                         var pred2 = Prediction.GetPrediction(input);
                         if (!pred2.UnitPosition.Equals(Vector3.Zero) &&
                             new Geometry.Polygon.Circle(pred2.UnitPosition, target2.BoundingRadius * 0.9f)
                                 .Points.Any(p => rect.IsInside(p)))
                         {
                             additionalHits++;
                         }
                     }
                 }
                 if (additionalHits > maxAdditionalHits)
                 {
                     maxAdditionalHits = additionalHits;
                     endPosition = pred.CastPosition;
                 }
             }
             startPosition = castPosition;
             if (endPosition.Equals(Vector3.Zero))
             {
                 if (startPosition.Distance(Player.ServerPosition) > E.Range)
                 {
                     startPosition = Player.ServerPosition.Extend(startPosition, E.Range);
                 }
                 if (mainTarget.Path.Length > 0)
                 {
                     var newPos = mainTarget.Path[0];
                     if (mainTarget.Path.Length > 1 &&
                         newPos.Distance(mainTarget.ServerPosition) <= mainTarget.BoundingRadius * 4f)
                     {
                         var nnPos = newPos.Extend(
                             mainTarget.Path[1],
                             Math.Min(mainTarget.BoundingRadius * 1.5f, newPos.Distance(mainTarget.Path[1])));
                         if (startPosition.To2D().AngleBetween(nnPos.To2D()) < 30)
                         {
                             newPos = nnPos;
                         }
                     }
                     endPosition = startPosition.Extend(newPos, ELength);
                 }
                 else if (mainTarget.IsFacing(Player))
                 {
                     endPosition = startPosition.Extend(Player.ServerPosition, ELength);
                 }
                 else
                 {
                     endPosition = Player.ServerPosition.Extend(
                         startPosition, startPosition.Distance(Player.ServerPosition) + ELength);
                 }
             }
//.........这里部分代码省略.........
开发者ID:zombiesing,项目名称:LeagueSharp-Standalones,代码行数:101,代码来源:Viktor.cs

示例10: Line

 public static Result Line(Spell spell,
     Obj_AI_Hero target,
     HitChance hitChance,
     bool boundingRadius = true,
     bool maxRange = true)
 {
     try
     {
         if (spell == null || target == null)
         {
             return new Result(Vector3.Zero, new List<Obj_AI_Hero>());
         }
         var range = (spell.IsChargedSpell && maxRange ? spell.ChargedMaxRange : spell.Range) +
                     (spell.Width * 0.9f) +
                     (boundingRadius ? target.BoundingRadius * BoundingRadiusMultiplicator : 0);
         var positions = (from t in GameObjects.EnemyHeroes
             where t.IsValidTarget(range, true, spell.RangeCheckFrom)
             let prediction = spell.GetPrediction(t)
             where prediction.Hitchance >= hitChance
             select new Position(t, prediction.UnitPosition)).ToList();
         if (positions.Any())
         {
             var hits = new List<Obj_AI_Hero>();
             var pred = spell.GetPrediction(target);
             if (pred.Hitchance >= hitChance)
             {
                 hits.Add(target);
                 var rect = new Geometry.Polygon.Rectangle(
                     spell.From, spell.From.Extend(pred.CastPosition, range), spell.Width);
                 if (boundingRadius)
                 {
                     hits.AddRange(
                         from point in positions.Where(p => p.Hero.NetworkId != target.NetworkId)
                         let circle =
                             new Geometry.Polygon.Circle(
                                 point.UnitPosition, point.Hero.BoundingRadius * BoundingRadiusMultiplicator)
                         where circle.Points.Any(p => rect.IsInside(p))
                         select point.Hero);
                 }
                 else
                 {
                     hits.AddRange(
                         from position in positions
                         where rect.IsInside(position.UnitPosition)
                         select position.Hero);
                 }
                 return new Result(pred.CastPosition, hits);
             }
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return new Result(Vector3.Zero, new List<Obj_AI_Hero>());
 }
开发者ID:hprobotic,项目名称:LeagueSharp-Dev,代码行数:56,代码来源:CPrediction.cs

示例11: LineFarm

 private static void LineFarm(Spell spell, List<Obj_AI_Base> minions, int min, float overrideWidth = -1f)
 {
     var spellWidth = overrideWidth > 0 ? overrideWidth : spell.Width;
     var totalHits = 0;
     var castPos = Vector3.Zero;
     foreach (var minion in minions)
     {
         var lMinion = minion;
         var pred = spell.GetPrediction(minion);
         if (pred.Hitchance < HitChance.Medium)
         {
             continue;
         }
         var rect = new Geometry.Polygon.Rectangle(
             ObjectManager.Player.Position.To2D(),
             ObjectManager.Player.Position.Extend(pred.CastPosition, spell.Range).To2D(), spellWidth);
         var count = 1 + (from minion2 in minions.Where(m => m.NetworkId != lMinion.NetworkId)
             let pred2 = spell.GetPrediction(minion2)
             where pred2.Hitchance >= HitChance.Medium
             where
                 new Geometry.Polygon.Circle(pred2.UnitPosition, minion2.BoundingRadius * 0.8f).Points.Any(
                     p => rect.IsInside(p))
             select 1).Sum();
         if (count > totalHits)
         {
             totalHits = count;
             castPos = pred.CastPosition;
         }
         if (totalHits == minions.Count)
         {
             break;
         }
         if (!castPos.Equals(Vector3.Zero) && totalHits >= min)
         {
             spell.Cast(castPos);
         }
     }
 }
开发者ID:bigback,项目名称:LeagueSharp-Dev,代码行数:38,代码来源:Casting.cs

示例12: GetCollisionPoint

 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:
                 collisions.AddRange(
                     from minion in
                         Helper.GetMinions(
                             @from.To3D(), 1200, MinionTypes.All,
                             skillshot.Unit.Team == ObjectManager.Player.Team
                                 ? MinionTeam.NotAlly
                                 : MinionTeam.NotAllyForEnemy)
                     let pred =
                         FastPrediction(
                             @from, minion,
                             Math.Max(
                                 0, skillshot.SpellData.Delay - (Utils.GameTimeTickCount - 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 = CollisionObjectTypes.Minion,
                             Distance = pos.Distance(@from),
                             Diff = w
                         });
                 break;
             case CollisionObjectTypes.Champions:
                 collisions.AddRange(
                     from hero in HeroManager.Allies.Where(i => i.IsValidTarget(1200, false) && !i.IsMe)
                     let pred =
                         FastPrediction(
                             @from, hero,
                             Math.Max(
                                 0, skillshot.SpellData.Delay - (Utils.GameTimeTickCount - 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 = CollisionObjectTypes.Minion,
                             Distance = pos.Distance(@from),
                             Diff = w
                         });
                 break;
             case CollisionObjectTypes.YasuoWall:
                 if (
                     !HeroManager.Allies.Any(
                         i => i.IsValidTarget(float.MaxValue, false) && i.ChampionName == "Yasuo"))
                 {
                     break;
                 }
                 var wall =
                     ObjectManager.Get<GameObject>()
                         .FirstOrDefault(
                             i =>
                                 i.IsValid &&
                                 Regex.IsMatch(i.Name, "_w_windwall.\\.troy", RegexOptions.IgnoreCase));
                 if (wall == null)
                 {
                     break;
                 }
                 var wallWidth = 300 + 50 * Convert.ToInt32(wall.Name.Substring(wall.Name.Length - 6, 1));
                 var wallDirection = (wall.Position.To2D() - _wallCastedPos).Normalized().Perpendicular();
                 var subWallWidth = wallWidth / 2;
                 var wallStart = wall.Position.To2D() + subWallWidth * wallDirection;
                 var wallEnd = wallStart - wallWidth * wallDirection;
                 var wallPolygon = new Geometry.Polygon.Rectangle(wallStart, wallEnd, 75);
                 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)
//.........这里部分代码省略.........
开发者ID:WTayllor,项目名称:LeagueSharp-6,代码行数:101,代码来源:Collisions.cs

示例13: Game_OnUpdate

        private void Game_OnUpdate(EventArgs args)
        {
            if (!ObjectManager.Player.IsDead)
                if (Orbwalking.CanMove(100))
                {
                    switch (MenuProvider.Orbwalker.ActiveMode)
                    {
                        case Orbwalking.OrbwalkingMode.Combo:
                            {
                                if (MenuProvider.Champion.Combo.UseQ)
                                    if (_q.IsReadyPerfectly())
                                        if (!ObjectManager.Player.IsDashing())
                                            if (_hasPassive == false)
                                            {
                                                var target = TargetSelector.GetTarget(_q.Range, _q.DamageType);
                                                if (target != null)
                                                    _q.CastOnUnit(target);
                                                else
                                                {
                                                    var extendedTarget = TargetSelector.GetTarget(_qExtended.Range,
                                                        _q.DamageType);
                                                    if (extendedTarget != null)
                                                    {
                                                        var minions =
                                                            MinionManager.GetMinions(ObjectManager.Player.ServerPosition,
                                                                _q.Range, MinionTypes.All, MinionTeam.NotAlly);
                                                        foreach (var minion in minions)
                                                        {
                                                            var box =
                                                                new Geometry.Polygon.Rectangle(
                                                                    ObjectManager.Player.ServerPosition,
                                                                    ObjectManager.Player.ServerPosition.Extend(
                                                                        minion.ServerPosition, _qExtended.Range),
                                                                    _qExtended.Width);
                                                            var prediction = _qExtended.GetPrediction(extendedTarget);
                                                            if (box.IsInside(prediction.UnitPosition))
                                                                if (prediction.Hitchance >= _q.MinHitChance)
                                                                {
                                                                    _q.CastOnUnit(minion);
                                                                    break;
                                                                }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                var killableTarget =
                                                    HeroManager.Enemies.FirstOrDefault(
                                                        x =>
                                                            x.IsKillableAndValidTarget(_q.GetDamage(x),
                                                                TargetSelector.DamageType.Physical, _q.Range));
                                                if (killableTarget != null)
                                                    _q.CastOnUnit(killableTarget);
                                            }

                                if (MenuProvider.Champion.Combo.UseW)
                                    if (_w.IsReadyPerfectly())
                                        if (!ObjectManager.Player.IsDashing())
                                            if (_hasPassive == false)
                                            {
                                                if (HeroManager.Enemies.Any(x => Orbwalking.InAutoAttackRange(x)))
                                                {
                                                    var target = TargetSelector.GetTarget(_w.Range, _w.DamageType);
                                                    if (target != null)
                                                        _wNoCollision.Cast(target, false, true);
                                                }
                                                else
                                                {
                                                    var target = TargetSelector.GetTargetNoCollision(_w);
                                                    if (target != null)
                                                        _w.Cast(target);
                                                }
                                            }
                                            else
                                            {
                                                var killableTarget =
                                                    HeroManager.Enemies.FirstOrDefault(
                                                        x =>
                                                            x.IsKillableAndValidTarget(_w.GetDamage(x),
                                                                TargetSelector.DamageType.Physical, _w.Range) &&
                                                            _w.GetPrediction(x).Hitchance >= HitChance.High);
                                                if (killableTarget != null)
                                                    _w.Cast(killableTarget);
                                            }

                                break;
                            }
                        case Orbwalking.OrbwalkingMode.Mixed:
                            {
                                if (MenuProvider.Champion.Harass.UseQ)
                                    if (_hasPassive == false)
                                        if (_q.IsReadyPerfectly())
                                            if (!ObjectManager.Player.IsDashing())
                                                if (
                                                    ObjectManager.Player.IsManaPercentOkay(
                                                        MenuProvider.Champion.Harass.IfMana))
                                                {
                                                    var target = TargetSelector.GetTarget(_q.Range, _q.DamageType);
                                                    if (target != null)
//.........这里部分代码省略.........
开发者ID:NaviFly,项目名称:LeagueSharp,代码行数:101,代码来源:Lucian.cs

示例14: OnProcessSpell

        private static void OnProcessSpell(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            try
            {

                if (!sender.IsMe && sender.IsEnemy)
                {
                    if (_MainMenu.Item("TahmKench_MyTeamMinEnable").GetValue<bool>() && sender.IsEnemy && _W.IsReady())
                    {
                        var SkillRange = new Geometry.Polygon.Rectangle(args.Start, args.End, sender.BoundingRadius + 30);
                        var Target = HeroManager.Allies.FirstOrDefault(f => f.Distance(Player.Position) <= _W.Range
                        && !f.IsZombie && !f.IsDead && SkillRange.IsInside(f.Position)
                        && _MainMenu.Item("TahmKench_MyTeamMin").GetValue<Slider>().Value >= f.HealthPercent);
                        if (Target != null)
                        {
                            _W.CastOnUnit(Target, true);
                            return;
                        }
                        if (args.Target != null)
                        {
                            var target = HeroManager.Allies.FirstOrDefault(f => f.Position.Distance(Player.Position) <= _W.Range
                            && !f.IsZombie && !f.IsDead && f.HealthPercent <= _MainMenu.Item("TahmKench_MyTeamMin").GetValue<Slider>().Value);
                            if (target != null)
                            {
                                _W.CastOnUnit(target, true);
                                return;
                            }
                        }
                    }
                    if (_MainMenu.Item("TahmKench_AutoEUse").GetValue<bool>() && sender.IsEnemy && _E.IsReady() && Player.HealthPercent <= _MainMenu.Item("TahmKench_MinE").GetValue<Slider>().Value)
                    {
                        var target = new Geometry.Polygon.Rectangle(args.Start, args.End, sender.BoundingRadius + 30);
                        if (target != null)
                        {
                            _E.Cast(true);
                            return;
                        }
                        if (args.Target != null)
                        {
                            var TargetMe = HeroManager.Allies.FirstOrDefault(f => f.Position.Distance(Player.Position) <= 10);
                            if (TargetMe == Player)
                            {
                                _E.Cast(true);
                                return;
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                if (NowTime() > ErrorTime)
                {
                    Game.PrintChat(ChampName + " in FreshBooster isn't Load. Error Code 08");
                    ErrorTime = TickCount(10000);
                }
            }

        }
开发者ID:NaviFly,项目名称:LeagueSharp,代码行数:59,代码来源:TahmKench.cs

示例15: AutoKick

        private static void AutoKick()
        {
            if (MainMenu._MainMenu.Item("AutoKick").GetValue<Slider>().Value == 0 || MainMenu._MainMenu.Item("InsecKick").GetValue<KeyBind>().Active) return;

            var target =
                HeroManager.Enemies.Where(x => x.Distance(Player) < 375 && !x.IsDead && x.IsValidTarget(375))
                    .OrderBy(x => x.Distance(Player)).FirstOrDefault();
            if (target == null) return;

            var ultPoly = new Geometry.Polygon.Rectangle(Player.ServerPosition,
                Player.ServerPosition.Extend(target.Position, 1100),
                target.BoundingRadius + 10);

            var count =
                HeroManager.Enemies.Where(x => x.Distance(Player) < 1100 && x.IsValidTarget(1100))
                    .Count(h => h.NetworkId != target.NetworkId && ultPoly.IsInside(h.ServerPosition));

            if (count >= MainMenu._MainMenu.Item("AutoKick").GetValue<Slider>().Value && _R.IsReady())
            {
                _R.Cast(target);
            }
        }
开发者ID:qq2128969,项目名称:LeagueSharp,代码行数:22,代码来源:Program.cs


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