made HackyAI more flexible for Dune 2000 mod
This commit is contained in:
@@ -34,8 +34,10 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
public readonly int SquadSize = 8;
|
public readonly int SquadSize = 8;
|
||||||
public readonly int AssignRolesInterval = 20;
|
public readonly int AssignRolesInterval = 20;
|
||||||
public readonly string RallypointTestBuilding = "fact"; // temporary hack to maintain previous rallypoint behavior.
|
public readonly string RallypointTestBuilding = "fact"; // temporary hack to maintain previous rallypoint behavior.
|
||||||
public readonly string[] UnitQueues = { "Vehicle", "Infantry", "Plane" };
|
public readonly string[] UnitQueues = {"Vehicle", "Infantry", "Plane"};
|
||||||
public readonly bool ShouldRepairBuildings = true;
|
public readonly bool ShouldRepairBuildings = true;
|
||||||
|
public readonly string HarvesterUnit = "harv";
|
||||||
|
public readonly string[] BaseBuildUnit = {"mcv"};
|
||||||
|
|
||||||
string IBotInfo.Name { get { return this.Name; } }
|
string IBotInfo.Name { get { return this.Name; } }
|
||||||
|
|
||||||
@@ -66,6 +68,7 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
{
|
{
|
||||||
bool enabled;
|
bool enabled;
|
||||||
public int ticks;
|
public int ticks;
|
||||||
|
public string FoundBaseBuildUnit;
|
||||||
public Player p;
|
public Player p;
|
||||||
PowerManager playerPower;
|
PowerManager playerPower;
|
||||||
readonly BuildingInfo rallypointTestBuilding; // temporary hack
|
readonly BuildingInfo rallypointTestBuilding; // temporary hack
|
||||||
@@ -182,7 +185,7 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
|
|
||||||
ticks++;
|
ticks++;
|
||||||
|
|
||||||
if (ticks == 10)
|
if (ticks == 1)
|
||||||
DeployMcv(self);
|
DeployMcv(self);
|
||||||
|
|
||||||
if (ticks % feedbackTime == 0)
|
if (ticks % feedbackTime == 0)
|
||||||
@@ -261,14 +264,14 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
assignRolesTicks = Info.AssignRolesInterval;
|
assignRolesTicks = Info.AssignRolesInterval;
|
||||||
|
|
||||||
var newUnits = self.World.ActorsWithTrait<IMove>()
|
var newUnits = self.World.ActorsWithTrait<IMove>()
|
||||||
.Where(a => a.Actor.Owner == p && a.Actor.Info != Rules.Info["mcv"]
|
.Where(a => a.Actor.Owner == p && a.Actor.Info != Rules.Info[FoundBaseBuildUnit]
|
||||||
&& !activeUnits.Contains(a.Actor))
|
&& !activeUnits.Contains(a.Actor))
|
||||||
.Select(a => a.Actor).ToArray();
|
.Select(a => a.Actor).ToArray();
|
||||||
|
|
||||||
foreach (var a in newUnits)
|
foreach (var a in newUnits)
|
||||||
{
|
{
|
||||||
BotDebug("AI: Found a newly built unit");
|
BotDebug("AI: Found a newly built unit");
|
||||||
if (a.Info == Rules.Info["harv"])
|
if (a.Info == Rules.Info[Info.HarvesterUnit])
|
||||||
world.IssueOrder( new Order( "Harvest", a, false ) );
|
world.IssueOrder( new Order( "Harvest", a, false ) );
|
||||||
else
|
else
|
||||||
unitsHangingAroundTheBase.Add(a);
|
unitsHangingAroundTheBase.Add(a);
|
||||||
@@ -418,16 +421,20 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
void DeployMcv(Actor self)
|
void DeployMcv(Actor self)
|
||||||
{
|
{
|
||||||
/* find our mcv and deploy it */
|
/* find our mcv and deploy it */
|
||||||
var mcv = self.World.Actors
|
foreach (var m in Info.BaseBuildUnit)
|
||||||
.FirstOrDefault(a => a.Owner == p && a.Info == Rules.Info["mcv"]);
|
|
||||||
|
|
||||||
if (mcv != null)
|
|
||||||
{
|
{
|
||||||
baseCenter = mcv.Location;
|
var mcv = self.World.Actors
|
||||||
world.IssueOrder(new Order("DeployTransform", mcv, false));
|
.FirstOrDefault(a => a.Owner == p && a.Info == Rules.Info[m]);
|
||||||
|
|
||||||
|
if (mcv != null)
|
||||||
|
{
|
||||||
|
baseCenter = mcv.Location;
|
||||||
|
world.IssueOrder(new Order("DeployTransform", mcv, false));
|
||||||
|
FoundBaseBuildUnit = m; //remember the type to exclude it from attack forces
|
||||||
|
}
|
||||||
|
else
|
||||||
|
BotDebug("AI: Can't find BaseBuildUnit {0}.", m);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
BotDebug("AI: Can't find the MCV.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal IEnumerable<ProductionQueue> FindQueues(string category)
|
internal IEnumerable<ProductionQueue> FindQueues(string category)
|
||||||
|
|||||||
@@ -36,44 +36,48 @@ Player:
|
|||||||
InitialCash: 5000
|
InitialCash: 5000
|
||||||
ActorGroupProxy:
|
ActorGroupProxy:
|
||||||
DeveloperMode:
|
DeveloperMode:
|
||||||
# HackyAI@EasyAI:
|
HackyAI@EasyAI:
|
||||||
# Name:Easy AI
|
Name:Easy AI
|
||||||
# BuildingFractions:
|
RallypointTestBuilding: conyarda
|
||||||
# refa: 30%
|
HarvesterUnit: harvester
|
||||||
# refh: 30%
|
BaseBuildUnit: mcva,mcvh,mcvo
|
||||||
# refo: 30%
|
BuildingFractions:
|
||||||
# powra: 35%
|
refa: 30%
|
||||||
# powrh: 35%
|
refh: 30%
|
||||||
# powro: 35%
|
refo: 30%
|
||||||
# barra: 1%
|
powra: 35%
|
||||||
# barrh: 1%
|
powrh: 35%
|
||||||
# barro: 1%
|
powro: 35%
|
||||||
# lighta: 1%
|
barra: 1%
|
||||||
# lighth: 1%
|
barrh: 1%
|
||||||
# lighto: 1%
|
barro: 1%
|
||||||
# heavya: 1%
|
lighta: 1%
|
||||||
# heavyh: 1%
|
lighth: 1%
|
||||||
# heavyo: 1%
|
lighto: 1%
|
||||||
# researcha: 1%
|
heavya: 1%
|
||||||
# researchh: 1%
|
heavyh: 1%
|
||||||
# researcho: 1%
|
heavyo: 1%
|
||||||
# repaira: 0.1%
|
researcha: 1%
|
||||||
# repairh: 0.1%
|
researchh: 1%
|
||||||
# repairo: 0.1%
|
researcho: 1%
|
||||||
# radara: 10%
|
repaira: 0.1%
|
||||||
# radaro: 10%
|
repairh: 0.1%
|
||||||
# radarh: 10%
|
repairo: 0.1%
|
||||||
# UnitsToBuild:
|
radara: 10%
|
||||||
# trike: 30%
|
radaro: 10%
|
||||||
# raider: 30%
|
radarh: 10%
|
||||||
# quad: 40%
|
UnitsToBuild:
|
||||||
# siege: 15%
|
trike: 30%
|
||||||
# combata: 70%
|
raider: 30%
|
||||||
# combath: 70%
|
quad: 40%
|
||||||
# sonic: 25%
|
siege: 15%
|
||||||
# devast: 25%
|
combata: 70%
|
||||||
# deviator: 25%
|
combath: 70%
|
||||||
# SquadSize: 10
|
combato: 70%
|
||||||
|
sonic: 25%
|
||||||
|
devast: 25%
|
||||||
|
deviator: 25%
|
||||||
|
SquadSize: 10
|
||||||
PlayerColorPalette:
|
PlayerColorPalette:
|
||||||
BasePalette: d2k
|
BasePalette: d2k
|
||||||
PaletteFormat: d2k
|
PaletteFormat: d2k
|
||||||
|
|||||||
Reference in New Issue
Block a user