1
0
forked from mirrors/0ad

some fixes for petra

This was SVN commit r16853.
This commit is contained in:
mimo
2015-07-13 13:05:14 +00:00
parent 74b600d661
commit d08279ceb6
2 changed files with 5 additions and 7 deletions
@@ -519,11 +519,9 @@ m.Template = m.Class({
},
hasDefensiveFire: function() {
let fire = this.getDefaultArrow();
if (fire && fire > 0)
return true;
fire = this.getArrowMultiplier();
return (fire && fire > 0);
if (!this.get("Attack") || !this.get("Attack/Ranged"))
return false;
return (this.getDefaultArrow() || this.getArrowMultiplier());
},
territoryInfluenceRadius: function() {
@@ -355,7 +355,7 @@ m.HQ.prototype.checkEvents = function (gameState, events, queues)
let decayToGaia = true;
for (let i = 1; i < capture.length; ++i)
{
if (i == PlayerID || capture[i] < capture[0])
if (gameState.isPlayerAlly(i) || !capture[i])
continue;
decayToGaia = false;
break;
@@ -1900,7 +1900,7 @@ m.HQ.prototype.isNearInvadingArmy = function(pos)
m.HQ.prototype.isUnderEnemyFire = function(gameState, pos, radius = 0)
{
if (!this.turnCache["firingStructures"])
this.turnCache["firingStructures"] = gameState.updatingGlobalCollection("FiringStructures", API3.Filters.hasDefensiveFire(), gameState.getEnemyStructures());
this.turnCache["firingStructures"] = gameState.updatingCollection("FiringStructures", API3.Filters.hasDefensiveFire(), gameState.getEnemyStructures());
for (let ent of this.turnCache["firingStructures"].values())
{
let range = radius + ent.attackRange("Ranged").max;