(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;
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];
for (let ent of gameState.getOwnTrainingFacilities().values())
{
@ -625,7 +625,7 @@ PETRA.AttackPlan.prototype.trainMoreUnits = function(gameState)
{
// find the actual queue we want
let queue = this.queue;
if (MatchesClassList(firstOrder[3].classes, ["Siege", "Elephant+Melee+Champion"]))
if (firstOrder[4] == "Siege")
queue = this.queueSiege;
else if (firstOrder[3].classes.indexOf("Hero") != -1)
queue = this.queueSiege;

View File

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