(Partly) Fix PetraAI building a lot of siege and not using it.

Following 3d7af82328.
The used classes for adding siege were wrong.

Reported in
https://wildfiregames.com/forum/topic/45178-a25-svn-version-25810-not-playable/.
Differential revision: https://code.wildfiregames.com/D4184
Refs. #6250 by (partly) fixing the siege case.
Reviewed by: @Angen
This was SVN commit r25826.
This commit is contained in:
Freagarach 2021-07-18 05:05:13 +00:00
parent f891ed4e53
commit fe6ce8d402
2 changed files with 5 additions and 6 deletions

View File

@ -368,7 +368,7 @@ PETRA.AttackPlan.prototype.addSiegeUnits = function(gameState)
return false; return false;
let civ = gameState.getPlayerCiv(); let civ = gameState.getPlayerCiv();
let classes = [["Siege", "Melee"], ["Siege", "Ranged"], ["Elephant", "Melee"]]; const classes = [["Siege+Melee"], ["Siege+Ranged"], ["Elephant+Melee"]];
let hasTrainer = [false, false, false]; let hasTrainer = [false, false, false];
for (let ent of gameState.getOwnTrainingFacilities().values()) for (let ent of gameState.getOwnTrainingFacilities().values())
{ {
@ -625,7 +625,7 @@ PETRA.AttackPlan.prototype.trainMoreUnits = function(gameState)
{ {
// find the actual queue we want // find the actual queue we want
let queue = this.queue; let queue = this.queue;
if (MatchesClassList(firstOrder[3].classes, ["Siege", "Elephant+Melee+Champion"])) if (firstOrder[4] == "Siege")
queue = this.queueSiege; queue = this.queueSiege;
else if (firstOrder[3].classes.indexOf("Hero") != -1) else if (firstOrder[3].classes.indexOf("Hero") != -1)
queue = this.queueSiege; queue = this.queueSiege;

View File

@ -721,10 +721,9 @@ PETRA.HQ.prototype.findBestTrainableUnit = function(gameState, classes, requirem
let units; let units;
if (classes.indexOf("Hero") != -1) if (classes.indexOf("Hero") != -1)
units = gameState.findTrainableUnits(classes, []); units = gameState.findTrainableUnits(classes, []);
else if (classes.indexOf("Siege") != -1) // We do not want siege tower as AI does not know how to use it // We do not want siege tower as AI does not know how to use it nor hero when not explicitely specified.
units = gameState.findTrainableUnits(classes, ["SiegeTower"]); else
else // We do not want hero when not explicitely specified units = gameState.findTrainableUnits(classes, ["Hero", "SiegeTower"]);
units = gameState.findTrainableUnits(classes, ["Hero"]);
if (!units.length) if (!units.length)
return undefined; return undefined;