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


C# Obj_AI_Hero.Distance方法代码示例

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


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

示例1: OnInterruptableTarget

 private void OnInterruptableTarget(Obj_AI_Hero target, Interrupter2.InterruptableTargetEventArgs args)
 {
     if (E.CanCast(target) && config.Item("useEint", true).GetValue<bool>())
     {
         if (E.CastIfHitchanceEquals(target, HitChance.High, config.Item("packets").GetValue<bool>()))
         {
             return;
         }
     }
     if (R.CanCast(target) && config.Item("useRint", true).GetValue<bool>())
     {
         if (savedQ != null && !SimpleQ && !target.IsMoving && target.Distance(qPos) > QExplosionRange &&
             target.Distance(player) < R.Range - 100 &&
             target.Position.Distance(savedQ.position) < 550 + QExplosionRange / 2 &&
             !target.HasBuffOfType(BuffType.Knockback))
         {
             var cast = Prediction.GetPrediction(target, 1000f).UnitPosition.Extend(savedQ.position, -100);
             R.Cast(cast);
         }
         else if (target.Distance(player) < R.Range - 100)
         {
             if (player.CountEnemiesInRange(2000) <= player.CountAlliesInRange(2000))
             {
                 var cast = target.Position.Extend(player.Position, -100);
                 R.Cast(cast);
             }
             else
             {
                 var cast = target.Position.Extend(player.Position, 100);
                 R.Cast(cast);
             }
         }
     }
 }
开发者ID:koolkaracter,项目名称:LeagueSharp,代码行数:34,代码来源:Gragas.cs

示例2: Execute

        public override void Execute(Obj_AI_Hero target)
        {
            if (target == null)
                target = TargetSelector.GetTarget(1200, TargetSelector.DamageType.Magical);
            if (target == null) return;

            var dmgPerBounce = ObjectManager.Player.GetSpellDamage(target, Slot) + BrandCombo.GetPassiveDamage(target);
            if (dmgPerBounce > target.Health && target.Distance(ObjectManager.Player) > 750)
            {
                TryBridgeUlt(target);

                //   Console.WriteLine("ayy lmao bridge bois");
            }

            if (dmgPerBounce > target.Health && !Provider.ShouldBeDead(target) && ObjectManager.Player.GetAutoAttackDamage(target, true) < target.Health && ((_otherSkills.All(skill => skill.Instance.State != SpellState.Ready && skill.Instance.State != SpellState.Surpressed /*&& !skill.IsSafeCasting(1)*/) /*|| target.Distance(ObjectManager.Player) > 650*/) || ObjectManager.Player.GetSpellDamage(target, SpellSlot.Q) + dmgPerBounce + ObjectManager.Player.GetAutoAttackDamage(target) > target.Health && !target.HasBuff("brandablaze") && target.Distance(ObjectManager.Player) < 750))
            {
                if (ObjectManager.Player.HealthPercent - target.HealthPercent < OverkillPercent || !AntiOverkill || IgnoreAntiOverkillOnFlee && target.Distance(ObjectManager.Player) > ObjectManager.Player.AttackRange)
                {
                    Cast(target);
                }
                else if (ObjectManager.Player.HealthPercent < target.HealthPercent && IgniteManager.CanBeUsed() && IgniteManager.GetDamage() + dmgPerBounce > target.Health)
                {
                    if (target.Distance(ObjectManager.Player) < 600)
                        IgniteManager.UseIgnite(target);
                    Cast(target);
                }
            }

            // if (target.Distance(ObjectManager.Player) > 750) return;
            var inBounce = new bool[HeroManager.Enemies.Count];
            var canBounce = BounceCheck(target, inBounce);
            if (canBounce)
            {

                var inBounceEnemies = HeroManager.Enemies.Where(enemy => inBounce[HeroManager.Enemies.IndexOf(enemy)]).ToArray();
                var distance = target.Distance(ObjectManager.Player);

                var bounceCount = inBounce.Count(item => item);
                if (bounceCount <= 1) return;
                //Console.WriteLine("bounce r " + bounceCount);

                if ((inBounceEnemies.Any(enemy => (dmgPerBounce > enemy.Health && MaxDamage > enemy.Health)) && (bounceCount == 2 || RiskyUlt)))
                {
                    TryUlt(target, inBounceEnemies, distance);
                }
                else if (bounceCount == 2 && dmgPerBounce * 3 > target.Health && MaxDamage > target.Health && distance < 750 && RiskyUlt)
                {
                    Cast(target);
                }
                else if (dmgPerBounce * 2 > target.Health && MaxDamage > target.Health)
                {
                    TryUlt(target, inBounceEnemies, distance);
                }
                else if (UltNonKillable && MinBounceTargets <= bounceCount)
                {
                    TryUlt(target, inBounceEnemies, distance, false);
                }
            }
        }
