mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-18 06:13:55 -07:00
petra captureRelics cleanup following 921c89d3a6
This was SVN commit r19598.
This commit is contained in:
parent
24de93e39a
commit
7dd3cf7543
2 changed files with 9 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue