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


C# Spell.GetPrediction方法代码示例

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


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

示例1: CastSkillshot

        public void CastSkillshot(Obj_AI_Hero t, Spell s, HitChance hc = HitChance.High)
        {
            if (!s.IsSkillshot)
                return;

            PredictionOutput p = s.GetPrediction(t);

            if (s.Collision)
            {
                for (int i = 0; i < p.CollisionObjects.Count; i++)
                    if (!p.CollisionObjects[i].IsDead && (p.CollisionObjects[i].IsEnemy || p.CollisionObjects[i].IsMinion))
                        return;
            }

            if ((t.HasBuffOfType(BuffType.Slow) && p.Hitchance >= HitChance.High) || p.Hitchance == HitChance.Immobile)
                s.Cast(p.CastPosition);
            else if (t.IsRecalling())
                s.Cast(t.ServerPosition);
            else
            {
                if (s.IsReady())
                {
                    s.SPredictionCast(t, hc);
                }
            }
        }
开发者ID:cak3d,项目名称:LeagueSharp,代码行数:26,代码来源:Nidalee.cs

示例2: GetEnemyHitByR

        // This is for sona only atm.
        public static Obj_AI_Hero GetEnemyHitByR(Spell R, int numHit) {
            int totalHit = 0;
            Obj_AI_Hero target = null;

            foreach (Obj_AI_Hero current in ObjectManager.Get<Obj_AI_Hero>()) {

                var prediction = R.GetPrediction(current, true);

                if (Vector3.Distance(ObjectManager.Player.Position, prediction.CastPosition) <= R.Range) {
                    
                    Vector2 extended = current.Position.To2D().Extend(ObjectManager.Player.Position.To2D(), -R.Range + Vector2.Distance(ObjectManager.Player.Position.To2D(), current.Position.To2D()));
                    rect = new Geometry.Rectangle(ObjectManager.Player.Position.To2D(), extended, R.Width);

                    if (!current.IsMe && current.IsEnemy) {
                        // SEt to 1 as the current target is hittable.
                        totalHit = 1;
                        foreach (var enemy in ObjectManager.Get<Obj_AI_Hero>()) {
                            if (enemy.IsEnemy && current.ChampionName != enemy.ChampionName && !enemy.IsDead && !rect.ToPolygon().IsOutside(enemy.Position.To2D())) {
                                totalHit += 1;
                            }
                        }
                    }

                    if (totalHit >= numHit) {
                        target = current;
                        break;
                    }
                }

            }

            Console.WriteLine(Game.Time + " | Targets hit is: " + totalHit + " Out of " + numHit);
            return target;
        }
开发者ID:CupidL0ve,项目名称:LeagueSharp,代码行数:35,代码来源:Utils.cs

示例3: IsPositionSafe

        public static bool IsPositionSafe(Obj_AI_Base vTarget, Spell vSpell)
        {
            Vector2 predPos = vSpell.GetPrediction(vTarget).CastPosition.To2D();
            Vector2 myPos = ObjectManager.Player.Position.To2D();
            Vector2 newPos = (vTarget.Position.To2D() - myPos);
            newPos.Normalize();

            Vector2 checkPos = predPos + newPos * (vSpell.Range - Vector2.Distance(predPos, myPos));
            Obj_Turret closestTower = null;

            foreach (Obj_Turret tower in
                ObjectManager.Get<Obj_Turret>()
                    .Where(tower => tower.IsValid && !tower.IsDead && tower.Health != 0 && tower.IsEnemy))
            {
                if (Vector3.Distance(tower.Position, ObjectManager.Player.Position) < 1450)
                    closestTower = tower;
            }

            if (closestTower == null)
                return true;

            if (Vector2.Distance(closestTower.Position.To2D(), checkPos) <= 910)
                return false;

            return true;
        }
开发者ID:09samed09,项目名称:LeagueSharp2,代码行数:26,代码来源:Program.cs

示例4: CastMec

        private static void CastMec(Spell spell, int minHit)
        {
            if (!spell.IsReady() || ObjectManager.Player.HealthPercent <= 10)
                return;

            foreach (var target in HeroManager.Enemies.Where(x => x.IsValidTarget(spell.Range)))
            {
                var pred = spell.GetPrediction(target, true);

                var nearByEnemies = 1;

                if (spell.Type == SkillshotType.SkillshotLine && spell.Collision)
                {
                    var poly = new Geometry.Polygon.Circle(pred.UnitPosition, spell.Width);

                    nearByEnemies +=
                        HeroManager.Enemies.Where(x => x.NetworkId != target.NetworkId)
                            .Count(enemy => poly.IsInside(enemy.ServerPosition));

                }
                else
                {
                    nearByEnemies = pred.AoeTargetsHitCount;
                }

                if (nearByEnemies >= minHit)
                {
                    
                    spell.Cast(target);
                    return;
                }
            }
        }
