private static Creep KillableCreep(bool islaneclear) { var minion = ObjectMgr.GetEntities <Creep>() .Where(creep => creep.IsAlive && me.Distance2D(creep) <= me.GetAttackRange()) .OrderBy(creep => creep.Health).DefaultIfEmpty(null).FirstOrDefault(); double test = 0; if (minion != null) { var missilespeed = GetProjectileSpeed(me); var time = me.IsRanged == false ? 0 : UnitDatabase.GetAttackBackswing(me) + (me.Distance2D(minion) / missilespeed); test = time * minion.AttacksPerSecond * minion.DamageAverage; Console.WriteLine("test " + test + " time " + time + " distance " + me.Distance2D(minion) / missilespeed); if (minion != null && (minion.Health) < GetPhysDamageOnUnit(minion, test)) { if (me.CanAttack()) { return(minion); } } } return(islaneclear == true ? minion : null); }
private void OnUpdate(EventArgs args) { if (!Game.IsInGame || Game.IsPaused || !Menu.ArmletAutoToggle) { return; } if (!Hero.IsAlive || !Hero.CanUseItems()) { return; } var nearEnemies = ObjectManager.GetEntitiesParallel <Unit>() .Where( x => x.IsValid && x.IsAlive && x.IsSpawned && x.AttackCapability != AttackCapability.None && x.Team != HeroTeam && x.Distance2D(Hero) < x.GetAttackRange() + 200); foreach (var enemy in nearEnemies.Where(x => x.AttackCapability == AttackCapability.Melee)) { if (enemy.IsAttacking() && !attackStart.Sleeping(enemy)) { attacking.Sleep((float)UnitDatabase.GetAttackPoint(enemy) * 1000, enemy); attackStart.Sleep(enemy.AttacksPerSecond * 1000 - Game.Ping, enemy); } else if (!enemy.IsAttacking() && attackStart.Sleeping(enemy)) { attackStart.Reset(enemy); attacking.Sleep((float)UnitDatabase.GetAttackBackswing(enemy) * 1000, enemy); } } if (Sleeper.Sleeping) { return; } var heroProjectiles = ObjectManager.TrackingProjectiles.Where(x => x?.Target is Hero && x.Target.Equals(Hero)).ToList(); var noProjectile = heroProjectiles.All( x => x.Position.Distance2D(Hero) / x.Speed > 0.30 || x.Position.Distance2D(Hero) / x.Speed < Game.Ping / 1000); var noAutoAttack = nearEnemies.All(x => x.FindRelativeAngle(Hero.Position) > 0.5 || !attacking.Sleeping(x)); if (Hero.Health < Menu.ArmetHpThreshold && noProjectile && noAutoAttack && (nearEnemies.Any() || heroProjectiles.Any())) { Use(null, null); } }
/// <summary> /// The attack backswing. /// </summary> /// <param name="unit"> /// The unit. /// </param> /// <returns> /// The <see cref="double" />. /// </returns> public static double AttackBackswing(this Unit unit) { return(UnitDatabase.GetAttackBackswing(unit)); }
/// <summary> /// The attack backswing. /// </summary> /// <param name="hero"> /// The hero. /// </param> /// <returns> /// The <see cref="double" />. /// </returns> public static double AttackBackswing(this Hero hero) { return(UnitDatabase.GetAttackBackswing(hero)); }