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


C# Spell.Skillshot.GetPrediction方法代码示例

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


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

示例1: Main

        public static void Main(string[] args)
        {
            Loading.OnLoadingComplete += delegate
            {
                if (Player.Instance.ChampionName != "Blitzcrank")
                {
                    return;
                }

                #region Menu Stuff

                var menu = MainMenu.AddMenu("Blitzcrank", "blitziii");

                menu.AddGroupLabel("Hitchance");
                var hitchances = new List<HitChance>();
                for (var i = (int) HitChance.Medium; i <= (int) HitChance.Immobile; i++)
                {
                    hitchances.Add((HitChance) i);
                }
                var slider = new Slider(hitchances[0].ToString(), 0, 0, hitchances.Count - 1);
                slider.OnValueChange += delegate(ValueBase<int> sender, ValueBase<int>.ValueChangeArgs changeArgs) { slider.DisplayName = hitchances[changeArgs.NewValue].ToString(); };
                menu.Add("hitchance", slider);

                if (HeroManager.Enemies.Count > 0)
                {
                    menu.AddSeparator();
                    menu.AddGroupLabel("Enabled targets");
                    var addedChamps = new List<string>();
                    foreach (var enemy in HeroManager.Enemies.Where(enemy => !addedChamps.Contains(enemy.ChampionName)))
                    {
                        addedChamps.Add(enemy.ChampionName);
                        menu.Add(enemy.ChampionName, new CheckBox(string.Format("{0} ({1})", enemy.ChampionName, enemy.Name)));
                    }
                }

                menu.AddSeparator();
                menu.AddGroupLabel("Drawings");
                var qRange = menu.Add("rangeQ", new CheckBox("Q range"));
                var predictions = menu.Add("predictions", new CheckBox("Visualize prediction"));

                #endregion

                var Q = new Spell.Skillshot(SpellSlot.Q, 925, SkillShotType.Linear, 250, 1800, 70);
                var predictedPositions = new Dictionary<int, Tuple<int, PredictionResult>>();

                Game.OnTick += delegate
                {
                    if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo) && Q.IsReady())
                    {
                        foreach (var enemy in HeroManager.Enemies.Where(enemy => menu[enemy.ChampionName].Cast<CheckBox>().CurrentValue &&
                                                                                 enemy.IsValidTarget(Q.Range + 150)))
                        {
                            var prediction = Q.GetPrediction(enemy);
                            if (prediction.HitChance >= hitchances[0])
                            {
                                predictedPositions[enemy.NetworkId] = new Tuple<int, PredictionResult>(Environment.TickCount, prediction);

                                // Cast if hitchance is high enough
                                if (prediction.HitChance >= hitchances[slider.CurrentValue])
                                {
                                    Q.Cast(prediction.CastPosition);
                                }
                            }
                        }
                    }
                };

                Drawing.OnDraw += delegate
                {
                    if (qRange.CurrentValue && Q.IsLearned)
                    {
                        Circle.Draw(Q.IsReady() ? Color.Blue : Color.Red, Q.Range, Player.Instance.Position);
                    }

                    if (!predictions.CurrentValue)
                    {
                        return;
                    }

                    foreach (var prediction in predictedPositions.ToArray())
                    {
                        if (Environment.TickCount - prediction.Value.Item1 > 1500)
                        {
                            predictedPositions.Remove(prediction.Key);
                            continue;
                        }

                        Circle.Draw(Color.Red, 75, prediction.Value.Item2.CastPosition);
                        Line.DrawLine(System.Drawing.Color.GreenYellow, Player.Instance.Position, prediction.Value.Item2.CastPosition);
                        Line.DrawLine(System.Drawing.Color.CornflowerBlue, HeroManager.Enemies.Find(o => o.NetworkId == prediction.Key).Position, prediction.Value.Item2.CastPosition);
                        Drawing.DrawText(prediction.Value.Item2.CastPosition.WorldToScreen() + new Vector2(0, -20), System.Drawing.Color.LimeGreen,
                            string.Format("Hitchance: {0}%", Math.Ceiling(prediction.Value.Item2.HitChancePercent)), 10);
                    }
                };
            };
        }
