1
0
forked from 0ad/0ad

Fix some Petra whitespace; with b59198524f/D2103 fixes all ESLint issues in petra/, refs #5524.

Differential Revision: https://code.wildfiregames.com/D1993
Patch By: Krinkle
This was SVN commit r22835.
This commit is contained in:
elexis 2019-09-02 21:16:06 +00:00
parent eb6f14a82d
commit ade8bcc0b8
9 changed files with 28 additions and 28 deletions

View File

@ -136,23 +136,23 @@ PETRA.AttackPlan = function(gameState, Config, uniqueID, type, data)
{
priority = 90;
// basically we want a mix of citizen soldiers so our barracks have a purpose, and champion units.
this.unitStat.RangedInfantry = { "priority": 0.7, "minSize": 5, "targetSize": 20, "batchSize": 5, "classes": ["Infantry", "Ranged", "CitizenSoldier"],
this.unitStat.RangedInfantry = { "priority": 0.7, "minSize": 5, "targetSize": 20, "batchSize": 5, "classes": ["Infantry", "Ranged", "CitizenSoldier"],
"interests": [["strength", 3]] };
this.unitStat.MeleeInfantry = { "priority": 0.7, "minSize": 5, "targetSize": 20, "batchSize": 5, "classes": ["Infantry", "Melee", "CitizenSoldier"],
this.unitStat.MeleeInfantry = { "priority": 0.7, "minSize": 5, "targetSize": 20, "batchSize": 5, "classes": ["Infantry", "Melee", "CitizenSoldier"],
"interests": [["strength", 3]] };
this.unitStat.ChampRangedInfantry = { "priority": 1, "minSize": 3, "targetSize": 18, "batchSize": 3, "classes": ["Infantry", "Ranged", "Champion"],
"interests": [["strength", 3]] };
this.unitStat.ChampMeleeInfantry = { "priority": 1, "minSize": 3, "targetSize": 18, "batchSize": 3, "classes": ["Infantry", "Melee", "Champion"],
this.unitStat.ChampMeleeInfantry = { "priority": 1, "minSize": 3, "targetSize": 18, "batchSize": 3, "classes": ["Infantry", "Melee", "Champion"],
"interests": [["strength", 3]] };
this.unitStat.RangedCavalry = { "priority": 0.7, "minSize": 4, "targetSize": 20, "batchSize": 4, "classes": ["Cavalry", "Ranged", "CitizenSoldier"],
this.unitStat.RangedCavalry = { "priority": 0.7, "minSize": 4, "targetSize": 20, "batchSize": 4, "classes": ["Cavalry", "Ranged", "CitizenSoldier"],
"interests": [["strength", 2]] };
this.unitStat.MeleeCavalry = { "priority": 0.7, "minSize": 4, "targetSize": 20, "batchSize": 4, "classes": ["Cavalry", "Melee", "CitizenSoldier"],
this.unitStat.MeleeCavalry = { "priority": 0.7, "minSize": 4, "targetSize": 20, "batchSize": 4, "classes": ["Cavalry", "Melee", "CitizenSoldier"],
"interests": [["strength", 2]] };
this.unitStat.ChampRangedCavalry = { "priority": 1, "minSize": 3, "targetSize": 15, "batchSize": 3, "classes": ["Cavalry", "Ranged", "Champion"],
this.unitStat.ChampRangedCavalry = { "priority": 1, "minSize": 3, "targetSize": 15, "batchSize": 3, "classes": ["Cavalry", "Ranged", "Champion"],
"interests": [["strength", 3]] };
this.unitStat.ChampMeleeCavalry = { "priority": 1, "minSize": 3, "targetSize": 15, "batchSize": 3, "classes": ["Cavalry", "Melee", "Champion"],
this.unitStat.ChampMeleeCavalry = { "priority": 1, "minSize": 3, "targetSize": 15, "batchSize": 3, "classes": ["Cavalry", "Melee", "Champion"],
"interests": [["strength", 2]] };
this.unitStat.Hero = { "priority": 1, "minSize": 0, "targetSize": 1, "batchSize": 1, "classes": ["Hero"],
this.unitStat.Hero = { "priority": 1, "minSize": 0, "targetSize": 1, "batchSize": 1, "classes": ["Hero"],
"interests": [["strength", 2]] };
this.neededShips = 5;
}
@ -161,7 +161,7 @@ PETRA.AttackPlan = function(gameState, Config, uniqueID, type, data)
priority = 70;
this.unitStat.RangedInfantry = { "priority": 1, "minSize": 6, "targetSize": 16, "batchSize": 3, "classes": ["Infantry", "Ranged"],
"interests": [["canGather", 1], ["strength", 1.6], ["costsResource", 0.3, "stone"], ["costsResource", 0.3, "metal"]] };
this.unitStat.MeleeInfantry = { "priority": 1, "minSize": 6, "targetSize": 16, "batchSize": 3, "classes": ["Infantry", "Melee"],
this.unitStat.MeleeInfantry = { "priority": 1, "minSize": 6, "targetSize": 16, "batchSize": 3, "classes": ["Infantry", "Melee"],
"interests": [["canGather", 1], ["strength", 1.6], ["costsResource", 0.3, "stone"], ["costsResource", 0.3, "metal"]] };
this.unitStat.Cavalry = { "priority": 1, "minSize": 2, "targetSize": 6, "batchSize": 2, "classes": ["Cavalry", "CitizenSoldier"],
"interests": [["strength", 1]] };
@ -1140,12 +1140,8 @@ PETRA.AttackPlan.prototype.checkTargetObstruction = function(gameState, target,
if (blocker && blocker.hasClass("StoneWall"))
{
/* if (this.hasSiegeUnits())
{ */
this.isBlocked = true;
return blocker;
/* }
return undefined; */
this.isBlocked = true;
return blocker;
}
else if (blocker)
{
@ -1538,7 +1534,7 @@ PETRA.AttackPlan.prototype.update = function(gameState, events)
range = 30 + ent.attackRange("Ranged").max;
else if (ent.hasClass("Cavalry"))
range += 30;
range = range * range;
range *= range;
let entAccess = PETRA.getLandAccess(gameState, ent);
// Checking for gates if we're a siege unit.
if (siegeUnit)

View File

@ -192,7 +192,8 @@ PETRA.BaseManager.prototype.assignResourceToDropsite = function(gameState, drops
medium.sort((r1, r2) => r1.dist - r2.dist);
faraway.sort((r1, r2) => r1.dist - r2.dist);
/* let debug = false;
/*
let debug = false;
if (debug)
{
faraway.forEach(function(res){
@ -204,7 +205,8 @@ PETRA.BaseManager.prototype.assignResourceToDropsite = function(gameState, drops
nearby.forEach(function(res){
Engine.PostCommand(PlayerID,{"type": "set-shading-color", "entities": [res.ent.id()], "rgb": [0,0,2]});
});
} */
}
*/
}
// Allows all allies to use this dropsite except if base anchor to be sure to keep

View File

@ -51,7 +51,7 @@ PETRA.Config = function(difficulty, behavior)
"armyMergeSize": 1400 // squared.
};
// Additional buildings that the AI does not yet know when to build
// 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 =
{

View File

@ -167,7 +167,7 @@ PETRA.DefenseArmy.prototype.removeOwn = function(gameState, id, Entity)
plan.removeUnit(gameState, ent);
}
/*
/*
// TODO be sure that all units in the transport need the cancelation
if (!ent.position()) // this unit must still be in a transport plan ... try to cancel it
{

View File

@ -1088,7 +1088,7 @@ PETRA.HQ.prototype.findEconomicCCLocation = function(gameState, template, resour
val += gameState.sharedScript.ccResourceMaps[res].map[j];
val *= norm;
// If oversea, be just above threshold to be accepted if nothing else
// If oversea, be just above threshold to be accepted if nothing else
if (oversea)
val = Math.max(val, cut + 0.1);
@ -2679,14 +2679,16 @@ PETRA.HQ.prototype.update = function(gameState, queues, events)
this.phasing = 0;
}
/* if (this.Config.debug > 1)
/*
if (this.Config.debug > 1)
{
gameState.getOwnUnits().forEach (function (ent) {
if (!ent.position())
return;
PETRA.dumpEntity(ent);
});
} */
}
*/
this.checkEvents(gameState, events);
this.navalManager.checkEvents(gameState, queues, events);
@ -2754,7 +2756,7 @@ PETRA.HQ.prototype.update = function(gameState, queues, events)
this.currentBase %= this.baseManagers.length;
activeBase = this.baseManagers[this.currentBase++].update(gameState, queues, events);
--nbBases;
// TODO what to do with this.reassignTerritories(this.baseManagers[this.currentBase]);
// TODO what to do with this.reassignTerritories(this.baseManagers[this.currentBase]);
}
while (!activeBase && nbBases != 0);

View File

@ -190,7 +190,7 @@ PETRA.createBorderMap = function(gameState)
}
}
// map.dumpIm("border.png", 5);
// map.dumpIm("border.png", 5);
return map;
};

View File

@ -741,7 +741,7 @@ PETRA.ConstructionPlan.prototype.checkDockPlacement = function(gameState, x, z,
* if wantedSea is given, this tile should be inside this sea
*/
const around = [[ 1.0, 0.0], [ 0.87, 0.50], [ 0.50, 0.87], [ 0.0, 1.0], [-0.50, 0.87], [-0.87, 0.50],
[-1.0, 0.0], [-0.87,-0.50], [-0.50,-0.87], [ 0.0,-1.0], [ 0.50,-0.87], [ 0.87,-0.50]];
[-1.0, 0.0], [-0.87, -0.50], [-0.50, -0.87], [ 0.0, -1.0], [ 0.50, -0.87], [ 0.87, -0.50]];
PETRA.ConstructionPlan.prototype.isDockLocation = function(gameState, j, dimension, wantedLand, wantedSea)
{

View File

@ -420,7 +420,7 @@ PETRA.TradeManager.prototype.checkRoutes = function(gameState, accessIndex)
let candidate = { "gain": 0 };
let potential = { "gain": 0 };
let bestIndex = { "gain": 0 };
let bestLand = { "gain": 0 };
let bestLand = { "gain": 0 };
let mapSize = gameState.sharedScript.mapSize;
let traderTemplatesGains = gameState.getTraderTemplatesGains();

View File

@ -237,7 +237,7 @@ PETRA.TransportPlan.prototype.releaseAll = function()
ent.setMetadata(PlayerID, "endPos", undefined);
ent.setMetadata(PlayerID, "onBoard", undefined);
ent.setMetadata(PlayerID, "transport", undefined);
// TODO if the index of the endPos of the entity is !=,
// TODO if the index of the endPos of the entity is !=,
// require again another transport (we could need land-sea-land-sea-land)
}