#2048 fixed: make AI behavior more varied

This commit is contained in:
earthpig
2012-04-28 22:45:16 -07:00
committed by Chris Forbes
parent 9a3aae6586
commit a544bc966b

View File

@@ -278,7 +278,10 @@ namespace OpenRA.Mods.RA.AI
/* Create an attack force when we have enough units around our base. */ /* Create an attack force when we have enough units around our base. */
// (don't bother leaving any behind for defense.) // (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."); BotDebug("Launch an attack.");
@@ -314,7 +317,7 @@ namespace OpenRA.Mods.RA.AI
// Check how many own units we have gathered nearby... // Check how many own units we have gathered nearby...
var ownUnits = world.FindUnitsInCircle(a1.CenterLocation, Game.CellSize * 2) var ownUnits = world.FindUnitsInCircle(a1.CenterLocation, Game.CellSize * 2)
.Where(unit => unit.Owner == p).ToList(); .Where(unit => unit.Owner == p).ToList();
if (ownUnits.Count < Info.SquadSize) if (ownUnits.Count < randomizedSquadSize)
{ {
// Not enough to attack. Send more units. // Not enough to attack. Send more units.
world.IssueOrder(new Order("Stop", a1, false)); world.IssueOrder(new Order("Stop", a1, false));