开发者ID:jonibahu,项目名称:EloBuddy-Addons,代码行数:96,代码来源:Program.cs

示例2: OnLoaded


//.........这里部分代码省略.........
            MiscMenu.Add("useexhaust", new CheckBox("Use Exhaust"));
            foreach (var source in ObjectManager.Get<AIHeroClient>().Where(a => a.IsEnemy))
            {
                MiscMenu.Add(source.ChampionName + "exhaust",
                    new CheckBox("Exhaust " + source.ChampionName, false));
            }

            DrawMenu = MorgMenu.AddSubMenu("Drawings", "drawings");
            DrawMenu.AddGroupLabel("Drawings");
            DrawMenu.AddSeparator();
            DrawMenu.Add("drawq", new CheckBox("Draw Q"));
            DrawMenu.Add("draww", new CheckBox("Draw W"));
            DrawMenu.Add("drawe", new CheckBox("Draw E"));
            DrawMenu.Add("drawr", new CheckBox("Draw R"));
            DrawMenu.Add("drawaa", new CheckBox("Draw AA"));
            DrawMenu.Add("predictions", new CheckBox("Visualize Q Prediction"));

            LaneClear = MorgMenu.AddSubMenu("Lane Clear", "laneclear");
            LaneClear.AddGroupLabel("Lane Clear Settings");
            LaneClear.Add("LCW", new CheckBox("Use W"));

            LastHit = MorgMenu.AddSubMenu("Last Hit", "lasthit");
            LastHit.AddGroupLabel("Last Hit Settings");
            LastHit.Add("LHQ", new CheckBox("Use Q", false));

            Interrupter.OnInterruptableSpell += Interrupter_OnInterruptableSpell;
            Game.OnUpdate += OnUpdate;
            Orbwalker.OnPreAttack += Orbwalker_OnPreAttack;
            Obj_AI_Base.OnProcessSpellCast += Auto_EOnProcessSpell;
            Gapcloser.OnGapcloser += Gapcloser_OnGapcloser;
            Drawing.OnDraw += delegate
            {
                if (!Me.IsDead)
                {
                    if (DrawMenu["drawr"].Cast<CheckBox>().CurrentValue && R.IsLearned)
                    {
                        Circle.Draw(Color.Red, R.Range, Player.Instance.Position);
                    }
                    if (DrawMenu["draww"].Cast<CheckBox>().CurrentValue && W.IsLearned)
                    {
                        Circle.Draw(Color.Purple, W.Range, Player.Instance.Position);
                    }
                    if (DrawMenu["drawe"].Cast<CheckBox>().CurrentValue && E.IsLearned)
                    {
                        Circle.Draw(Color.Green, E.Range, Player.Instance.Position);
                    }
                    if (DrawMenu["drawaa"].Cast<CheckBox>().CurrentValue)
                    {
                        Circle.Draw(Color.Blue, Q.Range, Player.Instance.Position);
                    }
                    var predictedPositions = new Dictionary<int, Tuple<int, PredictionResult>>();
                    var predictions = DrawMenu["predictions"].Cast<CheckBox>().CurrentValue;
                    var qRange = DrawMenu["drawq"].Cast<CheckBox>().CurrentValue;

                    foreach (
                        var enemy in
                            EntityManager.Heroes.Enemies.Where(
                                enemy => QMenu["bind" + enemy.ChampionName].Cast<CheckBox>().CurrentValue &&
                                         enemy.IsValidTarget(Q.Range + 150) &&
                                         !enemy.HasBuffOfType(BuffType.SpellShield)))
                    {
                        var predictionsq = Q.GetPrediction(enemy);
                        predictedPositions[enemy.NetworkId] = new Tuple<int, PredictionResult>(Environment.TickCount,
                            predictionsq);
                        if (qRange && Q.IsLearned)
                        {
                            Circle.Draw(Q.IsReady() ? Color.Blue : Color.Red, Q.Range,
                                Player.Instance.Position);
                        }

                        if (!predictions)
                        {
                            return;
                        }

                        foreach (var prediction in predictedPositions.ToArray())
                        {
                            if (Environment.TickCount - prediction.Value.Item1 > 2000)
                            {
                                predictedPositions.Remove(prediction.Key);
                                continue;
                            }

                            Circle.Draw(Color.Red, 75, prediction.Value.Item2.CastPosition);
                            Line.DrawLine(System.Drawing.Color.GreenYellow, Player.Instance.Position,
                                prediction.Value.Item2.CastPosition);
                            Line.DrawLine(System.Drawing.Color.CornflowerBlue,
                                EntityManager.Heroes.Enemies.Find(o => o.NetworkId == prediction.Key).Position,
                                prediction.Value.Item2.CastPosition);
                            Drawing.DrawText(prediction.Value.Item2.CastPosition.WorldToScreen() + new Vector2(0, -20),
                                System.Drawing.Color.LimeGreen,
                                string.Format("Hitchance: {0}%", Math.Ceiling(prediction.Value.Item2.HitChancePercent)),
                                10);
                        }
                    }
                    ;
                }
                ;
            };
        }
