1
0
forked from 0ad/0ad

petra cleanup

This was SVN commit r21749.
This commit is contained in:
mimo 2018-04-20 15:36:14 +00:00
parent aed19f65ae
commit 18d8d2b29d
2 changed files with 11 additions and 6 deletions

View File

@ -828,6 +828,10 @@ m.GameState.prototype.hasResearchers = function(templateName, noRequirementCheck
if (!this.canResearch(templateName, noRequirementCheck))
return false;
let template = this.getTemplate(templateName);
if (template.autoResearch)
return true;
let civ = this.playerData.civ;
for (let ent of this.getOwnResearchFacilities().values())

View File

@ -916,15 +916,15 @@ m.HQ.prototype.pickMostNeededResources = function(gameState)
{
if (a.current && b.current)
return b.wanted / b.current - a.wanted / a.current;
else if (a.current)
if (a.current)
return 1;
else if (b.current)
if (b.current)
return -1;
return b.wanted - a.wanted;
}
if (a.current < a.wanted || a.wanted && !b.wanted)
return -1;
else if (b.current < b.wanted || b.wanted && !a.wanted)
if (b.current < b.wanted || b.wanted && !a.wanted)
return 1;
return a.current - a.wanted - b.current + b.wanted;
});
@ -2730,10 +2730,11 @@ m.HQ.prototype.update = function(gameState, queues, events)
this.defenseManager.update(gameState, events);
if (gameState.ai.playedTurn % 3 == 0)
{
this.constructTrainingBuildings(gameState, queues);
if (this.Config.difficulty > 0)
this.buildDefenses(gameState, queues);
if (this.Config.difficulty > 0)
this.buildDefenses(gameState, queues);
}
this.assignGatherers();
let nbBases = this.baseManagers.length;