Example #1
0
        private bool HasAnyTarget(AWizard self, bool skipBuildings)
        {
            var my = new AWizard(self);

            foreach (var opp in OpponentCombats)
            {
                if (!opp.IsAssailable)
                {
                    continue;
                }

                var prevCastRange = my.CastRange;

                var bld = opp as ABuilding;
                if (opp is AWizard)
                {
                    if (my.CastRange <= opp.CastRange)
                    {
                        if (GoAwayCond(my, opp as AWizard))
                        {
                            my.CastRange = opp.CastRange + GoAwaySafeDist;
                        }
                        else if (my.CastRange < opp.CastRange)
                        {
                            my.CastRange = my.CastRange + 25; // HACK: чтобы не бояться подходить к тем у кого прокачан range
                        }
                    }
                }
                if (bld != null && (skipBuildings || bld.IsBase))
                {
                    if (!bld.IsBase && bld.Lane != MessagesObserver.GetLane())
                    {
                        continue;
                    }

                    if (!bld.IsBesieded)
                    {
                        // чтобы не подходить близко к одиноким башням
                        if (my.GetDistanceTo(bld) < bld.CastRange + 6)
                        {
                            return(true);
                        }
                    }
                }

                if (my.GetDistanceTo(opp) <= my.CastRange + opp.Radius + Game.MagicMissileRadius)
                {
                    var tmp = opp.RemainingFrozen;
                    opp.RemainingFrozen = 100500;
                    var canCast = my.EthalonCanCastMagicMissile(opp, checkCooldown: false, checkAngle: false);
                    opp.RemainingFrozen = tmp;
                    if (canCast)
                    {
                        return(true);
                    }
                }

                my.CastRange = prevCastRange;
            }
            return(false);
        }