public static AIHeroClient GetBetterTarget(float range, TargetSelector.DamageType damageType, bool ignoreShield = true, IEnumerable <AIHeroClient> ignoredChamps = null, Vector3?rangeCheckFrom = null, TargetSelector.TargetSelectionConditionDelegate conditions = null) { var target = TargetSelector.GetTarget( range, damageType, ignoreShield, ignoredChamps, rangeCheckFrom, conditions); var selected = TargetSelector.GetSelectedTarget(); if (CommonMenu.Item("TargetSelectorSpellOnlyFocused").GetValue <bool>() && selected != null && player.ChampionName != "Gangplank" && selected.Distance(player) < CommonMenu.Item("TargetSelectorSpellOnlyRange").GetValue <Slider>().Value) { if (selected.Distance(player) < range && selected.IsValidTarget()) { return(selected); } else { return(null); } } else { return(target); } }
void Combo() { Obj_AI_Hero target = null; TargetSelector.TargetSelectionConditionDelegate conditions = targ => targ.IsIsolated() || targ.Health <= GetBurstDamage(targ); float targetSelectionRange = Khazix.AttackRange; if (SpellSlot.Q.IsReady()) { targetSelectionRange += Q.Range; } if (SpellSlot.E.IsReady()) { targetSelectionRange += E.Range; } else if (SpellSlot.W.IsReady()) { targetSelectionRange += W.Range; } //Get Optimal target if available target = TargetSelector.GetTarget(targetSelectionRange, TargetSelector.DamageType.Physical, true, null, null, conditions); //If could not find then settle for anything if (target == null) { target = TargetSelector.GetTarget(targetSelectionRange, TargetSelector.DamageType.Physical, true, null, null); } //If a target has been found if ((target != null && target.IsValidEnemy())) { var dist = Khazix.Distance(target.ServerPosition); // Normal abilities if (Config.GetBool("UseQCombo") && Q.IsReady() && !Jumping) { if (dist <= Q.Range) { Q.Cast(target); } } if (Config.GetBool("UseWCombo") && W.IsReady() && !EvolvedW && dist <= W.Range) { var pred = W.GetPrediction(target); if (pred.Hitchance >= Config.GetHitChance("WHitchance")) { W.Cast(pred.CastPosition); } } if (Config.GetBool("UseECombo") && E.IsReady() && !Jumping && dist <= E.Range && dist > Q.Range + (0.4 * Khazix.MoveSpeed)) { var jump = GetJumpPosition(target); if (jump.shouldJump) { E.Cast(jump.position); } } // Use EQ if ((Config.GetBool("UseEGapcloseQ") && Q.IsReady() && E.IsReady() && dist > Q.Range + (0.4 * Khazix.MoveSpeed) && dist <= E.Range + Q.Range)) { var jump = GetJumpPosition(target); if (jump.shouldJump) { E.Cast(jump.position); } if (Config.GetBool("UseRGapcloseL") && R.IsReady()) { R.CastOnUnit(Khazix); } } // Ult Usage if (R.IsReady() && !Q.IsReady() && !W.IsReady() && !E.IsReady() && Config.GetBool("UseRCombo") && Khazix.CountEnemiesInRange(500) > 0) { R.Cast(); } // Evolved if (W.IsReady() && EvolvedW && dist <= WE.Range && Config.GetBool("UseWCombo")) { PredictionOutput pred = WE.GetPrediction(target); if (pred.Hitchance >= Config.GetHitChance("WHitchance")) { CastWE(target, pred.UnitPosition.To2D(), 0, Config.GetHitChance("WHitchance")); } if (pred.Hitchance >= HitChance.Collision) { List <Obj_AI_Base> PCollision = pred.CollisionObjects; var x = PCollision.Where(PredCollisionChar => PredCollisionChar.Distance(target) <= 30).FirstOrDefault(); if (x != null) { W.Cast(x.Position); } } } if (Config.GetBool("Combo.Smite")) { if (SmiteManager.CanCast(target)) { SmiteManager.Cast(target); } } if (Config.GetBool("UseItems")) { UseItems(target); } } }