From 7dd3cf7543887692db5a6cdb8d59e3ddf60d4e8e Mon Sep 17 00:00:00 2001 From: mimo Date: Wed, 17 May 2017 17:21:05 +0000 Subject: [PATCH] petra captureRelics cleanup following 921c89d3a6 This was SVN commit r19598. --- .../mods/public/simulation/ai/petra/attackManager.js | 10 ++++++++-- .../mods/public/simulation/ai/petra/gameTypeManager.js | 6 +----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/binaries/data/mods/public/simulation/ai/petra/attackManager.js b/binaries/data/mods/public/simulation/ai/petra/attackManager.js index 4f26e17dfe..9477532cec 100644 --- a/binaries/data/mods/public/simulation/ai/petra/attackManager.js +++ b/binaries/data/mods/public/simulation/ai/petra/attackManager.js @@ -367,8 +367,8 @@ m.AttackManager.prototype.getEnemyPlayer = function(gameState, attack) let maxRelicsOwned = 0; for (let i = 0; i < gameState.sharedScript.playersData.length; ++i) { - if (!gameState.isPlayerEnemy(i) || this.defeated[i] || i === 0 && - !gameState.ai.HQ.gameTypeManager.tryCaptureGaiaRelic) + if (!gameState.isPlayerEnemy(i) || this.defeated[i] || + i === 0 && !gameState.ai.HQ.gameTypeManager.tryCaptureGaiaRelic) continue; let relicsCount = allRelics.filter(relic => relic.owner() === i).length; @@ -382,7 +382,13 @@ m.AttackManager.prototype.getEnemyPlayer = function(gameState, attack) if (attack.targetPlayer === undefined) this.currentEnemyPlayer = enemyPlayer; if (enemyPlayer === 0) + { + // Do not capture gaia relics too frequently as the ai has access to the entire map + // (tryCaptureGaiaRelic is necessarily true here) + gameState.ai.HQ.gameTypeManager.tryCaptureGaiaRelicLapseTime = + gameState.ai.elapsedTime + 300 - 30 * (this.Config.difficulty - 3); gameState.ai.HQ.gameTypeManager.tryCaptureGaiaRelic = false; + } return enemyPlayer; } } diff --git a/binaries/data/mods/public/simulation/ai/petra/gameTypeManager.js b/binaries/data/mods/public/simulation/ai/petra/gameTypeManager.js index 456a14fdb1..351079d95c 100644 --- a/binaries/data/mods/public/simulation/ai/petra/gameTypeManager.js +++ b/binaries/data/mods/public/simulation/ai/petra/gameTypeManager.js @@ -525,12 +525,8 @@ m.GameTypeManager.prototype.update = function(gameState, events, queues) if (gameState.getGameType() === "capture_the_relic" && gameState.ai.playedTurn % 10 === 0) { this.manageCriticalEntGuards(gameState); - // Do not capture gaia relics frequently, as the ai has access to the entire map - if (gameState.ai.elapsedTime > this.tryCaptureGaiaRelicLapseTime && !this.tryCaptureGaiaRelic) - { + if (!this.tryCaptureGaiaRelic && gameState.ai.elapsedTime > this.tryCaptureGaiaRelicLapseTime) this.tryCaptureGaiaRelic = true; - this.tryCaptureGaiaRelicLapseTime = gameState.ai.elapsedTime + (5 - 0.5 * (this.Config.difficulty - 3) * 60); - } } };