开发者ID:jayblah,项目名称:TheNinow,代码行数:59,代码来源:BrandR.cs

示例3: ChampionInfo

 public ChampionInfo(Obj_AI_Hero hero, bool ally)
 {
     index++;
     int textoffset = index * 50;
     _hero = hero;
     Render.Text text = new Render.Text(
         new Vector2(), _hero.ChampionName, 20,
         ally
             ? new Color { R = 205, G = 255, B = 205, A = 255 }
             : new Color { R = 255, G = 205, B = 205, A = 255 })
     {
         PositionUpdate =
             () =>
                 Drawing.WorldToScreen(
                     ObjectManager.Player.Position.Extend(_hero.Position, 300 + textoffset)),
         VisibleCondition = delegate
         {
             float dist = _hero.Distance(ObjectManager.Player.Position);
             return Program.Instance().ShowChampionNames && !_hero.IsDead &&
                    Game.ClockTime - _lineStart < Program.Instance().LineDuration &&
                    (!_hero.IsVisible || !Render.OnScreen(Drawing.WorldToScreen(_hero.Position))) &&
                    dist < Program.Instance().Radius && dist > 300 + textoffset;
         },
         Centered = true,
         OutLined = true,
     };
     text.Add(1);
     _line = new Render.Line(
         new Vector2(), new Vector2(), 5,
         ally ? new Color { R = 0, G = 255, B = 0, A = 125 } : new Color { R = 255, G = 0, B = 0, A = 125 })
     {
         StartPositionUpdate = () => Drawing.WorldToScreen(ObjectManager.Player.Position),
         EndPositionUpdate = () => Drawing.WorldToScreen(_hero.Position),
         VisibleCondition =
             delegate
             {
                 return !_hero.IsDead && Game.ClockTime - _lineStart < Program.Instance().LineDuration &&
                        _hero.Distance(ObjectManager.Player.Position) < (Program.Instance().Radius + 1000);
             }
     };
     _line.Add(0);
     Render.Line minimapLine = new Render.Line(
         new Vector2(), new Vector2(), 2,
         ally ? new Color { R = 0, G = 255, B = 0, A = 255 } : new Color { R = 255, G = 0, B = 0, A = 255 })
     {
         StartPositionUpdate = () => Drawing.WorldToMinimap(ObjectManager.Player.Position),
         EndPositionUpdate = () => Drawing.WorldToMinimap(_hero.Position),
         VisibleCondition =
             delegate
             {
                 return Program.Instance().DrawMinimapLines && !_hero.IsDead && Game.ClockTime - _lineStart < Program.Instance().LineDuration;
             }
     };
     minimapLine.Add(0);
     Game.OnUpdate += Game_OnGameUpdate;
     OnEnterRange += ChampionInfo_OnEnterRange;
 }
开发者ID:Haifurer,项目名称:LeagueSharp,代码行数:57,代码来源:Program.cs

示例4: Cast

        public override void Cast(Obj_AI_Hero target, bool force = false, HitChance minChance = HitChance.Low)
        {
            if (target == null) return;
            if (ObjectManager.Player.HasBuff("ekkoattackbuff") && target.Distance(ObjectManager.Player) < 500)
            {
                ObjectManager.Player.IssueOrder(GameObjectOrder.AutoAttack, target);

            }

            if (HasBeenSafeCast() || target.Distance(ObjectManager.Player) < ObjectManager.Player.AttackRange + ObjectManager.Player.BoundingRadius + target.BoundingRadius) return;
            SafeCast(() => Spell.Cast(target.Position));
        }
