public static bool InAnyOfTowersRange(Vector3 self, List <Units> towers)
 {
     if (towers == null)
     {
         return(false);
     }
     foreach (Units current in towers)
     {
         if (HeroTargetingSystem.IsInrange(self, current.mTransform.position, current.attack_range + 1f))
         {
             return(true);
         }
     }
     return(false);
 }
        public static bool IfChooseTarget(Units owner, Units target, bool isKillTarget = false, float range = 0f)
        {
            if (target == null || !target.isLive || !TeamManager.CanAttack(owner, target) || !target.CanBeSelected || target.isBuilding || target.isItem || (target.isMonster && target.teamType == 2) || !owner.CanBeSelected)
            {
                return(false);
            }
            if (!isKillTarget && target.isHero && UnitFeature.DistanceToTarget(owner.transform, target.transform) > owner.warning_range)
            {
                return(false);
            }
            Units home = MapManager.Instance.GetHome((TeamType)target.teamType);

            if (home == null)
            {
                return(true);
            }
            if (owner.MeiHuo.IsInState)
            {
                return(true);
            }
            if (range != 0f && !HeroTargetingSystem.IsInrange(owner.mTransform.position, target.mTransform.position, range))
            {
                return(false);
            }
            bool        arg_10E_0 = !StrategyManager.Instance.IsAuto() && owner.isPlayer;
            UtilCounter counter   = UtilManager.Instance.GetCounter(UtilType.Tower);

            if (counter != null)
            {
                TowerCounter towerCounter          = counter as TowerCounter;
                Units        towerOfLowestPriority = towerCounter.GetTowerOfLowestPriority(owner);
                if (towerOfLowestPriority != null)
                {
                    float num  = UnitFeature.DistanceToTargetSqr(owner.transform, towerOfLowestPriority.transform);
                    float num2 = UnitFeature.DistanceToTargetSqr(owner.transform, target.transform);
                    if (num2 > num)
                    {
                        return(false);
                    }
                }
            }
            bool flag = StrategyManager.Instance.IsHomeRecovery((TeamType)target.teamType);

            if (flag)
            {
                Vector3 recoveryPos = StrategyManager.Instance.GetRecoveryPos((TeamType)target.teamType);
                if (HeroTargetingSystem.IsInrange(target.transform.position, recoveryPos, 3f))
                {
                    return(false);
                }
            }
            Units nearestEnemyTowerOfTarget = TargetSelectHelper.GetNearestEnemyTowerOfTarget(target);

            if (nearestEnemyTowerOfTarget != null)
            {
                float attackRange = nearestEnemyTowerOfTarget.GetAttackRange(owner);
                if (HeroTargetingSystem.IsInrange(target.transform.position, nearestEnemyTowerOfTarget.transform.position, attackRange))
                {
                    float num3 = UnitFeature.DistanceToTarget(target, nearestEnemyTowerOfTarget);
                    if (owner.GetAttackRange(target) + num3 > attackRange && !HeroTargetingSystem.IsInrange(owner.transform.position, nearestEnemyTowerOfTarget.transform.position, attackRange))
                    {
                        return(true);
                    }
                    Units attackTarget = nearestEnemyTowerOfTarget.GetAttackTarget();
                    if (attackTarget != null && attackTarget == owner)
                    {
                        return(false);
                    }
                    List <Units> allians = TargetSelectHelper.GetAllians(nearestEnemyTowerOfTarget, attackRange, TargetTag.Monster, false);
                    return(allians != null && allians.Count > 1 && !target.isHero);
                }
            }
            return(true);
        }