petra: complete 8f4db16139 for the change in dock positionning in random maps

This was SVN commit r21256.
This commit is contained in:
mimo
2018-02-18 18:17:33 +00:00
parent ab057e0bf5
commit 54c2447379
2 changed files with 10 additions and 4 deletions
@@ -823,7 +823,7 @@ m.AttackPlan.prototype.getNearestTarget = function(gameState, position, sameLand
{
this.isBlocked = false;
// Temporary variables needed by isValidTarget
this.accessibility = gameState.ai.accessibility;
this.gameState = gameState;
this.sameLand = sameLand && sameLand > 1 ? sameLand : false;
let targets;
@@ -926,8 +926,14 @@ m.AttackPlan.prototype.isValidTarget = function(ent)
{
if (!ent.position())
return false;
if (this.sameLand && this.accessibility.getAccessValue(ent.position()) != this.sameLand)
return false;
if (this.sameLand)
{
if (ent.hasClass("Structure"))
if (m.getLandAccess(this.gameState, ent) != this.sameLand)
return false;
else if (this.gameState.ai.accessibility.getAccessValue(ent.position()) != this.sameLand)
return false;
}
return !ent.decaying() || ent.getDefaultArrow() || ent.isGarrisonHolder() && ent.garrisoned().length;
};
@@ -42,7 +42,7 @@ function InitGame(settings)
}
// Sandbox, Very Easy, Easy, Medium, Hard, Very Hard
let rate = [ 0.50, 0.64, 0.80, 1.00, 1.25, 1.56 ];
let rate = [ 0.42, 0.56, 0.75, 1.00, 1.25, 1.56 ];
let cmpAIManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_AIManager);
for (let i = 0; i < settings.PlayerData.length; ++i)
{