Make sure pirate escorts have a bounty, fix initial pirate cargo

This commit is contained in:
cim 2013-08-14 21:10:29 +01:00
parent 9d7fe2fa46
commit ce2d77557d
2 changed files with 51 additions and 28 deletions

View File

@ -1357,6 +1357,10 @@ this._addIndependentPirate = function(pos)
for (var i=0;i<pg.ships.length;i++) for (var i=0;i<pg.ships.length;i++)
{ {
pg.ships[i].setBounty(20+system.government+size+Math.floor(Math.random()*8),"setup actions"); pg.ships[i].setBounty(20+system.government+size+Math.floor(Math.random()*8),"setup actions");
if (!pos.isStation && !pos.isPlanet)
{
pg.ships[i].setCargoType("PIRATE_GOODS");
}
} }
} }
@ -1443,6 +1447,22 @@ this._addPiratePack = function(pos,leader,lf,mf,hf,thug,home,destination,returni
{ {
this._setReturnFuel(lead[0]); this._setReturnFuel(lead[0]);
} }
if (lead[0].escortGroup)
{
var eg = lead[0].escortGroup.ships;
for (var i = 0; i < eg.length; i++)
{
if (eg[i] != lead[0])
{
// ensure freighter escorts have a bounty
eg[i].bounty |= 3+Math.floor(Math.random()*12);
}
}
}
if (!pos.isStation && !pos.isPlanet)
{
lead[0].setCargoType("PIRATE_GOODS");
}
lead[0].switchAI("pirateFreighterAI.js"); lead[0].switchAI("pirateFreighterAI.js");
return lead[0]; return lead[0];
} }

View File

@ -7582,8 +7582,8 @@ NSComparisonResult ComparePlanetsBySurfaceDistance(id i1, id i2, void* context)
if (cargo_flag != flag) if (cargo_flag != flag)
{ {
cargo_flag = flag; cargo_flag = flag;
NSArray *newCargo; NSArray *newCargo = nil;
unsigned num; unsigned num = 0;
if (likely_cargo > 0) if (likely_cargo > 0)
{ {
num = likely_cargo * (0.5+randf()); num = likely_cargo * (0.5+randf());
@ -7604,6 +7604,8 @@ NSComparisonResult ComparePlanetsBySurfaceDistance(id i1, id i2, void* context)
* thousands of pods - even if they are semi-virtual - for some * thousands of pods - even if they are semi-virtual - for some
* massive OXP ship */ * massive OXP ship */
} }
if (num > 0)
{
switch (cargo_flag) switch (cargo_flag)
{ {
case CARGO_FLAG_FULL_UNIFORM: case CARGO_FLAG_FULL_UNIFORM:
@ -7632,6 +7634,7 @@ NSComparisonResult ComparePlanetsBySurfaceDistance(id i1, id i2, void* context)
default: default:
break; break;
} }
}
[self setCargo:newCargo]; [self setCargo:newCargo];
} }
} }