开发者ID:jayblah,项目名称:TheNinow,代码行数:12,代码来源:EkkoE.cs

示例5: GetComboDamage

        public float GetComboDamage(Obj_AI_Hero target)
        {
            if (target == null) return 0;

            float comboDmg = 0;

            var aaDmg = (float)ObjectManager.Player.GetAutoAttackDamage(target, true);

            if (qSpell.Spell.IsReady())
            {
                comboDmg += qSpell.GetDamage(target) + aaDmg;
            }

            if (wSpell.Spell.IsReady())
            {
                comboDmg += wSpell.Spell.GetDamage(target) + aaDmg;
            }

            if (eSpell.Spell.IsReady())
            {
                comboDmg += aaDmg;
            }

            if (target.Distance(ObjectManager.Player) >= 900 && rSpell.Spell.IsReady())
            {
                comboDmg += rSpell.GetDamage(target);
            }

            return comboDmg;
        }
开发者ID:Nechrito,项目名称:Leaguesharp,代码行数:30,代码来源:LucDamage.cs

示例6: doCombo

        public static void doCombo(Obj_AI_Hero target)
        {
            igniteIfKIllable(target);
            if (!target.IsValidTarget())
                return;

            if (!W.IsReady() && !E.IsReady() && R.IsReady() && Rdata.Name == "TalonShadowAssault" && (target.Health > getAAdmg(target) || targetInRange(target, 125f))
                && target.Health<(getRdmg(target)*2 + getTargetBleedDmg(target)))
            {
                PredictionOutput po = R.GetPrediction(target);
                if (po.Hitchance >= HitChance.Medium)
                {
                    R.Cast();
                    posRCast = Player.ServerPosition;
                }
            }

            if (Rdata.Name == "TalonShadowAssault")
            {
                if (target.Health<= getRdmg(target) && target.Distance(posRCast) < R.Range)
                    R.Cast();
            }

            if (E.IsReady() && targetInRange(target, E.Range))
            {
                E.Cast(target);
            }
            if (W.IsReady() && !E.IsReady() && targetInRange(target, W.Range) && !targetInRange(target, 100) && !Player.IsChanneling
                && (!targetInRange(target,250) || targetHasCut(target)))
            {

                    W.Cast(target);
            }
            castItemsFull(target);
        }
开发者ID:Merc491,项目名称:GoodGuyJodu,代码行数:35,代码来源:Talon.cs

示例7: CastE

        void CastE(Obj_AI_Hero target)
        {
            if (target != null)
            {
                if (SpellSlot.E.IsReady() && isHealthy)
                {
                    if (DashCount >= 1 && GetDashPos(target).IsCloser(target) && target.IsDashable() &&
                        (GetBool("Combo.ETower") || GetKeyBind("Misc.TowerDive") || !GetDashPos(target).PointUnderEnemyTurret()))
                    {
                        Spells[E].CastOnUnit(target);
                        return;
                    }

                    if (DashCount == 0)
                    {
                        var dist = Yasuo.Distance(target);

                        var bestminion =
                            ObjectManager.Get<Obj_AI_Base>()
                                .Where(
                                    x =>
                                         x.IsDashable()
                                         && target.Distance(GetDashPos(x)) < dist &&
                                        (GetBool("Combo.ETower") || GetKeyBind("Misc.TowerDive") || !GetDashPos(x).PointUnderEnemyTurret()))
                                .OrderBy(x => Vector2.Distance(GetDashPos(x), target.ServerPosition.To2D()))
                                .FirstOrDefault();
                        if (bestminion != null)
                        {
                            Spells[E].CastOnUnit(bestminion);
                        }

                        else
                        {
                            var minion =
                              ObjectManager.Get<Obj_AI_Base>()
                                  .Where(x => x.IsDashable() && (GetBool("Combo.ETower") || GetKeyBind("Misc.TowerDive") || !GetDashPos(x).PointUnderEnemyTurret()))
                                  .OrderBy(x => GetDashPos(x).Distance(target)).FirstOrDefault();

                            if (minion != null && GetDashPos(minion).IsCloser(target))
                            {
                                Spells[E].CastOnUnit(minion);
                            }
                        }
                    }

                    else
                    {
                        var minion =
                            ObjectManager.Get<Obj_AI_Base>()
                                .Where(x =>  x.IsDashable() && (GetBool("Combo.ETower") || GetKeyBind("Misc.TowerDive") || !GetDashPos(x).PointUnderEnemyTurret()))
                                .OrderBy(x => GetDashPos(x).Distance(target)).FirstOrDefault();

                        if (minion != null && GetDashPos(minion).IsCloser(target))
                        {
                            Spells[E].CastOnUnit(minion);
                        }
                    }
                }
            }
        }
