Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/petra/attackPlan.js
Show First 20 Lines • Show All 362 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
PETRA.AttackPlan.prototype.addSiegeUnits = function(gameState) | PETRA.AttackPlan.prototype.addSiegeUnits = function(gameState) | ||||
{ | { | ||||
if (this.siegeState == 2 || this.state !== "unexecuted") | if (this.siegeState == 2 || this.state !== "unexecuted") | ||||
return false; | return false; | ||||
let civ = gameState.getPlayerCiv(); | let civ = gameState.getPlayerCiv(); | ||||
let classes = [["Siege", "Melee"], ["Siege", "Ranged"], ["Elephant", "Melee"]]; | let classes = [["Siege+Melee"], ["Siege+Ranged"], ["Elephant+Melee"]]; | ||||
Lint: prefer-const: 'classes' is never reassigned. Use 'const' instead. | |||||
let hasTrainer = [false, false, false]; | let hasTrainer = [false, false, false]; | ||||
for (let ent of gameState.getOwnTrainingFacilities().values()) | for (let ent of gameState.getOwnTrainingFacilities().values()) | ||||
{ | { | ||||
let trainables = ent.trainableEntities(civ); | let trainables = ent.trainableEntities(civ); | ||||
if (!trainables) | if (!trainables) | ||||
continue; | continue; | ||||
for (let trainable of trainables) | for (let trainable of trainables) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 240 Lines • ▼ Show 20 Lines | if (this.Config.debug > 1 && gameState.ai.playedTurn%50 === 0) | ||||
API3.warn("===================================="); | API3.warn("===================================="); | ||||
} | } | ||||
let firstOrder = this.buildOrders[0]; | let firstOrder = this.buildOrders[0]; | ||||
if (firstOrder[0] < firstOrder[3].targetSize) | if (firstOrder[0] < firstOrder[3].targetSize) | ||||
{ | { | ||||
// find the actual queue we want | // find the actual queue we want | ||||
let queue = this.queue; | let queue = this.queue; | ||||
if (MatchesClassList(firstOrder[3].classes, ["Siege", "Elephant+Melee+Champion"])) | if (firstOrder[3].classes.indexOf("Siege") != -1 || firstOrder[3].classes.indexOf("Elephant") != -1 && | ||||
firstOrder[3].classes.indexOf("Melee") != -1 && firstOrder[3].classes.indexOf("Champion") != -1) | |||||
queue = this.queueSiege; | queue = this.queueSiege; | ||||
else if (firstOrder[3].classes.indexOf("Hero") != -1) | else if (firstOrder[3].classes.indexOf("Hero") != -1) | ||||
queue = this.queueSiege; | queue = this.queueSiege; | ||||
else if (firstOrder[3].classes.indexOf("Champion") != -1) | else if (firstOrder[3].classes.indexOf("Champion") != -1) | ||||
queue = this.queueChamp; | queue = this.queueChamp; | ||||
if (queue.length() <= 5) | if (queue.length() <= 5) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 1,552 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
'classes' is never reassigned. Use 'const' instead.