Teach PetraAI the new garrisonRegenRate.
Improves behaviour after 856e876148
by counting in the capture strength
of garrisoned entities.
Differential revision: https://code.wildfiregames.com/D4799
Comment by: @Silier
This was SVN commit r27322.
This commit is contained in:
parent
89c78ee1f3
commit
5044850f93
@ -168,8 +168,13 @@ PETRA.allowCapture = function(gameState, ent, target)
|
||||
return !target.decaying();
|
||||
|
||||
let antiCapture = target.defaultRegenRate();
|
||||
if (target.isGarrisonHolder() && target.garrisoned())
|
||||
antiCapture += target.garrisonRegenRate() * target.garrisoned().length;
|
||||
if (target.isGarrisonHolder())
|
||||
{
|
||||
const garrisonRegenRate = target.garrisonRegenRate();
|
||||
for (const garrisonedEntity of target.garrisoned())
|
||||
antiCapture += garrisonRegenRate * (gameState.getEntityById(garrisonedEntity)?.captureStrength() || 0);
|
||||
}
|
||||
|
||||
if (target.decaying())
|
||||
antiCapture -= target.territoryDecayRate();
|
||||
|
||||
|
@ -316,7 +316,7 @@ PETRA.GarrisonManager.prototype.keepGarrisoned = function(ent, holder, around)
|
||||
return around.meleeSiege;
|
||||
return holder.buffHeal() && ent.needsHeal();
|
||||
case PETRA.GarrisonManager.TYPE_DECAY:
|
||||
return this.decayingStructures.has(holder.id());
|
||||
return ent.captureStrength() && this.decayingStructures.has(holder.id());
|
||||
case PETRA.GarrisonManager.TYPE_EMERGENCY: // f.e. hero in regicide mode
|
||||
if (holder.buffHeal() && ent.isHealable() && ent.healthLevel() < this.Config.garrisonHealthLevel.high)
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user