开发者ID:globalik,项目名称:EloBuddy,代码行数:101,代码来源:Program.cs

示例3: OnTick


//.........这里部分代码省略.........
                                {
                                    E.Cast(target);
                                }
                            }
                        }
                    }

                    if (useR)
                    {
                        if (RIsReadyPerfectly())
                        {
                            if (!manaW || W.Level <= 0 || myHero.Mana - getSpellMana(SpellSlot.R) >= getSpellMana(SpellSlot.W))
                            {
                                if (myHero.GetBuffCount("kogmawlivingartillerycost") < rLimit)
                                {
                                    var target = TargetSelector.GetTarget(R.Range, DamageType.Magical);
                                    if (target != null)
                                    {
                                        if (onlyRHP)
                                        {
                                            if (target.HealthPercent < hpOfTarget)
                                            {
                                                R.Cast(target);
                                            }
                                        }
                                        else
                                        {
                                            R.Cast(target);
                                        }
                                    }
                                }
                                else
                                {
                                    var killableTarget = EntityManager.Heroes.Enemies.FirstOrDefault(x => x.IsKillableAndValidTarget(myHero.GetSpellDamage(x, SpellSlot.R), DamageType.Magical, R.Range) && R.GetPrediction(x).HitChance >= HitChance.High);
                                    if (killableTarget != null)
                                    {
                                        R.Cast(killableTarget);
                                    }
                                }
                            }
                        }
                    }
                }
                else if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Harass))
                {
                    if (useQH)
                    {
                        if (QIsReadyPerfectly())
                            if (myHero.IsManaPercentOkay(manaH))
                            {
                                var target = TargetSelector.GetTarget(Q.Range, DamageType.Magical);
                                if (target != null)
                                    Q.Cast(target);
                            }
                    }

                    if (useEH)
                    {
                        if (EIsReadyPerfectly())
                            if (myHero.IsManaPercentOkay(manaH))
                            {
                                var target = TargetSelector.GetTarget(E.Range, DamageType.Magical);
                                if (target != null)
                                    E.Cast(target);
                            }
                    }
开发者ID:Xelamats,项目名称:PortAIO,代码行数:67,代码来源:Program.cs

示例4: IsCondemnable

        public static bool IsCondemnable(AIHeroClient hero)
        {
            if (!hero.IsValidTarget(550f) || hero.HasBuffOfType(BuffType.SpellShield) ||
                hero.HasBuffOfType(BuffType.SpellImmunity) || hero.IsDashing())
                return false;

            //values for pred calc pP = player position; p = enemy position; pD = push distance
            var pP = ObjectManager.Player.ServerPosition;
            var p = hero.ServerPosition;
            var pD = MenuGenerator.EMenu["EPushDist"].Cast<Slider>().CurrentValue;
            var mode = MenuGenerator.EMenu["EMode"].Cast<Slider>().CurrentValue;

            if (mode == 0 && (IsCollisionable(p.ExtendVector3(pP, -pD)) || IsCollisionable(p.ExtendVector3(pP, -pD / 2f)) ||
                 IsCollisionable(p.ExtendVector3(pP, -pD / 3f))))
            {
                if (!hero.CanMove ||
                    (hero.Spellbook.IsAutoAttacking))
                    return true;

                var enemiesCount = ObjectManager.Player.CountEnemiesInRange(1200);
                if (enemiesCount > 1 && enemiesCount <= 3)
                {
                    Spell.Skillshot E = new Spell.Skillshot(SpellSlot.E, 550, SkillShotType.Linear, (int) 0.25f, (int?) 2200f);
                    var prediction = E.GetPrediction(hero);
                    for (var i = 15; i < pD; i += 75)
                    {
                        var posFlags = NavMesh.GetCollisionFlags(
                            prediction.UnitPosition.To2D()
                                .Extend(
                                    pP.To2D(),
                                    -i)
                                .To3D());
                        if (posFlags.HasFlag(CollisionFlags.Wall) || posFlags.HasFlag(CollisionFlags.Building))
                        {
                            return true;
                        }
                    }
                    return false;
                }
                else
                {
                    var hitchance = MenuGenerator.EMenu["EHitchance"].Cast<Slider>().CurrentValue;
                    var angle = 0.20 * hitchance;
                    const float travelDistance = 0.5f;
                    var alpha = new Vector2((float)(p.X + travelDistance * Math.Cos(Math.PI / 180 * angle)),
                        (float)(p.X + travelDistance * Math.Sin(Math.PI / 180 * angle)));
                    var beta = new Vector2((float)(p.X - travelDistance * Math.Cos(Math.PI / 180 * angle)),
                        (float)(p.X - travelDistance * Math.Sin(Math.PI / 180 * angle)));

                    for (var i = 15; i < pD; i += 100)
                    {
                        if (IsCollisionable(pP.To2D().Extend(alpha,
                                i)
                            .To3D()) && IsCollisionable(pP.To2D().Extend(beta, i).To3D()))
                            return true;
                    }
                    return false;
                }
            }

            if (mode == 1 &&
                (IsCollisionable(p.ExtendVector3(pP, -pD)) || IsCollisionable(p.ExtendVector3(pP, -pD / 2f)) ||
                 IsCollisionable(p.ExtendVector3(pP, -pD / 3f))))
            {
                if (!hero.CanMove ||
                    (hero.Spellbook.IsAutoAttacking))
                    return true;

                var hitchance = MenuGenerator.EMenu["EHitchance"].Cast<Slider>().CurrentValue;
                var angle = 0.20 * hitchance;
                const float travelDistance = 0.5f;
                var alpha = new Vector2((float)(p.X + travelDistance * Math.Cos(Math.PI / 180 * angle)),
                    (float)(p.X + travelDistance * Math.Sin(Math.PI / 180 * angle)));
                var beta = new Vector2((float)(p.X - travelDistance * Math.Cos(Math.PI / 180 * angle)),
                    (float)(p.X - travelDistance * Math.Sin(Math.PI / 180 * angle)));

                for (var i = 15; i < pD; i += 100)
                {
                    if (IsCollisionable(pP.To2D().Extend(alpha,
                            i)
                        .To3D()) && IsCollisionable(pP.To2D().Extend(beta, i).To3D()))
                        return true;
                }
                return false;
            }

            if (mode == 8)
            {
                if (!hero.CanMove ||
                    (hero.Spellbook.IsAutoAttacking))
                    return true;

                var hitchance = MenuGenerator.EMenu["EHitchance"].Cast<Slider>().CurrentValue;
                var angle = 0.20 * hitchance;
                const float travelDistance = 0.5f;
                var alpha = new Vector2((float)(p.X + travelDistance * Math.Cos(Math.PI / 180 * angle)),
                    (float)(p.X + travelDistance * Math.Sin(Math.PI / 180 * angle)));
                var beta = new Vector2((float)(p.X - travelDistance * Math.Cos(Math.PI / 180 * angle)),
                    (float)(p.X - travelDistance * Math.Sin(Math.PI / 180 * angle)));

//.........这里部分代码省略.........
开发者ID:roaxtreil,项目名称:EBRepo,代码行数:101,代码来源:CondemnLogicProvider.cs


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