Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/petra/attackManager.js
Show First 20 Lines • Show All 336 Lines • ▼ Show 20 Lines | if (unexecutedAttacks.Rush === 0) | ||||
this.rushNumber++; | this.rushNumber++; | ||||
} | } | ||||
} | } | ||||
else if (unexecutedAttacks.Attack == 0 && unexecutedAttacks.HugeAttack == 0 && | else if (unexecutedAttacks.Attack == 0 && unexecutedAttacks.HugeAttack == 0 && | ||||
this.startedAttacks.Attack.length + this.startedAttacks.HugeAttack.length < Math.min(2, 1 + Math.round(gameState.getPopulationMax()/100)) && | this.startedAttacks.Attack.length + this.startedAttacks.HugeAttack.length < Math.min(2, 1 + Math.round(gameState.getPopulationMax()/100)) && | ||||
(this.startedAttacks.Attack.length + this.startedAttacks.HugeAttack.length == 0 || gameState.getPopulationMax() - gameState.getPopulation() > 12)) | (this.startedAttacks.Attack.length + this.startedAttacks.HugeAttack.length == 0 || gameState.getPopulationMax() - gameState.getPopulation() > 12)) | ||||
{ | { | ||||
if (barracksNb >= 1 && (gameState.currentPhase() > 1 || gameState.isResearching(gameState.getPhaseName(2))) || | if (barracksNb >= 1 && (gameState.currentPhase() > 1 || gameState.isResearching(gameState.getPhaseName(2))) || | ||||
!gameState.ai.HQ.baseManagers[1]) // if we have no base ... nothing else to do than attack | !gameState.ai.HQ.numPotentialBases()) // if we have no base ... nothing else to do than attack | ||||
{ | { | ||||
let type = this.attackNumber < 2 || this.startedAttacks.HugeAttack.length > 0 ? "Attack" : "HugeAttack"; | let type = this.attackNumber < 2 || this.startedAttacks.HugeAttack.length > 0 ? "Attack" : "HugeAttack"; | ||||
let attackPlan = new PETRA.AttackPlan(gameState, this.Config, this.totalNumber, type); | let attackPlan = new PETRA.AttackPlan(gameState, this.Config, this.totalNumber, type); | ||||
if (attackPlan.failed) | if (attackPlan.failed) | ||||
this.attackPlansEncounteredWater = true; // hack | this.attackPlansEncounteredWater = true; // hack | ||||
else | else | ||||
{ | { | ||||
if (this.Config.debug > 1) | if (this.Config.debug > 1) | ||||
▲ Show 20 Lines • Show All 450 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator