Unhardcode AI defensive priorities.
This commit is contained in:
committed by
reaperrr
parent
e82aa9977e
commit
5eaba4f893
@@ -36,6 +36,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Enemy building types around which to scan for targets for naval squads.")]
|
[Desc("Enemy building types around which to scan for targets for naval squads.")]
|
||||||
public readonly HashSet<string> NavalProductionTypes = new HashSet<string>();
|
public readonly HashSet<string> NavalProductionTypes = new HashSet<string>();
|
||||||
|
|
||||||
|
[Desc("Own actor types that are prioritized when defending.")]
|
||||||
|
public readonly HashSet<string> ProtectionTypes = new HashSet<string>();
|
||||||
|
|
||||||
[Desc("Minimum number of units AI must have before attacking.")]
|
[Desc("Minimum number of units AI must have before attacking.")]
|
||||||
public readonly int SquadSize = 8;
|
public readonly int SquadSize = 8;
|
||||||
|
|
||||||
@@ -321,7 +324,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
// Don't rush enemy aircraft!
|
// Don't rush enemy aircraft!
|
||||||
var enemies = World.FindActorsInCircle(b.CenterPosition, WDist.FromCells(Info.RushAttackScanRadius))
|
var enemies = World.FindActorsInCircle(b.CenterPosition, WDist.FromCells(Info.RushAttackScanRadius))
|
||||||
.Where(unit => IsPreferredEnemyUnit(unit) && unit.Info.HasTraitInfo<AttackBaseInfo>() && !unit.Info.HasTraitInfo<AircraftInfo>() && !Info.NavalUnitsTypes.Contains(unit.Info.Name)).ToList();
|
.Where(unit => IsPreferredEnemyUnit(unit) && unit.Info.HasTraitInfo<AttackBaseInfo>() && !Info.AirUnitsTypes.Contains(unit.Info.Name) && !Info.NavalUnitsTypes.Contains(unit.Info.Name)).ToList();
|
||||||
|
|
||||||
if (AttackOrFleeFuzzy.Rush.CanAttack(ownUnits, enemies))
|
if (AttackOrFleeFuzzy.Rush.CanAttack(ownUnits, enemies))
|
||||||
{
|
{
|
||||||
@@ -350,8 +353,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (!protectSq.IsValid)
|
if (!protectSq.IsValid)
|
||||||
{
|
{
|
||||||
var ownUnits = World.FindActorsInCircle(World.Map.CenterOfCell(GetRandomBaseCenter()), WDist.FromCells(Info.ProtectUnitScanRadius))
|
var ownUnits = World.FindActorsInCircle(World.Map.CenterOfCell(GetRandomBaseCenter()), WDist.FromCells(Info.ProtectUnitScanRadius))
|
||||||
.Where(unit => unit.Owner == Player && !unit.Info.HasTraitInfo<BuildingInfo>() && !unit.Info.HasTraitInfo<HarvesterInfo>()
|
.Where(unit => unit.Owner == Player && !Info.ProtectionTypes.Contains(unit.Info.Name) && unit.Info.HasTraitInfo<AttackBaseInfo>());
|
||||||
&& unit.Info.HasTraitInfo<AttackBaseInfo>());
|
|
||||||
|
|
||||||
foreach (var a in ownUnits)
|
foreach (var a in ownUnits)
|
||||||
protectSq.Units.Add(a);
|
protectSq.Units.Add(a);
|
||||||
@@ -370,9 +372,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (!IsPreferredEnemyUnit(e.Attacker))
|
if (!IsPreferredEnemyUnit(e.Attacker))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Protected priority assets, MCVs, harvesters and buildings
|
if (Info.ProtectionTypes.Contains(self.Info.Name))
|
||||||
// TODO: Use *CommonNames, instead of hard-coding trait(info)s.
|
|
||||||
if (self.Info.HasTraitInfo<HarvesterInfo>() || self.Info.HasTraitInfo<BuildingInfo>() || self.Info.HasTraitInfo<BaseBuildingInfo>())
|
|
||||||
{
|
{
|
||||||
foreach (var n in notifyPositionsUpdated)
|
foreach (var n in notifyPositionsUpdated)
|
||||||
n.UpdatedDefenseCenter(e.Attacker.Location);
|
n.UpdatedDefenseCenter(e.Attacker.Location);
|
||||||
|
|||||||
@@ -219,6 +219,7 @@ Player:
|
|||||||
ExcludeFromSquadsTypes: harv, mcv, a10
|
ExcludeFromSquadsTypes: harv, mcv, a10
|
||||||
ConstructionYardTypes: fact
|
ConstructionYardTypes: fact
|
||||||
AirUnitsTypes: heli, orca
|
AirUnitsTypes: heli, orca
|
||||||
|
ProtectionTypes: fact, fact.gdi, fact.nod, nuke, nuk2, proc, silo, pyle, hand, afld, weap, hpad, hq, fix, eye, tmpl, gun, sam, obli, gtwr, atwr, mcv, harv, miss
|
||||||
UnitBuilderBotModule@cabal:
|
UnitBuilderBotModule@cabal:
|
||||||
RequiresCondition: enable-cabal-ai
|
RequiresCondition: enable-cabal-ai
|
||||||
UnitQueues: Vehicle.Nod, Vehicle.GDI, Infantry.Nod, Infantry.GDI, Aircraft.Nod, Aircraft.GDI
|
UnitQueues: Vehicle.Nod, Vehicle.GDI, Infantry.Nod, Infantry.GDI, Aircraft.Nod, Aircraft.GDI
|
||||||
@@ -254,6 +255,7 @@ Player:
|
|||||||
ExcludeFromSquadsTypes: harv, mcv, a10
|
ExcludeFromSquadsTypes: harv, mcv, a10
|
||||||
ConstructionYardTypes: fact
|
ConstructionYardTypes: fact
|
||||||
AirUnitsTypes: heli, orca
|
AirUnitsTypes: heli, orca
|
||||||
|
ProtectionTypes: fact, fact.gdi, fact.nod, nuke, nuk2, proc, silo, pyle, hand, afld, weap, hpad, hq, fix, eye, tmpl, gun, sam, obli, gtwr, atwr, mcv, harv, miss
|
||||||
UnitBuilderBotModule@watson:
|
UnitBuilderBotModule@watson:
|
||||||
RequiresCondition: enable-watson-ai
|
RequiresCondition: enable-watson-ai
|
||||||
UnitQueues: Vehicle.Nod, Vehicle.GDI, Infantry.Nod, Infantry.GDI, Aircraft.Nod, Aircraft.GDI
|
UnitQueues: Vehicle.Nod, Vehicle.GDI, Infantry.Nod, Infantry.GDI, Aircraft.Nod, Aircraft.GDI
|
||||||
@@ -284,6 +286,7 @@ Player:
|
|||||||
ExcludeFromSquadsTypes: harv, mcv, a10
|
ExcludeFromSquadsTypes: harv, mcv, a10
|
||||||
ConstructionYardTypes: fact
|
ConstructionYardTypes: fact
|
||||||
AirUnitsTypes: heli, orca
|
AirUnitsTypes: heli, orca
|
||||||
|
ProtectionTypes: fact, fact.gdi, fact.nod, nuke, nuk2, proc, silo, pyle, hand, afld, weap, hpad, hq, fix, eye, tmpl, gun, sam, obli, gtwr, atwr, mcv, harv, miss
|
||||||
UnitBuilderBotModule@hal9001:
|
UnitBuilderBotModule@hal9001:
|
||||||
RequiresCondition: enable-hal9001-ai
|
RequiresCondition: enable-hal9001-ai
|
||||||
UnitQueues: Vehicle.Nod, Vehicle.GDI, Infantry.Nod, Infantry.GDI, Aircraft.Nod, Aircraft.GDI
|
UnitQueues: Vehicle.Nod, Vehicle.GDI, Infantry.Nod, Infantry.GDI, Aircraft.Nod, Aircraft.GDI
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ fact.colorpicker:
|
|||||||
Inherits: FACT
|
Inherits: FACT
|
||||||
-Buildable:
|
-Buildable:
|
||||||
-MapEditorData:
|
-MapEditorData:
|
||||||
|
-BaseBuilding:
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Image: fact
|
Image: fact
|
||||||
Palette: colorpicker
|
Palette: colorpicker
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ Player:
|
|||||||
ExcludeFromSquadsTypes: harvester, mcv, carryall, carryall.reinforce, ornithopter
|
ExcludeFromSquadsTypes: harvester, mcv, carryall, carryall.reinforce, ornithopter
|
||||||
ConstructionYardTypes: construction_yard
|
ConstructionYardTypes: construction_yard
|
||||||
IgnoredEnemyTargetTypes: Creep
|
IgnoredEnemyTargetTypes: Creep
|
||||||
|
ProtectionTypes: mcv, harvester, construction_yard, conyard.atreides, conyard.harkonnen, conyard.ordos, wind_trap, barracks, refinery, silo, light_factory, heavy_factory, outpost, starport, medium_gun_turret, large_gun_turret, repair_pad, high_tech_factory, research_centre, palace, mcv.starport, harvester.starport
|
||||||
UnitBuilderBotModule@omnius:
|
UnitBuilderBotModule@omnius:
|
||||||
RequiresCondition: enable-omnius-ai
|
RequiresCondition: enable-omnius-ai
|
||||||
UnitQueues: Infantry, Vehicle, Armor, Starport, Aircraft
|
UnitQueues: Infantry, Vehicle, Armor, Starport, Aircraft
|
||||||
@@ -266,6 +267,7 @@ Player:
|
|||||||
ExcludeFromSquadsTypes: harvester, mcv, carryall, carryall.reinforce, ornithopter
|
ExcludeFromSquadsTypes: harvester, mcv, carryall, carryall.reinforce, ornithopter
|
||||||
ConstructionYardTypes: construction_yard
|
ConstructionYardTypes: construction_yard
|
||||||
IgnoredEnemyTargetTypes: Creep
|
IgnoredEnemyTargetTypes: Creep
|
||||||
|
ProtectionTypes: mcv, harvester, construction_yard, conyard.atreides, conyard.harkonnen, conyard.ordos, wind_trap, barracks, refinery, silo, light_factory, heavy_factory, outpost, starport, medium_gun_turret, large_gun_turret, repair_pad, high_tech_factory, research_centre, palace, mcv.starport, harvester.starport
|
||||||
UnitBuilderBotModule@vidious:
|
UnitBuilderBotModule@vidious:
|
||||||
RequiresCondition: enable-vidious-ai
|
RequiresCondition: enable-vidious-ai
|
||||||
UnitQueues: Infantry, Vehicle, Armor, Starport, Aircraft
|
UnitQueues: Infantry, Vehicle, Armor, Starport, Aircraft
|
||||||
@@ -305,6 +307,7 @@ Player:
|
|||||||
ExcludeFromSquadsTypes: harvester, mcv, carryall, carryall.reinforce, ornithopter
|
ExcludeFromSquadsTypes: harvester, mcv, carryall, carryall.reinforce, ornithopter
|
||||||
ConstructionYardTypes: construction_yard
|
ConstructionYardTypes: construction_yard
|
||||||
IgnoredEnemyTargetTypes: Creep
|
IgnoredEnemyTargetTypes: Creep
|
||||||
|
ProtectionTypes: mcv, harvester, construction_yard, conyard.atreides, conyard.harkonnen, conyard.ordos, wind_trap, barracks, refinery, silo, light_factory, heavy_factory, outpost, starport, medium_gun_turret, large_gun_turret, repair_pad, high_tech_factory, research_centre, palace, mcv.starport, harvester.starport
|
||||||
UnitBuilderBotModule@gladius:
|
UnitBuilderBotModule@gladius:
|
||||||
RequiresCondition: enable-gladius-ai
|
RequiresCondition: enable-gladius-ai
|
||||||
UnitQueues: Infantry, Vehicle, Armor, Starport, Aircraft
|
UnitQueues: Infantry, Vehicle, Armor, Starport, Aircraft
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ Player:
|
|||||||
ExcludeFromSquadsTypes: harv, mcv, dog, badr.bomber, u2
|
ExcludeFromSquadsTypes: harv, mcv, dog, badr.bomber, u2
|
||||||
ConstructionYardTypes: fact
|
ConstructionYardTypes: fact
|
||||||
AirUnitsTypes: mig, yak, heli, hind, mh60
|
AirUnitsTypes: mig, yak, heli, hind, mh60
|
||||||
|
ProtectionTypes: harv, mcv, mslo, gap, spen, syrd, iron, pdox, tsla, agun, dome, pbox, hbox, gun, ftur, sam, atek, weap, fact, proc, silo, hpad, afld, afld.ukraine, powr, apwr, stek, barr, kenn, tent, fix, fpwr, tenf, syrf, spef, weaf, domf, fixf, fapw, atef, pdof, mslf, facf
|
||||||
McvManagerBotModule:
|
McvManagerBotModule:
|
||||||
RequiresCondition: enable-rush-ai || enable-normal-ai || enable-turtle-ai || enable-naval-ai
|
RequiresCondition: enable-rush-ai || enable-normal-ai || enable-turtle-ai || enable-naval-ai
|
||||||
McvTypes: mcv
|
McvTypes: mcv
|
||||||
@@ -317,6 +318,7 @@ Player:
|
|||||||
ConstructionYardTypes: fact
|
ConstructionYardTypes: fact
|
||||||
NavalProductionTypes: spen,syrd
|
NavalProductionTypes: spen,syrd
|
||||||
AirUnitsTypes: mig, yak, heli, hind, mh60
|
AirUnitsTypes: mig, yak, heli, hind, mh60
|
||||||
|
ProtectionTypes: harv, mcv, mslo, gap, spen, syrd, iron, pdox, tsla, agun, dome, pbox, hbox, gun, ftur, sam, atek, weap, fact, proc, silo, hpad, afld, afld.ukraine, powr, apwr, stek, barr, kenn, tent, fix, fpwr, tenf, syrf, spef, weaf, domf, fixf, fapw, atef, pdof, mslf, facf
|
||||||
UnitBuilderBotModule@normal:
|
UnitBuilderBotModule@normal:
|
||||||
RequiresCondition: enable-normal-ai
|
RequiresCondition: enable-normal-ai
|
||||||
UnitsToBuild:
|
UnitsToBuild:
|
||||||
@@ -360,6 +362,7 @@ Player:
|
|||||||
ConstructionYardTypes: fact
|
ConstructionYardTypes: fact
|
||||||
NavalProductionTypes: spen,syrd
|
NavalProductionTypes: spen,syrd
|
||||||
AirUnitsTypes: mig, yak, heli, hind, mh60
|
AirUnitsTypes: mig, yak, heli, hind, mh60
|
||||||
|
ProtectionTypes: harv, mcv, mslo, gap, spen, syrd, iron, pdox, tsla, agun, dome, pbox, hbox, gun, ftur, sam, atek, weap, fact, proc, silo, hpad, afld, afld.ukraine, powr, apwr, stek, barr, kenn, tent, fix, fpwr, tenf, syrf, spef, weaf, domf, fixf, fapw, atef, pdof, mslf, facf
|
||||||
UnitBuilderBotModule@turtle:
|
UnitBuilderBotModule@turtle:
|
||||||
RequiresCondition: enable-turtle-ai
|
RequiresCondition: enable-turtle-ai
|
||||||
UnitsToBuild:
|
UnitsToBuild:
|
||||||
@@ -403,6 +406,7 @@ Player:
|
|||||||
ConstructionYardTypes: fact
|
ConstructionYardTypes: fact
|
||||||
NavalProductionTypes: spen,syrd
|
NavalProductionTypes: spen,syrd
|
||||||
AirUnitsTypes: mig, yak, heli, hind, mh60
|
AirUnitsTypes: mig, yak, heli, hind, mh60
|
||||||
|
ProtectionTypes: harv, mcv, mslo, gap, spen, syrd, iron, pdox, tsla, agun, dome, pbox, hbox, gun, ftur, sam, atek, weap, fact, proc, silo, hpad, afld, afld.ukraine, powr, apwr, stek, barr, kenn, tent, fix, fpwr, tenf, syrf, spef, weaf, domf, fixf, fapw, atef, pdof, mslf, facf
|
||||||
UnitBuilderBotModule@naval:
|
UnitBuilderBotModule@naval:
|
||||||
RequiresCondition: enable-naval-ai
|
RequiresCondition: enable-naval-ai
|
||||||
UnitsToBuild:
|
UnitsToBuild:
|
||||||
|
|||||||
@@ -442,6 +442,7 @@ fact.colorpicker:
|
|||||||
Inherits: FACT
|
Inherits: FACT
|
||||||
-Buildable:
|
-Buildable:
|
||||||
-MapEditorData:
|
-MapEditorData:
|
||||||
|
-BaseBuilding:
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Image: fact
|
Image: fact
|
||||||
Palette: colorpicker
|
Palette: colorpicker
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ Player:
|
|||||||
ExcludeFromSquadsTypes: harv, mcv, dpod, hunter
|
ExcludeFromSquadsTypes: harv, mcv, dpod, hunter
|
||||||
ConstructionYardTypes: gacnst
|
ConstructionYardTypes: gacnst
|
||||||
AirUnitsTypes: orca, orcab, scrin, apache, jumpjet
|
AirUnitsTypes: orca, orcab, scrin, apache, jumpjet
|
||||||
|
ProtectionTypes: gapowr, gapowrup, gapile, gaweap, gahpad, gadept, garadr, gatech, gaplug, gagate_a, gagate_b, gactwr, gavulc, garock, gacsam, napowr, naapwr, nahand, naweap, nahpad, naradr, natech, nastlh, natmpl, namisl, nawast, nagate_a, nagate_b, nalasr, naobel, nasam, weed, gacnst, proc, gasilo, napuls, mcv, harv
|
||||||
UnitBuilderBotModule@test:
|
UnitBuilderBotModule@test:
|
||||||
RequiresCondition: enable-test-ai
|
RequiresCondition: enable-test-ai
|
||||||
UnitQueues: Vehicle, Infantry, Air
|
UnitQueues: Vehicle, Infantry, Air
|
||||||
|
|||||||
Reference in New Issue
Block a user