public override void Execute(Obj_AI_Hero target) { //Console.WriteLine(Delay); var bestPosFacing = GetBestPosition(HeroManager.Enemies.Where(item => item.IsFacingMe())); if (MinTargetsFacing <= bestPosFacing?.Item2) { Cast(bestPosFacing.Item1); return; } var bestPos = GetBestPosition(HeroManager.Enemies); if (bestPos?.Item2 >= MinTargetsNotFacing) { Cast(bestPos.Item1); return; } if (UltOnKillable && Provider.GetComboDamage(target) > target.Health && target.IsFacingMe() && target.HealthPercent > MinHealth && target.IsValidTarget() || PanicModeHealth > ObjectManager.Player.HealthPercent || BurstMode.IsActive()) { var targetPos = CassW.GetMovementPrediction(target); if (targetPos.Distance(ObjectManager.Player.Position, true) < Range * Range) { Cast(targetPos); } } }
public override void Execute(Obj_AI_Hero target) { //Console.WriteLine(Delay); if (MinEnemiesOnlyInCombo) { TryMassUlt(); } if (!target.IsValidTarget()) { return; } if (UltOnKillable && Provider.GetComboDamage(target) > target.Health && target.IsFacingMe() && target.HealthPercent > MinHealth || PanicModeHealth > ObjectManager.Player.HealthPercent || BurstMode.IsActive()) { var targetPos = CassW.GetMovementPrediction(target); if (targetPos.Distance(ObjectManager.Player.Position, true) < Range * Range) { Cast(targetPos); } } }
public Tuple <Vector3, int> GetBestPosition(IEnumerable <Obj_AI_Base> targets) { var preds = Grouped(targets.Where(enemy => enemy.IsValidTarget(Range + enemy.MoveSpeed * Delay)).Select(item => CassW.GetMovementPrediction(item, Delay)).Where(pred => { var dst = pred.Distance(ObjectManager.Player.Position, true); return(dst < Range * Range); }).ToArray()); if (preds.Count > 0) { var final = new Vector3(); for (var i = 0; i < preds.Count; i++) { final.X += preds[i].X; final.Y += preds[i].Y; } final.X /= preds.Count; final.Y /= preds.Count; return(new Tuple <Vector3, int>(final, preds.Count)); } return(null); }