Replace some .Any checks with explicit .Count checks in AI
This commit is contained in:
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
var enemyUnits = owner.World.FindActorsInCircle(owner.TargetActor.CenterPosition, WDist.FromCells(owner.Bot.Info.IdleScanRadius))
|
||||
.Where(unit => owner.Bot.Player.Stances[unit.Owner] == Stance.Enemy).ToList();
|
||||
|
||||
if (!enemyUnits.Any())
|
||||
if (enemyUnits.Count == 0)
|
||||
return;
|
||||
|
||||
if (AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemyUnits))
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
var enemyUnits = owner.World.FindActorsInCircle(owner.TargetActor.CenterPosition, WDist.FromCells(owner.Bot.Info.IdleScanRadius))
|
||||
.Where(unit => owner.Bot.Player.Stances[unit.Owner] == Stance.Enemy).ToList();
|
||||
|
||||
if (!enemyUnits.Any())
|
||||
if (enemyUnits.Count == 0)
|
||||
return;
|
||||
|
||||
if (AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemyUnits))
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
var location = squad.Bot.GetRandomBaseCenter();
|
||||
var buildings = squad.World.ActorsHavingTrait<Building>()
|
||||
.Where(a => a.Owner == squad.Bot.Player).ToList();
|
||||
if (buildings.Any())
|
||||
if (buildings.Count > 0)
|
||||
location = buildings.Random(squad.Random).Location;
|
||||
|
||||
return location;
|
||||
|
||||
Reference in New Issue
Block a user