コード例 #1
0
        public static void HandleQLogic()
        {
            if (!Orbwalking.CanMove(80))
            {
                return;
            }

            if (ObjectManager.Player.Spellbook.IsAutoAttacking || ObjectManager.Player.Spellbook.IsAutoAttacking)
            {
                return;
            }

            if (Variables.spells[SpellSlot.Q].IsEnabledAndReady(false))
            {
                var maxAaRange     = JinxUtility.GetMinigunRange(null) + JinxUtility.GetFishboneRange() + 25f;
                var selectedTarget = TargetSelector.GetTarget(maxAaRange, TargetSelector.DamageType.Physical);
                var jinxBaseRange  = JinxUtility.GetMinigunRange(selectedTarget);

                if (selectedTarget.IsValidTarget())
                {
                    var manaItem      = Variables.Menu.Item($"iseriesr.{ObjectManager.Player.ChampionName.ToLower()}.{Variables.Orbwalker.ActiveMode.ToString().ToLower()}.mm.{SpellSlot.Q.ToString().ToLower()}");
                    var manaCondition = (manaItem != null && ObjectManager.Player.ManaPercent >= manaItem.GetValue <Slider>().Value);

                    if (JinxUtility.IsFishBone())
                    {
                        //If we can kill the target within 3 AAs then don't switch.
                        //Jinx Q uses 20 mana for each AA. So check if we can do the 3 AAs.
                        //And also check if the target is not about to escape our AA range.
                        if (selectedTarget.Health + 5 <= ObjectManager.Player.GetAutoAttackDamage(selectedTarget) * 3 &&
                            (ObjectManager.Player.Mana - 20 * 3 > 0) &&
                            !(selectedTarget.Distance(ObjectManager.Player) > JinxUtility.GetFishboneRange() * 0.9f &&
                              (ObjectManager.Player.ServerPosition.Distance((selectedTarget.ServerPosition.To2D() + selectedTarget.Direction.To2D().Perpendicular() * (300 + 65f)).To3D()) > ObjectManager.Player.Distance(selectedTarget.ServerPosition))
                              ))
                        {
                            return;
                        }

                        //We don't have more mana then set in the menu.
                        if (!manaCondition)
                        {
                            //Swap to minigun
                            Variables.spells[SpellSlot.Q].Cast();
                            return;
                        }

                        //If the distance from the selected target is less than the minigun base range. And it has no enemies in 150 (AOE) range within it.
                        //Swap to minigun.
                        if (ObjectManager.Player.Distance(selectedTarget) < jinxBaseRange && !(selectedTarget.ServerPosition.CountEnemiesInRange(150) >= 2))
                        {
                            Variables.spells[SpellSlot.Q].Cast();
                        }
                    }
                    else
                    {
                        //If the distance is greater than our current AA range or the selected target has enemies in AOE range.
                        //Swap to fishbone
                        if (ObjectManager.Player.Distance(selectedTarget) > jinxBaseRange || (selectedTarget.ServerPosition.CountEnemiesInRange(150) >= 2))
                        {
                            Variables.spells[SpellSlot.Q].Cast();
                        }
                    }
                }
            }
        }
コード例 #2
0
        public static void HandleWLogic()
        {
            var defaultHitchance = HitChance.VeryHigh;

            if (Variables.spells[SpellSlot.W].IsEnabledAndReady())
            {
                //If there are 2 or more enemies in our AA range and our health percentage is lower than
                //the average of theirs then don't fire W.
                //We only get heroes with a priority of 2 or higher, as they are more likely to do more damage to us.

                var enemiesAround = ObjectManager.Player.GetEnemiesInRange(JinxUtility.GetMinigunRange(null));


                if (enemiesAround.Any())
                {
                    //If the enemies around have more average health percent then we do * 1.5f (Since we are an ADC and there might be tanks)
                    //among the enemy team members that surround us.
                    //Or their average combo will do more than 60% of our health in damage.
                    var spellsList = new List <SpellSlot>()
                    {
                        SpellSlot.Q,
                        SpellSlot.W,
                        SpellSlot.E,
                        SpellSlot.R
                    };

                    if (enemiesAround.Count() == 1)
                    {
                        var killableEnemy = enemiesAround.FirstOrDefault(k => k.IsValidTarget());
                        if (killableEnemy != null)
                        {
                            //We are lower health than a tankier enemy and enemy is in melee range. Better put some distance before casting W.
                            if (ObjectManager.Player.Health * 1.4f < killableEnemy.Health && killableEnemy.ServerPosition.Distance(ObjectManager.Player.ServerPosition) <= 350f)
                            {
                                return;
                            }

                            var WPrediction = Variables.spells[SpellSlot.W].GetPrediction(killableEnemy);
                            //if there is only 1 target and it is killable by W and we are not about to die then shoot W and pew pew mode.
                            if (WPrediction.Hitchance >= defaultHitchance &&
                                ObjectManager.Player.HealthPercent > 8 &&
                                HealthPrediction.GetHealthPrediction(killableEnemy, 300) > 0 &&
                                HealthPrediction.GetHealthPrediction(killableEnemy, 300) + 5 < Variables.spells[SpellSlot.W].GetDamage(killableEnemy))
                            {
                                Variables.spells[SpellSlot.W].Cast(WPrediction.CastPosition);
                            }
                        }
                    }

                    if (enemiesAround.Count(m => ProrityHelper.GetPriorityFromDb(m.ChampionName) >= 2) > 1
                        &&
                        (ObjectManager.Player.HealthPercent * 1.5f <=
                         enemiesAround.Where(m => ProrityHelper.GetPriorityFromDb(m.ChampionName) >= 2)
                         .Average(m => m.HealthPercent) ||
                         enemiesAround.Average(enemy => enemy.GetComboDamage(ObjectManager.Player, spellsList) + enemy.GetAutoAttackDamage(ObjectManager.Player) * 2f) >= ObjectManager.Player.Health * 0.60f))
                    {
                        return;
                    }

                    //If there are 3 enemies which are not low health, always return.
                    if (enemiesAround.Count(en => en.HealthPercent > 20) > 3)
                    {
                        return;
                    }
                }

                var selectedTarget = TargetSelector.GetTarget(Variables.spells[SpellSlot.W].Range * 0.65f,
                                                              TargetSelector.DamageType.Physical);

                if (selectedTarget.IsValidTarget())
                {
                    //Since we already determined  the conditions for not firing W when enemies are in our AA range
                    //We can now not do any check here and just fire W.
                    var WPrediction = Variables.spells[SpellSlot.W].GetPrediction(selectedTarget);
                    //Cast the spell using prediction.
                    if (WPrediction.Hitchance >= defaultHitchance)
                    {
                        //Don't use W to poke under enemy turret unless the target is killable.
                        if (ObjectManager.Player.UnderTurret(true) &&
                            HealthPrediction.GetHealthPrediction(selectedTarget, 300) + 5 > Variables.spells[SpellSlot.W].GetDamage(selectedTarget))
                        {
                            return;
                        }

                        Variables.spells[SpellSlot.W].Cast(WPrediction.CastPosition);
                    }
                }
            }
        }