开发者ID:SymbolixDEV,项目名称:LeagueSharp,代码行数:60,代码来源:Yasuo.cs

示例8: Update

 public void Update(Obj_AI_Hero target)
 {
     if ((target.HealthPercent >= _minEnemyHealth || ObjectManager.Player.HealthPercent < 20) && ObjectManager.Player.HealthPercent <= _maxPlayerHealth && target.Distance(ObjectManager.Player) < 550)
     {
         Use(target);
     }
 }
开发者ID:jayblah,项目名称:TheNinow,代码行数:7,代码来源:Botrk.cs

示例9: QMinion

        public static Obj_AI_Base QMinion(Obj_AI_Hero t)
        {
            var m = MinionManager.GetMinions(ObjectManager.Player.ServerPosition, Q.Range, MinionTypes.All,
                MinionTeam.NotAlly, MinionOrderTypes.None);

            return (from vM
                        in m.Where(vM => vM.IsValidTarget(Q.Range))
                    let endPoint = vM.ServerPosition.To2D().Extend(ObjectManager.Player.ServerPosition.To2D(), -Q2.Range).To3D()
                    where
                        vM.Distance(t) <= t.Distance(ObjectManager.Player) &&
                        Intersection(ObjectManager.Player.ServerPosition.To2D(), endPoint.To2D(), t.ServerPosition.To2D(), t.BoundingRadius + vM.BoundingRadius)
                    //Intersection(ObjectManager.Player.ServerPosition.To2D(), endPoint.To2D(), t.ServerPosition.To2D(), t.BoundingRadius + Q.Width/4)
                    select vM).FirstOrDefault();
            //get
            //{
            //    var vTarget = TargetSelector.GetTarget(Q2.Range, TargetSelector.DamageType.Physical);
            //    var vMinions = MinionManager.GetMinions(
            //        ObjectManager.Player.ServerPosition, Q.Range, MinionTypes.All, MinionTeam.NotAlly,
            //        MinionOrderTypes.None);

            //    return (from vMinion in vMinions.Where(vMinion => vMinion.IsValidTarget(Q.Range))
            //            let endPoint =
            //                vMinion.ServerPosition.To2D()
            //                    .Extend(ObjectManager.Player.ServerPosition.To2D(), -Q2.Range)
            //                    .To3D()
            //            where
            //                vMinion.Distance(vTarget) <= vTarget.Distance(ObjectManager.Player) &&
            //                Intersection(ObjectManager.Player.ServerPosition.To2D(), endPoint.To2D(),
            //                    vTarget.ServerPosition.To2D(), vTarget.BoundingRadius + vMinion.BoundingRadius)
            //            select vMinion).FirstOrDefault();
            //}
        }
开发者ID:Deprive,项目名称:Private,代码行数:32,代码来源:Lucian.cs

