/// <summary> /// Determines whether [is valid target] [the specified hero]. /// </summary> /// <param name="hero"> /// The hero. /// </param> /// <param name="range"> /// The range. /// </param> /// <param name="damageType"> /// Type of the damage. /// </param> /// <param name="ignoreShields"> /// Indicates whether to ignore shields. /// </param> /// <param name="from">The from location.</param> /// <returns> /// The <see cref="bool" />. /// </returns> private static bool IsValidTarget( Obj_AI_Hero hero, float range, DamageType damageType, bool ignoreShields = true, Vector3 from = default(Vector3)) { return hero.IsValidTarget() && hero.DistanceSquared(@from.Equals(default(Vector3)) ? GameObjects.Player.ServerPosition : @from) < Math.Pow(range <= 0 ? hero.GetRealAutoAttackRange() : range, 2) && !Invulnerable.Check(hero, damageType, ignoreShields); }