forked from 0ad/0ad
petra: additional bugfixes and tweaks
This was SVN commit r16649.
This commit is contained in:
parent
20877632ce
commit
d41671044a
@ -27,19 +27,19 @@ m.AttackManager.prototype.init = function(gameState)
|
||||
this.outOfPlan.registerUpdates();
|
||||
};
|
||||
|
||||
m.AttackManager.prototype.setRushes = function()
|
||||
m.AttackManager.prototype.setRushes = function(allowed)
|
||||
{
|
||||
if (this.Config.personality.aggressive > 0.8)
|
||||
if (this.Config.personality.aggressive > 0.8 && allowed > 2)
|
||||
{
|
||||
this.maxRushes = 3
|
||||
this.rushSize = [ 16, 22, 28 ];
|
||||
}
|
||||
else if (this.Config.personality.aggressive > 0.6)
|
||||
else if (this.Config.personality.aggressive > 0.6 && allowed > 1)
|
||||
{
|
||||
this.maxRushes = 2;
|
||||
this.rushSize = [ 18, 28 ];
|
||||
}
|
||||
else if (this.Config.personality.aggressive > 0.3)
|
||||
else if (this.Config.personality.aggressive > 0.3 && allowed > 0)
|
||||
{
|
||||
this.maxRushes = 1;
|
||||
this.rushSize = [ 24 ];
|
||||
@ -83,6 +83,7 @@ m.AttackManager.prototype.checkEvents = function(gameState, events)
|
||||
continue;
|
||||
}
|
||||
attack.targetPos = attack.target.position();
|
||||
attack.resetPath(gameState);
|
||||
}
|
||||
if (attack.targetPlayer && attack.targetPlayer === targetPlayer)
|
||||
available += attack.unitCollection.length;
|
||||
|
@ -402,13 +402,7 @@ m.AttackPlan.prototype.updatePreparation = function(gameState)
|
||||
}
|
||||
}
|
||||
// reset the path so that we recompute it for this new target
|
||||
this.path = undefined;
|
||||
if (!this.pathFinder)
|
||||
{
|
||||
this.pathFinder = new API3.aStarPath(gameState, false, false, this.targetPlayer);
|
||||
this.pathWidth = 6;
|
||||
this.pathSampling = 2;
|
||||
}
|
||||
this.resetPath(gameState);
|
||||
}
|
||||
|
||||
// when we have a target, we path to it.
|
||||
@ -1703,6 +1697,18 @@ m.AttackPlan.prototype.removeUnit = function(ent, update)
|
||||
this.unitCollection.updateEnt(ent);
|
||||
};
|
||||
|
||||
// Reset the path so that it can be recomputed for a new target
|
||||
m.AttackPlan.prototype.resetPath = function(gameState)
|
||||
{
|
||||
this.path = undefined;
|
||||
if (!this.pathFinder)
|
||||
{
|
||||
this.pathFinder = new API3.aStarPath(gameState, false, false, this.targetPlayer);
|
||||
this.pathWidth = 6;
|
||||
this.pathSampling = 2;
|
||||
}
|
||||
};
|
||||
|
||||
m.AttackPlan.prototype.checkEvents = function(gameState, events)
|
||||
{
|
||||
let renameEvents = events["EntityRenamed"];
|
||||
|
@ -312,11 +312,10 @@ m.DefenseManager.prototype.assignDefenders = function(gameState)
|
||||
aMin = a;
|
||||
distMin = dist;
|
||||
}
|
||||
if (aMin === undefined)
|
||||
{
|
||||
for (var a = 0; a < armiesNeeding.length; ++a)
|
||||
API3.warn(" defense/armiesNeeding " + uneval(armiesNeeding[a]["need"]));
|
||||
}
|
||||
|
||||
// if outside our territory (helping an ally or attacking a cc foundation), keep some troops in backup
|
||||
if (i < 12 && this.territoryMap.getOwner(armiesNeeding[aMin]["army"].foePosition) !== PlayerID)
|
||||
continue;
|
||||
|
||||
var str = m.getMaxStrength(ent);
|
||||
armiesNeeding[aMin]["need"] -= str;
|
||||
|
@ -248,7 +248,7 @@ m.HQ.prototype.checkEvents = function (gameState, events, queues)
|
||||
m.getBestBase(ent, gameState).assignEntity(gameState, ent);
|
||||
if (ent.hasTerritoryInfluence())
|
||||
this.updateTerritories(gameState);
|
||||
if (ent.decaying && ent.isGarrisonHolder())
|
||||
if (ent.decaying() && ent.isGarrisonHolder())
|
||||
this.garrisonManager.addDecayingStructure(gameState, evt.entity);
|
||||
}
|
||||
}
|
||||
|
@ -443,7 +443,10 @@ m.HQ.prototype.configFirstBase = function(gameState)
|
||||
if (startingWood < 6000)
|
||||
this.saveResources = true;
|
||||
if (startingWood > 8500 && this.canBuildUnits)
|
||||
this.attackManager.setRushes();
|
||||
{
|
||||
let allowed = Math.ceil((startingWood - 8500) / 3000);
|
||||
this.attackManager.setRushes(allowed);
|
||||
}
|
||||
|
||||
// immediatly build a wood dropsite if possible.
|
||||
var template = gameState.applyCiv("structures/{civ}_storehouse");
|
||||
|
Loading…
Reference in New Issue
Block a user