开发者ID:leenam0910,项目名称:LSharp,代码行数:33,代码来源:AOESpellManager.cs

示例5: IsPositionSafe

        // use underTurret and .Extend for this please
        public static bool IsPositionSafe(Obj_AI_Hero target, Spell spell)
        {
            var predPos = spell.GetPrediction(target).UnitPosition.To2D();
            var myPos = Player.Position.To2D();
            var newPos = (target.Position.To2D() - myPos);
            newPos.Normalize();

            var checkPos = predPos + newPos * (spell.Range - Vector2.Distance(predPos, myPos));
            Obj_Turret closestTower = null;

            foreach (var tower in ObjectManager.Get<Obj_Turret>()
                .Where(tower => tower.IsValid && !tower.IsDead && Math.Abs(tower.Health) > float.Epsilon)
                .Where(tower => Vector3.Distance(tower.Position, Player.Position) < 1450))
            {
                closestTower = tower;
            }

            if (closestTower == null)
                return true;

            if (Vector2.Distance(closestTower.Position.To2D(), checkPos) <= 910)
                return false;

            return true;
        }
开发者ID:uio25371555,项目名称:LeagueSharp-Development,代码行数:26,代码来源:Quinn.cs

示例6: CastBasicSkillShot

 public static void CastBasicSkillShot(Spell spell, float range, LeagueSharp.Common.TargetSelector.DamageType type, HitChance hitChance)
 {
     var target = LeagueSharp.Common.TargetSelector.GetTarget(range, type);
     if (target == null || !spell.IsReady())
     return;
     spell.UpdateSourcePosition();
     if (spell.GetPrediction(target).Hitchance >= hitChance)
     spell.Cast(target, packets());
 }
开发者ID:LittleYuiChan,项目名称:LeagueSharp-2,代码行数:9,代码来源:Program.cs

示例7: GetTargetNoCollision

 public static Obj_AI_Hero GetTargetNoCollision(Spell spell,
     bool ignoreShields = true,
     Vector3 from = default(Vector3),
     IEnumerable<Obj_AI_Hero> ignoreChampions = null)
 {
     return
         GetTargets(spell.Range, Utils.ConvertDamageType(spell.DamageType), ignoreShields, from, ignoreChampions)
             .FirstOrDefault(t => spell.GetPrediction(t).Hitchance != HitChance.Collision);
 }
开发者ID:aikoy,项目名称:LeagueSharp-Dev,代码行数:9,代码来源:TargetSelector.cs

示例8: CastSpell

 public static void CastSpell(Spell spell, Obj_AI_Base target, HitChance hitChance, bool packetCast)
 {
     Obj_AI_Hero Player = ObjectManager.Player;
     if (target.IsValidTarget(spell.Range) && spell.GetPrediction(target).Hitchance >= hitChance)
     {
         spell.Cast(target, packetCast);
         LastCastTime = Environment.TickCount;
         Orbwalking.ResetAutoAttackTimer();
     }
 }
开发者ID:matt184,项目名称:LeagueSharp,代码行数:10,代码来源:SpellManager.cs

示例9: Cast_BasicSkillshot_Enemy

 public Obj_AI_Hero Cast_BasicSkillshot_Enemy(Spell spell, TargetSelector.PriorityMode prio = TargetSelector.PriorityMode.AutoPriority, float extrarange = 0)
 {
     if(!spell.IsReady())
         return null;
     var target = TargetSelector.GetTarget(spell.Range, prio);
     if(target == null)
         return null;
     if (!target.IsValidTarget(spell.Range + extrarange) || spell.GetPrediction(target).Hitchance < HitChance.High)
         return null;
     spell.Cast(target, UsePackets());
     return target;
 }
开发者ID:lanyi777,项目名称:CN,代码行数:12,代码来源:Champion.cs

