1
0
forked from 0ad/0ad

[Petra/Ai] Fix not traning champion cavalry and infantry after 925170f600 and 8ee6774d12

Since champions have been moved to barracks, researching unlocking
technologies became the must in order to train them.
Therefore:

Specificaly research `unlock champion` technologies.
Increase priority of minor techs to 250.
Remove some duplicated checks.

Differential revision: D3380
Reviewed by: @wraitii
This was SVN commit r24669.
This commit is contained in:
Angen 2021-01-17 16:13:31 +00:00
parent 6bb1de61ec
commit 2d9e74598a
3 changed files with 7 additions and 2 deletions

View File

@ -124,7 +124,7 @@ PETRA.Config = function(difficulty, behavior)
"defenseBuilding": 70,
"civilCentre": 950,
"majorTech": 700,
"minorTech": 40,
"minorTech": 250,
"wonder": 1000,
"emergency": 1000 // used only in emergency situations, should be the highest one
};

View File

@ -2719,7 +2719,7 @@ PETRA.HQ.prototype.update = function(gameState, queues, events)
if (this.needCorral && gameState.ai.playedTurn % 4 == 3)
this.manageCorral(gameState, queues);
if (!queues.minorTech.hasQueuedUnits() && gameState.ai.playedTurn % 5 == 1)
if (gameState.ai.playedTurn % 5 == 1)
this.researchManager.update(gameState, queues);
}

View File

@ -82,6 +82,11 @@ PETRA.ResearchManager.prototype.researchWantedTechs = function(gameState, techs)
let numWorkers = phase1 ? gameState.getOwnEntitiesByRole("worker", true).length : 0;
for (let tech of techs)
{
if (tech[0].indexOf("unlock_champion") == 0)
return { "name": tech[0], "increasePriority": true };
if (tech[0] == "traditional_army_sele" || tech[0] == "reformed_army_sele")
return { "name": pickRandom(["traditional_army_sele", "reformed_army_sele"]), "increasePriority": true };
if (!tech[1]._template.modifications)
continue;
let template = tech[1]._template;