AI base builder power tweaks

This commit is contained in:
reaperrr
2015-06-27 02:01:28 +02:00
parent 9594dd7e30
commit 27ffd4967a
6 changed files with 17 additions and 3 deletions

View File

@@ -135,7 +135,7 @@ namespace OpenRA.Mods.Common.AI
var buildableThings = queue.BuildableItems(); var buildableThings = queue.BuildableItems();
// First priority is to get out of a low power situation // First priority is to get out of a low power situation
if (playerPower.ExcessPower < 0) if (playerPower.ExcessPower < ai.Info.MinimumExcessPower)
{ {
var power = GetProducibleBuilding("Power", buildableThings, a => a.Traits.WithInterface<PowerInfo>().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(p => p.Amount)); var power = GetProducibleBuilding("Power", buildableThings, a => a.Traits.WithInterface<PowerInfo>().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(p => p.Amount));
if (power != null && power.Traits.WithInterface<PowerInfo>().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(p => p.Amount) > 0) if (power != null && power.Traits.WithInterface<PowerInfo>().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(p => p.Amount) > 0)
@@ -202,7 +202,7 @@ namespace OpenRA.Mods.Common.AI
// Will this put us into low power? // Will this put us into low power?
var actor = world.Map.Rules.Actors[frac.Key]; var actor = world.Map.Rules.Actors[frac.Key];
var pis = actor.Traits.WithInterface<PowerInfo>().Where(i => i.UpgradeMinEnabledLevel < 1); var pis = actor.Traits.WithInterface<PowerInfo>().Where(i => i.UpgradeMinEnabledLevel < 1);
if (playerPower.ExcessPower < 0 || playerPower.ExcessPower < pis.Sum(pi => pi.Amount)) if (playerPower.ExcessPower < ai.Info.MinimumExcessPower || playerPower.ExcessPower < pis.Sum(pi => pi.Amount))
{ {
// Try building a power plant instead // Try building a power plant instead
var power = GetProducibleBuilding("Power", var power = GetProducibleBuilding("Power",

View File

@@ -49,6 +49,9 @@ namespace OpenRA.Mods.Common.AI
[Desc("Minimum delay (in ticks) between creating squads.")] [Desc("Minimum delay (in ticks) between creating squads.")]
public readonly int MinimumAttackForceDelay = 0; public readonly int MinimumAttackForceDelay = 0;
[Desc("Minimum excess power the AI should try to maintain.")]
public readonly int MinimumExcessPower = 0;
[Desc("How long to wait (in ticks) between structure production checks when there is no active production.")] [Desc("How long to wait (in ticks) between structure production checks when there is no active production.")]
public readonly int StructureProductionInactiveDelay = 125; public readonly int StructureProductionInactiveDelay = 125;

View File

@@ -1,6 +1,7 @@
Player: Player:
HackyAI@Cabal: HackyAI@Cabal:
Name: Cabal Name: Cabal
MinimumExcessPower: 60
BuildingCommonNames: BuildingCommonNames:
ConstructionYard: fact ConstructionYard: fact
Refinery: proc Refinery: proc
@@ -119,6 +120,7 @@ Player:
CheckRadius: 7c0 CheckRadius: 7c0
HackyAI@Watson: HackyAI@Watson:
Name: Watson Name: Watson
MinimumExcessPower: 60
BuildingCommonNames: BuildingCommonNames:
ConstructionYard: fact ConstructionYard: fact
Refinery: proc Refinery: proc
@@ -237,6 +239,7 @@ Player:
CheckRadius: 7c0 CheckRadius: 7c0
HackyAI@HAL9001: HackyAI@HAL9001:
Name: HAL 9001 Name: HAL 9001
MinimumExcessPower: 60
BuildingCommonNames: BuildingCommonNames:
ConstructionYard: fact ConstructionYard: fact
Refinery: proc Refinery: proc

View File

@@ -1,6 +1,7 @@
Player: Player:
HackyAI@Omnius: HackyAI@Omnius:
Name: Omnius Name: Omnius
MinimumExcessPower: 60
BuildingQueues: Building, Upgrade BuildingQueues: Building, Upgrade
UnitQueues: Infantry, Vehicle, Armor, Starport UnitQueues: Infantry, Vehicle, Armor, Starport
BuildingCommonNames: BuildingCommonNames:
@@ -127,6 +128,7 @@ Player:
CheckRadius: 7c0 CheckRadius: 7c0
HackyAI@Vidius: HackyAI@Vidius:
Name: Vidious Name: Vidious
MinimumExcessPower: 60
BuildingQueues: Building, Upgrade BuildingQueues: Building, Upgrade
UnitQueues: Infantry, Vehicle, Armor, Starport UnitQueues: Infantry, Vehicle, Armor, Starport
BuildingCommonNames: BuildingCommonNames:
@@ -253,6 +255,7 @@ Player:
CheckRadius: 7c0 CheckRadius: 7c0
HackyAI@Gladius: HackyAI@Gladius:
Name: Gladius Name: Gladius
MinimumExcessPower: 60
BuildingQueues: Building, Upgrade BuildingQueues: Building, Upgrade
UnitQueues: Infantry, Vehicle, Armor, Starport UnitQueues: Infantry, Vehicle, Armor, Starport
BuildingCommonNames: BuildingCommonNames:

View File

@@ -1,6 +1,7 @@
Player: Player:
HackyAI@RushAI: HackyAI@RushAI:
Name: Rush AI Name: Rush AI
MinimumExcessPower: 40
BuildingCommonNames: BuildingCommonNames:
ConstructionYard: fact ConstructionYard: fact
Refinery: proc Refinery: proc
@@ -25,7 +26,8 @@ Player:
fix: 1 fix: 1
BuildingFractions: BuildingFractions:
proc: 30% proc: 30%
powr: 35% powr: 15%
apwr: 20%
barr: 1% barr: 1%
tent: 1% tent: 1%
kenn: 0.5% kenn: 0.5%
@@ -109,6 +111,7 @@ Player:
CheckRadius: 7c0 CheckRadius: 7c0
HackyAI@NormalAI: HackyAI@NormalAI:
Name: Normal AI Name: Normal AI
MinimumExcessPower: 60
BuildingCommonNames: BuildingCommonNames:
ConstructionYard: fact ConstructionYard: fact
Refinery: proc Refinery: proc
@@ -235,6 +238,7 @@ Player:
CheckRadius: 7c0 CheckRadius: 7c0
HackyAI@TurtleAI: HackyAI@TurtleAI:
Name: Turtle AI Name: Turtle AI
MinimumExcessPower: 100
BuildingCommonNames: BuildingCommonNames:
ConstructionYard: fact ConstructionYard: fact
Refinery: proc Refinery: proc

View File

@@ -1,6 +1,7 @@
Player: Player:
HackyAI@TestAI: HackyAI@TestAI:
Name: Test AI Name: Test AI
MinimumExcessPower: 60
BuildingCommonNames: BuildingCommonNames:
ConstructionYard: gacnst ConstructionYard: gacnst
Refinery: proc Refinery: proc