1
0
forked from 0ad/0ad

more petra cleanup following eslint

This was SVN commit r21460.
This commit is contained in:
mimo 2018-03-07 18:41:39 +00:00
parent 14da2f841f
commit 061371da92
7 changed files with 93 additions and 93 deletions

View File

@ -877,10 +877,12 @@ m.BaseManager.prototype.assignToFoundations = function(gameState, noRepair)
// Don't repair if we're still under attack, unless it's a vital (civcentre or wall) building
// that's being destroyed.
if (gameState.ai.HQ.isNearInvadingArmy(target.position()))
{
if (target.healthLevel() > 0.5 ||
!target.hasClass("CivCentre") && !target.hasClass("StoneWall") &&
(!target.hasClass("Wonder") || !gameState.getVictoryConditions().has("wonder")))
continue;
}
else if (noRepair && !target.hasClass("CivCentre"))
continue;

View File

@ -46,9 +46,10 @@ m.Config = function(difficulty, behavior)
"armyMergeSize": 1400 // squared.
};
// Additional buildings that the AI does not yet know when to build
// and that it will try to build on phase 3 when enough resources.
this.buildings =
{
"advanced": {
"default": [],
"athen": ["structures/{civ}_gymnasion", "structures/{civ}_prytaneion",
"structures/{civ}_theatron", "structures/{civ}_royal_stoa"],
@ -67,7 +68,6 @@ m.Config = function(difficulty, behavior)
"sele": ["structures/{civ}_library"],
"spart": ["structures/{civ}_syssiton", "structures/{civ}_theatron",
"structures/{civ}_royal_stoa"]
}
};
this.priorities =

View File

@ -189,8 +189,7 @@ m.NavalManager.prototype.getFishSea = function(gameState, fish)
sea = gameState.ai.accessibility.navalPassMap[k];
fish.setMetadata(PlayerID, "sea", sea);
let radius = 120 / gameState.ai.accessibility.cellSize / ntry;
if (around.every(a =>
{
if (around.every(a => {
for (let t = 0; t < ntry; ++t)
{
let i = pos[0] + Math.round(a[0]*radius*(ntry-t));
@ -224,8 +223,7 @@ m.NavalManager.prototype.canFishSafely = function(gameState, fish)
let width = territoryMap.width;
let radius = 120 / territoryMap.cellSize / ntry;
let pos = territoryMap.gamePosToMapPos(fish.position());
return around.every(a =>
{
return around.every(a => {
for (let t = 0; t < ntry; ++t)
{
let i = pos[0] + Math.round(a[0]*radius*(ntry-t));

View File

@ -234,11 +234,11 @@ m.HQ.prototype.regionAnalysis = function(gameState)
m.HQ.prototype.structureAnalysis = function(gameState)
{
let civref = gameState.playerData.civ;
let civ = civref in this.Config.buildings.advanced ? civref : 'default';
let civ = civref in this.Config.buildings ? civref : 'default';
this.bAdvanced = [];
for (let advanced of this.Config.buildings.advanced[civ])
if (gameState.isTemplateAvailable(gameState.applyCiv(advanced)))
this.bAdvanced.push(gameState.applyCiv(advanced));
for (let building of this.Config.buildings[civ])
if (gameState.isTemplateAvailable(gameState.applyCiv(building)))
this.bAdvanced.push(gameState.applyCiv(building));
};
/**