mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-04 05:55:47 -07:00
petra: do not loose time attacking useless structures
This was SVN commit r17001.
This commit is contained in:
parent
dff16f664e
commit
7842aa0468
1 changed files with 3 additions and 1 deletions
|
|
@ -182,11 +182,13 @@ m.DefenseManager.prototype.checkEnemyUnits = function(gameState)
|
|||
if (i !== 0 || this.armies.length > 1 || gameState.ai.HQ.numActiveBase() === 0)
|
||||
return;
|
||||
// look for possible gaia buildings inside our territory (may happen when enemy resign or after structure decay)
|
||||
// and attack it only if useful (and capturable) or dangereous
|
||||
for (let ent of gameState.getEnemyStructures(i).values())
|
||||
{
|
||||
if (!ent.position() || ent.getMetadata(PlayerID, "PartOfArmy") !== undefined)
|
||||
continue;
|
||||
|
||||
if (!ent.capturePoints() && !ent.hasDefensiveFire())
|
||||
continue;
|
||||
let owner = this.territoryMap.getOwner(ent.position());;
|
||||
if (owner === PlayerID)
|
||||
this.makeIntoArmy(gameState, ent.id());
|
||||
|
|
|
|||
Loading…
Reference in a new issue