Merge pull request #9222 from GraionDilach/hackyai-unitlimits

Implement HackyAI->UnitLimits.
This commit is contained in:
Matthias Mailänder
2015-09-02 21:14:13 +02:00
5 changed files with 50 additions and 8 deletions

View File

@@ -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<string, float> UnitsToBuild = null;
[Desc("What units should the AI have a maximum limit to train.")]
public readonly Dictionary<string, int> UnitLimits = null;
[Desc("What buildings to the AI should build.", "What % of the total base must be this type of building.")]
public readonly Dictionary<string, float> 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<string, string[]> 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<string, int> 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));
}

View File

@@ -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

View File

@@ -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:

View File

@@ -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

View File

@@ -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