Differential D4192 Diff 18509 ps/trunk/binaries/data/mods/public/simulation/ai/petra/queueManager.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/ai/petra/queueManager.js
Show First 20 Lines • Show All 413 Lines • ▼ Show 20 Lines | |||||
// Recovery system: if short of workers after an attack, pause (and reset) some queues to favor worker training | // Recovery system: if short of workers after an attack, pause (and reset) some queues to favor worker training | ||||
PETRA.QueueManager.prototype.checkPausedQueues = function(gameState) | PETRA.QueueManager.prototype.checkPausedQueues = function(gameState) | ||||
{ | { | ||||
let numWorkers = gameState.countOwnEntitiesAndQueuedWithRole("worker"); | let numWorkers = gameState.countOwnEntitiesAndQueuedWithRole("worker"); | ||||
let workersMin = Math.min(Math.max(12, 24 * this.Config.popScaling), this.Config.Economy.popPhase2); | let workersMin = Math.min(Math.max(12, 24 * this.Config.popScaling), this.Config.Economy.popPhase2); | ||||
for (let q in this.queues) | for (let q in this.queues) | ||||
{ | { | ||||
let toBePaused = false; | let toBePaused = false; | ||||
if (gameState.ai.HQ.numPotentialBases() == 0) | if (!gameState.ai.HQ.hasPotentialBase()) | ||||
toBePaused = q != "dock" && q != "civilCentre"; | toBePaused = q != "dock" && q != "civilCentre"; | ||||
else if (numWorkers < workersMin / 3) | else if (numWorkers < workersMin / 3) | ||||
toBePaused = q != "citizenSoldier" && q != "villager" && q != "emergency"; | toBePaused = q != "citizenSoldier" && q != "villager" && q != "emergency"; | ||||
else if (numWorkers < workersMin * 2 / 3) | else if (numWorkers < workersMin * 2 / 3) | ||||
toBePaused = q == "civilCentre" || q == "economicBuilding" || | toBePaused = q == "civilCentre" || q == "economicBuilding" || | ||||
q == "militaryBuilding" || q == "defenseBuilding" || q == "healer" || | q == "militaryBuilding" || q == "defenseBuilding" || q == "healer" || | ||||
q == "majorTech" || q == "minorTech" || q.indexOf("plan_") != -1; | q == "majorTech" || q == "minorTech" || q.indexOf("plan_") != -1; | ||||
else if (numWorkers < workersMin) | else if (numWorkers < workersMin) | ||||
▲ Show 20 Lines • Show All 165 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator