Various adjustments and bugfixes to assassination, parcel contracts
This commit is contained in:
parent
4c733916f2
commit
c19476ac8e
@ -37,6 +37,7 @@ this.aiStarted = function() {
|
||||
ai.setCommunicationsRole("assassin");
|
||||
|
||||
ai.setParameter("oolite_flag_witchspacePursuit",true);
|
||||
ai.setParameter("oolite_flag_surrendersLate",true);
|
||||
|
||||
ai.setPriorities([
|
||||
/* Fight */
|
||||
|
@ -277,7 +277,7 @@ this._initialiseCargoContractsForSystem = function()
|
||||
attempts++;
|
||||
var commodity = commodities[Math.floor(Math.random()*commodities.length)];
|
||||
// sub-tc contracts only available for top rep
|
||||
if (system.mainStation.market[commodity].quantityUnit != 0 && player.contractReputation != 7)
|
||||
if (system.mainStation.market[commodity].quantityUnit != 0 && player.contractReputation < 6.5)
|
||||
{
|
||||
}
|
||||
// ignore commodities with 0 availability here
|
||||
|
@ -777,7 +777,7 @@ this.systemWillPopulate = function()
|
||||
// if carrying high-risk contracts through dangerous systems,
|
||||
// especially bottlenecks, add some more assassins
|
||||
// specifically waiting for the player
|
||||
var cs = ship.parcels;
|
||||
var cs = player.ship.parcels;
|
||||
for (var i = cs.length-1; i >= 0 ; i--)
|
||||
{
|
||||
if (bottleneck)
|
||||
@ -793,10 +793,12 @@ this.systemWillPopulate = function()
|
||||
}
|
||||
else if (cs[i].destination == system.ID)
|
||||
{
|
||||
// if you're going to intercept, waiting in the
|
||||
// destination system for the package isn't a bad idea
|
||||
initial += Math.random()*cs[i].risk;
|
||||
}
|
||||
}
|
||||
cs = ship.passengers;
|
||||
cs = player.ship.passengers;
|
||||
for (i = cs.length-1; i >= 0 ; i--)
|
||||
{
|
||||
if (bottleneck)
|
||||
@ -1837,13 +1839,12 @@ this._addAssassin = function(pos)
|
||||
if (Math.random() > g / 10)
|
||||
{
|
||||
role = "assassin-medium";
|
||||
extra = 2;
|
||||
extra = 1;
|
||||
ws = 2.5;
|
||||
if (Math.random() > g / 5)
|
||||
{
|
||||
role = "assassin-heavy";
|
||||
ws = 2.8;
|
||||
extra = 4;
|
||||
}
|
||||
}
|
||||
var main = this._addShips(role,1,pos,0)[0];
|
||||
@ -1865,8 +1866,15 @@ this._addAssassin = function(pos)
|
||||
{
|
||||
var g = new ShipGroup("assassin group",main);
|
||||
main.group = g;
|
||||
var extras = this._addShips("assassin-light",extra,pos,3E3);
|
||||
for (var i=0;i<extra;i++)
|
||||
if (role == "assassin-heavy")
|
||||
{
|
||||
var extras = this._addShips("assassin-medium",2,pos,3E3);
|
||||
}
|
||||
else
|
||||
{
|
||||
var extras = this._addShips("assassin-light",2,pos,3E3);
|
||||
}
|
||||
for (var i=0;i<2;i++)
|
||||
{
|
||||
extras[i].group = g;
|
||||
g.addShip(extras[i]);
|
||||
|
@ -544,8 +544,13 @@ PriorityAIController.prototype.checkScannerWithPredicate = function(predicate)
|
||||
var io = (i+offset)%sl;
|
||||
if (predicate.call(this,scan[io]))
|
||||
{
|
||||
this.setParameter("oolite_scanResultSpecific",scan[io]);
|
||||
return true;
|
||||
// stops ships near the witchpoint beginning an attack on the player
|
||||
// before they've even got ship control back
|
||||
if (scan[io].status != "STATUS_EXITING_WITCHSPACE")
|
||||
{
|
||||
this.setParameter("oolite_scanResultSpecific",scan[io]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -1178,7 +1183,14 @@ PriorityAIController.prototype.threatAssessment = function(ship,full)
|
||||
{
|
||||
return 1; // mostly ignore stations in assessment
|
||||
}
|
||||
return worldScripts["oolite-libPriorityAI"]._threatAssessment(ship,full);
|
||||
var ta = worldScripts["oolite-libPriorityAI"]._threatAssessment(ship,full);
|
||||
if (!full && ship.isPlayer && ship.alertCondition < 3 && this.playerRole != "player-unknown")
|
||||
{
|
||||
// we haven't already added on the player's skill bonus, but
|
||||
// the player is somewhat known
|
||||
ta += Math.pow(player.score,0.33)/10;
|
||||
}
|
||||
return ta;
|
||||
}
|
||||
|
||||
/* ****************** Condition functions ************** */
|
||||
@ -2656,6 +2668,7 @@ PriorityAIController.prototype.behaviourDestroyCurrentTarget = function()
|
||||
{
|
||||
// entering attack mode
|
||||
this.communicate("oolite_beginningAttack",this.ship.target,3);
|
||||
this.ship.requestHelpFromGroup();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2996,9 +3009,10 @@ PriorityAIController.prototype.behaviourFollowGroupLeader = function()
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ship.destination = this.ship.group.leader.position;
|
||||
var gl = this.ship.group.leader;
|
||||
this.ship.destination = gl.position.add(gl.vectorForward.multiply(gl.speed*10));
|
||||
this.ship.desiredRange = 500+Math.random()*1000;
|
||||
this.ship.desiredSpeed = this.ship.maxSpeed;
|
||||
this.ship.desiredSpeed = Math.min(this.ship.maxSpeed,gl.speed*1.5);
|
||||
this.behaviourApproachDestination();
|
||||
}
|
||||
}
|
||||
@ -3181,6 +3195,7 @@ PriorityAIController.prototype.behaviourRepelCurrentTarget = function()
|
||||
{
|
||||
// entering attack mode
|
||||
this.communicate("oolite_beginningAttack",target,3);
|
||||
this.ship.requestHelpFromGroup();
|
||||
}
|
||||
else if (this.ship.target)
|
||||
{
|
||||
|
@ -1146,23 +1146,22 @@ static GLfloat sBaseMass = 0.0;
|
||||
// role weights
|
||||
[roleWeights release];
|
||||
roleWeights = [[dict oo_arrayForKey:@"role_weights"] mutableCopy];
|
||||
NSUInteger rc = [self maxPlayerRoles];
|
||||
if (roleWeights == nil)
|
||||
{
|
||||
NSUInteger rc = 16;
|
||||
if (ship_kills > 6400)
|
||||
{
|
||||
rc = 64;
|
||||
}
|
||||
else if (ship_kills > 128)
|
||||
{
|
||||
rc = 32;
|
||||
}
|
||||
roleWeights = [[NSMutableArray alloc] initWithCapacity:rc];
|
||||
while (rc-- > 0)
|
||||
{
|
||||
[roleWeights addObject:@"player-unknown"];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([roleWeights count] > rc)
|
||||
{
|
||||
[roleWeights removeObjectsInRange:(NSRange) {rc,[roleWeights count]-rc}];
|
||||
}
|
||||
}
|
||||
|
||||
roleWeightFlags = [[dict oo_dictionaryForKey:@"role_weight_Flags"] mutableCopy];
|
||||
if (roleWeightFlags == nil)
|
||||
@ -1500,8 +1499,8 @@ static GLfloat sBaseMass = 0.0;
|
||||
[reputation oo_setInteger:0 forKey:PARCEL_BAD_KEY];
|
||||
[reputation oo_setInteger:MAX_CONTRACT_REP forKey:PARCEL_UNKNOWN_KEY];
|
||||
|
||||
roleWeights = [[NSMutableArray alloc] initWithCapacity:16];
|
||||
for (i = 0 ; i < 16 ; i++)
|
||||
roleWeights = [[NSMutableArray alloc] initWithCapacity:8];
|
||||
for (i = 0 ; i < 8 ; i++)
|
||||
{
|
||||
[roleWeights addObject:@"player-unknown"];
|
||||
}
|
||||
@ -3749,7 +3748,7 @@ static GLfloat sBaseMass = 0.0;
|
||||
{
|
||||
role = @"pirate";
|
||||
}
|
||||
else if ([[victim primaryRole] hasPrefix:@"hunter"] || [victim scanClass] == CLASS_POLICE)
|
||||
else if ([UNIVERSE role:[self primaryRole] isInCategory:@"oolite-hunter"] || [victim scanClass] == CLASS_POLICE)
|
||||
{
|
||||
role = @"pirate-interceptor";
|
||||
}
|
||||
@ -3810,7 +3809,8 @@ static GLfloat sBaseMass = 0.0;
|
||||
if (!includingLongRange)
|
||||
{
|
||||
NSString *role = [roleWeights objectAtIndex:slot];
|
||||
if ([role hasSuffix:@"+"])
|
||||
// long range roles cleared at 1/2 normal rate
|
||||
if ([role hasSuffix:@"+"] && randf() > 0.5)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -3836,15 +3836,15 @@ static GLfloat sBaseMass = 0.0;
|
||||
{
|
||||
if (ship_kills >= 6400)
|
||||
{
|
||||
return 64;
|
||||
return 32;
|
||||
}
|
||||
else if (ship_kills >= 128)
|
||||
{
|
||||
return 32;
|
||||
return 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 16;
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user