示例10: castLineSkillShot

 /// <summary>
 ///     Casts a basic line skillshot towards target if hitchance is high
 /// </summary>
 /// <param name="spell"></param>
 /// <param name="damageType"></param>
 /// <returns> target </returns>
 public Obj_AI_Hero castLineSkillShot(Spell spell,
     SimpleTs.DamageType damageType = SimpleTs.DamageType.Physical)
 {
     if (!spell.IsReady())
         return null;
     Obj_AI_Hero target = SimpleTs.GetTarget(spell.Range, damageType);
     if (target == null)
         return null;
     if (!target.IsValidTarget(spell.Range) || spell.GetPrediction(target).Hitchance < HitChance.High)
         return null;
     spell.Cast(target, true);
     return target;
 }
开发者ID:eejjii123,项目名称:LeagueSharp-1,代码行数:19,代码来源:Class1.cs

示例11: castCircleSkillShot

 /// <summary>
 ///     Casts a basic circle skillshot towards target if hitchance is high
 /// </summary>
 /// <param name="spell"></param>
 /// <param name="damageType"></param>
 /// <param name="extrarange"></param>
 /// <returns></returns>
 public Obj_AI_Base castCircleSkillShot(Spell spell,
     SimpleTs.DamageType damageType = SimpleTs.DamageType.Physical, float extrarange = 0)
 {
     if (!spell.IsReady())
         return null;
     Obj_AI_Hero target = SimpleTs.GetTarget(spell.Range + extrarange, damageType);
     if (target == null)
         return null;
     if (target.IsValidTarget(spell.Range + extrarange) &&
         spell.GetPrediction(target).Hitchance >= HitChance.High)
         spell.Cast(target, true);
     return target;
 }
开发者ID:eejjii123,项目名称:LeagueSharp-1,代码行数:20,代码来源:Class1.cs

示例12: DoCast

        public static bool DoCast(Spell spell, Obj_AI_Hero target, HitChance minHitChance, bool colisionCheck=false)
        {
            //  Data.Static.Objects.ProjectLogger.WriteLog("DoCast Call");
            if ((PredictionMethod==0)||((PredictionMethod==1)&&colisionCheck)) //Sebby Colision is broken...lol
            {
                var output=spell.GetPrediction(target);

                if (colisionCheck)
                    if (CheckColision(output))
                        return false;

                if (minHitChance>output.Hitchance)
                    return false;

                spell.Cast(output.CastPosition);
                return true;
            }

            if (PredictionMethod==1)
            {
                var output=SebbyLib.Prediction.Prediction.GetPrediction(target, spell.Delay);

                if (minHitChance>(HitChance)output.Hitchance)
                    return false;

                spell.Cast(output.CastPosition);
                return true;
            }

            if (PredictionMethod==2)
            {
                var output=spell.GetSPrediction(target);

                if (colisionCheck)
                    if (CheckColision(output))
                        return false;

                if (minHitChance>output.HitChance)
                    return false;

                spell.Cast(output.CastPosition);
                return true;
            }

            return false;
        }
开发者ID:KallenStadtfeldGeass,项目名称:KallenSharp,代码行数:46,代码来源:Prediction.cs

示例13: CastSpell

        private static void CastSpell(Spell spell, BuffType x, Obj_AI_Hero target, float lastpostime)
        {
            if (x == BuffType.Stun || x == BuffType.Snare || x == BuffType.Knockup || x == BuffType.Fear)
            {
                if (Game.Time <= lastpostime)
                {
                    spell.Cast(target.ServerPosition);
                }
            }
            else
            {

                var pred = spell.GetPrediction(target);
                if (pred != null && Game.Time <= lastpostime)
                {
                    spell.Cast(pred.CastPosition);
                }
            }
        }
开发者ID:ninja1234567,项目名称:LeagueSharp,代码行数:19,代码来源:Program.cs

示例14: SkillShot

        public static void SkillShot(Obj_AI_Base target,
            Spell spell,
            HitChance hitChance,
            bool aoe = false,
            bool towerCheck = false)
        {
            if (!spell.IsReady())
            {
                return;
            }

            if (target == null || towerCheck && target.UnderTurret(true))
            {
                return;
            }

            spell.UpdateSourcePosition();

            var prediction = spell.GetPrediction(target, aoe);
            if (prediction.Hitchance >= hitChance)
            {
                spell.Cast(prediction.CastPosition);
            }
        }
开发者ID:lukasi273,项目名称:SFX-5.12-update,代码行数:24,代码来源:Casting.cs

示例15: 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


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