From a544bc966b278ef350536c521f49107ea3429579 Mon Sep 17 00:00:00 2001 From: earthpig Date: Sat, 28 Apr 2012 22:45:16 -0700 Subject: [PATCH] #2048 fixed: make AI behavior more varied --- OpenRA.Mods.RA/AI/HackyAI.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.RA/AI/HackyAI.cs b/OpenRA.Mods.RA/AI/HackyAI.cs index 21ebf35f50..5145b3bc21 100644 --- a/OpenRA.Mods.RA/AI/HackyAI.cs +++ b/OpenRA.Mods.RA/AI/HackyAI.cs @@ -275,10 +275,13 @@ namespace OpenRA.Mods.RA.AI activeUnits.Add(a); } - + /* Create an attack force when we have enough units around our base. */ // (don't bother leaving any behind for defense.) - if (unitsHangingAroundTheBase.Count >= Info.SquadSize) + + int randomizedSquadSize = Info.SquadSize - 4 + random.Next(200); + + if (unitsHangingAroundTheBase.Count >= randomizedSquadSize) { BotDebug("Launch an attack."); @@ -314,7 +317,7 @@ namespace OpenRA.Mods.RA.AI // Check how many own units we have gathered nearby... var ownUnits = world.FindUnitsInCircle(a1.CenterLocation, Game.CellSize * 2) .Where(unit => unit.Owner == p).ToList(); - if (ownUnits.Count < Info.SquadSize) + if (ownUnits.Count < randomizedSquadSize) { // Not enough to attack. Send more units. world.IssueOrder(new Order("Stop", a1, false)); @@ -464,4 +467,4 @@ namespace OpenRA.Mods.RA.AI aggro[e.Attacker.Owner].Aggro += e.Damage; } } -} +} \ No newline at end of file