From 0a79109d019ea43351b955af4d94148775b97b2a Mon Sep 17 00:00:00 2001 From: Zimmermann Gyula Date: Tue, 1 Sep 2015 23:01:37 +0200 Subject: [PATCH 1/2] Implement HackyAI->UnitLimits. --- OpenRA.Mods.Common/AI/HackyAI.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/AI/HackyAI.cs b/OpenRA.Mods.Common/AI/HackyAI.cs index 883bde6886..7004ef9794 100644 --- a/OpenRA.Mods.Common/AI/HackyAI.cs +++ b/OpenRA.Mods.Common/AI/HackyAI.cs @@ -116,6 +116,9 @@ namespace OpenRA.Mods.Common.AI [Desc("What units to the AI should build.", "What % of the total army must be this type of unit.")] public readonly Dictionary UnitsToBuild = null; + [Desc("What units should the AI have a maximum limit to train.")] + public readonly Dictionary UnitLimits = null; + [Desc("What buildings to the AI should build.", "What % of the total base must be this type of building.")] public readonly Dictionary BuildingFractions = null; @@ -125,7 +128,7 @@ namespace OpenRA.Mods.Common.AI [Desc("Tells the AI what building types fall under the same common name.")] public readonly Dictionary BuildingCommonNames = null; - [Desc("What buildings should the AI have max limits n.", "What is the limit of the building.")] + [Desc("What buildings should the AI have a maximum limit to build.")] public readonly Dictionary BuildingLimits = null; // TODO Update OpenRA.Utility/Command.cs#L300 to first handle lists and also read nested ones @@ -984,7 +987,11 @@ namespace OpenRA.Mods.Common.AI ChooseRandomUnitToBuild(queue) : ChooseUnitToBuild(queue); - if (unit != null && Info.UnitsToBuild.Any(u => u.Key == unit.Name)) + if (unit != null + && Info.UnitsToBuild.ContainsKey(unit.Name) + && (!Info.UnitLimits.ContainsKey(unit.Name) + || World.Actors.Count(a => a.Info.Name == unit.Name && a.Owner == Player) < Info.UnitLimits[unit.Name])) + QueueOrder(Order.StartProduction(queue.Actor, unit.Name, 1)); } From 11c5144cb490a5e14c9b43ce1404db5cfdd5bdd6 Mon Sep 17 00:00:00 2001 From: Zimmermann Gyula Date: Tue, 1 Sep 2015 19:25:13 +0200 Subject: [PATCH 2/2] Restore AI kennel usage, limit AI harvesters and dogs. --- mods/cnc/rules/ai.yaml | 12 +++++++++--- mods/d2k/rules/ai.yaml | 12 +++++++++--- mods/ra/rules/ai.yaml | 20 ++++++++++++++++++++ mods/ts/rules/ai.yaml | 3 +++ 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/mods/cnc/rules/ai.yaml b/mods/cnc/rules/ai.yaml index 26f617b20a..056f2390c0 100644 --- a/mods/cnc/rules/ai.yaml +++ b/mods/cnc/rules/ai.yaml @@ -52,7 +52,7 @@ Player: e2: 10% e4: 7% e5: 5% - harv: 1% + harv: 10% bggy: 5% bike: 40% ltnk: 25% @@ -65,6 +65,8 @@ Player: htnk: 50% heli: 5% orca: 5% + UnitLimits: + harv: 8 SquadSize: 15 SupportPowerDecision@Airstrike: OrderName: AirstrikePowerInfoOrder @@ -171,7 +173,7 @@ Player: e3: 30% e4: 30% e5: 30% - harv: 1% + harv: 10% bggy: 10% ftnk: 10% arty: 40% @@ -184,6 +186,8 @@ Player: htnk: 50% jeep: 20% mtnk: 50% + UnitLimits: + harv: 8 SquadSize: 15 SupportPowerDecision@Airstrike: OrderName: AirstrikePowerInfoOrder @@ -290,7 +294,7 @@ Player: e3: 30% e4: 50% e5: 50% - harv: 6% + harv: 16% bggy: 10% bike: 10% ltnk: 40% @@ -305,6 +309,8 @@ Player: msam: 50% htnk: 50% orca: 10% + UnitLimits: + harv: 8 SquadSize: 8 SupportPowerDecision@Airstrike: OrderName: AirstrikePowerInfoOrder diff --git a/mods/d2k/rules/ai.yaml b/mods/d2k/rules/ai.yaml index aadd554c8c..931f40fabd 100644 --- a/mods/d2k/rules/ai.yaml +++ b/mods/d2k/rules/ai.yaml @@ -52,7 +52,7 @@ Player: fremen: 0.5% sardaukar: 1.5% saboteur: 0.5% - harvester: 0.1% + harvester: 1% grenadier: 1% trike.starport: 5% quad.starport: 7.5% @@ -73,6 +73,8 @@ Player: combata: 100% combath: 100% combato: 100% + UnitLimits: + harvester: 8 SquadSize: 8 MaxBaseRadius: 40 SupportPowerDecision@Airstrike: @@ -180,7 +182,7 @@ Player: sardaukar: 1% saboteur: 0.5% grenadier: 1% - harvester: 0.1% + harvester: 1% trike.starport: 7.5% quad.starport: 12.5% siegetank.starport: 5% @@ -200,6 +202,8 @@ Player: combata: 100% combath: 100% combato: 100% + UnitLimits: + harvester: 8 SquadSize: 6 MaxBaseRadius: 40 SupportPowerDecision@Airstrike: @@ -307,7 +311,7 @@ Player: sardaukar: 3% saboteur: 1% grenadier: 2% - harvester: 0.1% + harvester: 1% trike.starport: 5% quad.starport: 7.5% siegetank.starport: 5% @@ -327,6 +331,8 @@ Player: combata: 100% combath: 100% combato: 100% + UnitLimits: + harvester: 8 SquadSize: 10 MaxBaseRadius: 40 SupportPowerDecision@Airstrike: diff --git a/mods/ra/rules/ai.yaml b/mods/ra/rules/ai.yaml index 2ccef11f2b..376bdb8f0f 100644 --- a/mods/ra/rules/ai.yaml +++ b/mods/ra/rules/ai.yaml @@ -17,6 +17,7 @@ Player: proc: 4 barr: 1 tent: 1 + kenn: 1 dome: 1 weap: 1 hpad: 4 @@ -29,6 +30,7 @@ Player: powr: 15% apwr: 20% barr: 1% + kenn: 0.5% tent: 1% weap: 1% pbox: 7% @@ -46,7 +48,9 @@ Player: e2: 20% e3: 10% e4: 2% + dog: 2% shok: 2% + harv: 10% apc: 30% jeep: 40% arty: 15% @@ -58,6 +62,9 @@ Player: 4tnk: 10% ttnk: 10% stnk: 5% + UnitLimits: + dog: 4 + harv: 8 SquadSize: 20 SupportPowerDecision@spyplane: OrderName: SovietSpyPlane @@ -140,6 +147,7 @@ Player: apwr: 30% tent: 1% barr: 1% + kenn: 0.5% dome: 1% weap: 6% hpad: 4% @@ -161,6 +169,7 @@ Player: e2: 10% e3: 10% e4: 5% + dog: 3% shok: 5% harv: 10% apc: 30% @@ -183,6 +192,9 @@ Player: dd: 10% ca: 10% pt: 10% + UnitLimits: + dog: 4 + harv: 8 SquadSize: 40 SupportPowerDecision@spyplane: OrderName: SovietSpyPlane @@ -250,6 +262,7 @@ Player: proc: 4 barr: 1 tent: 1 + kenn: 1 dome: 1 weap: 1 spen: 1 @@ -265,6 +278,7 @@ Player: apwr: 20% tent: 1% barr: 1% + kenn: 0.5% weap: 3% hpad: 2% spen: 1% @@ -285,6 +299,7 @@ Player: e2: 10% e3: 10% e4: 8% + dog: 4% shok: 8% harv: 10% apc: 30% @@ -307,6 +322,9 @@ Player: dd: 10% ca: 10% pt: 10% + UnitLimits: + dog: 4 + harv: 8 SquadSize: 10 SupportPowerDecision@spyplane: OrderName: SovietSpyPlane @@ -409,6 +427,8 @@ Player: dd: 30% ca: 20% pt: 10% + UnitLimits: + harv: 8 SquadSize: 1 SupportPowerDecision@spyplane: OrderName: SovietSpyPlane diff --git a/mods/ts/rules/ai.yaml b/mods/ts/rules/ai.yaml index 0e9982bda6..dd1c59d86e 100644 --- a/mods/ts/rules/ai.yaml +++ b/mods/ts/rules/ai.yaml @@ -56,11 +56,14 @@ Player: e3: 30% medic: 2% jumpjet: 15% + harv: 10% mmch: 15% smech: 25% bike: 60% bggy: 75% ttnk: 45% stnk: 8% + UnitLimits: + harv: 8 SquadSize: 20