示例10: WardJumpFlashInsec

 public static void WardJumpFlashInsec(Obj_AI_Hero enemy)
 {
     if (Config.Item("insec.whitelist." + enemy.ChampionName).GetValue<bool>() && HybridCommon.Utility.GetPriority(enemy.ChampionName) > 2)
     {
         if (ObjectManager.Player.Distance(enemy.Position) > Spells[Q].Range &&
         ObjectManager.Player.Distance(enemy.Position) < Spells[Q].Range + 600 && WardJump.WardCastable)
         {
             WardJump.HikiJump(Spells[W], Helper.WardJumpToEnemy(enemy, 600));
         }
         if (enemy.Distance(LeeSin.Position) < Spells[Q].Range && Spells[Q].GetPrediction(enemy).Hitchance > HitChance.High)
         {
             Spells[Q].Cast(enemy);
         }
         if (Helper.QTwo(Spells[Q]) && Spells[Q2].IsReady())
         {
             Spells[Q2].Cast();
         }
         if (Flashable && LeeSin.Distance(Helper.InsecPositions()) < FlashRange)
         {
             Utility.DelayAction.Add(Helper.SliderCheck("flash.insec.flash.delay"),
                 () => LeeSin.Spellbook.CastSpell(FlashSlot, Helper.InsecPositions()));
         }
         if (LeeSin.Spellbook.CanUseSpell(FlashSlot) == SpellState.Cooldown && !Spells[Q].IsReady() &&
             LeeSin.Distance(enemy.Position) < Spells[R].Range)
         {
             Spells[R].Cast(enemy);
         }
     }  
 }
开发者ID:Sthephanfelix,项目名称:LeagueSharp-4,代码行数:29,代码来源:WardjumpFlashInsec.cs

示例11: Interrupter2_OnInterruptableTarget

 private void Interrupter2_OnInterruptableTarget(Obj_AI_Hero sender,
     Interrupter2.InterruptableTargetEventArgs args)
 {
     if (R.IsReady() && config.Item("Interrupt", true).GetValue<bool>() && sender.Distance(player) < R.Range)
     {
         CastR();
     }
 }
开发者ID:koolkaracter,项目名称:LeagueSharp,代码行数:8,代码来源:Galio.cs

示例12: Interruptable

        public override void Interruptable(ComboProvider combo, Obj_AI_Hero sender, ComboProvider.InterruptableSpell interruptableSpell, float endTime)
        {
            var distance = sender.Distance(ObjectManager.Player);
            if (sender.HasBuff("brandablaze") || Provider.IsMarked(sender) || !_brandQ.CouldHit(sender) || !InterruptW) return;

            if (Cast(sender) == CastStates.SuccessfullyCasted)
                Provider.SetMarked(sender); //Todo: risky, keep an eye on this. If the W misses u r fucked
        }
开发者ID:jayblah,项目名称:TheNinow,代码行数:8,代码来源:BrandW.cs

示例13: Interruptable

 public override void Interruptable(ComboProvider combo, Obj_AI_Hero sender, ComboProvider.InterruptableSpell interruptableSpell, float endTime)
 {
     if (endTime - Game.Time > Math.Max(sender.Distance(ObjectManager.Player) - Orbwalking.GetRealAutoAttackRange(sender), 0)/ObjectManager.Player.MoveSpeed + 0.5f)
     {
         SafeCast();
         Orbwalking.Orbwalk(sender, sender.Position);
     }
 }
开发者ID:werdbrian,项目名称:LeagueSharp-6,代码行数:8,代码来源:GarenQ.cs

示例14: Insec

 public static void Insec(Obj_AI_Hero target)
 {
     Rpos = Player.Position.To2D().Extend(target.Position.To2D(), Player.Distance(target) + 250);
     if (Rpos.Distance(Player.Position) <= R.Range)
     {
         if (Player.Distance(Rpos.Extend(target.Position.To2D(), 700 - target.Distance(Rpos))) < E.Range && !IsWall(Rpos.To3D()) && target.IsFacing(Player))
         {
             R.Cast(Rpos);
         }
     }
 }
开发者ID:xcxooxl,项目名称:Lsharp3,代码行数:11,代码来源:Gragas.cs

示例15: IgniteOnTarget

 private static void IgniteOnTarget(Obj_AI_Hero t)
 {
     var range = 550f;
     var use = menu.Item("Spells.Ignite").GetValue<bool>();
     if (use && Program.Player.Spellbook.CanUseSpell(IgniteSlot) == SpellState.Ready &&
         t.Distance(Program.Player.Position) < range &&
         Program.Player.GetSummonerSpellDamage(t, Damage.SummonerSpell.Ignite) > t.Health)
     {
         Program.Player.Spellbook.CastSpell(IgniteSlot, t);
     }
 }
开发者ID:fgpmaia,项目名称:LeagueSharp2,代码行数:11,代码来源:PlayerSpells.cs


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