Adjust some odds usage

This commit is contained in:
cim 2013-08-05 15:42:26 +01:00
parent fe5cef097f
commit 1bc115810a
5 changed files with 39 additions and 7 deletions

View File

@ -67,8 +67,15 @@ this.aiStarted = function() {
{ {
condition: ai.conditionScannerContainsHuntableOffender, condition: ai.conditionScannerContainsHuntableOffender,
configuration: ai.configurationAcquireScannedTarget, configuration: ai.configurationAcquireScannedTarget,
behaviour: ai.behaviourDestroyCurrentTarget, truebranch: [
reconsider: 1 /* if we require bounty hunters to have actual *good*
* odds they'll never shoot anything */
{
notcondition: ai.conditionCombatOddsBad,
behaviour: ai.behaviourDestroyCurrentTarget,
reconsider: 1
}
]
}, },
/* What about loot? */ /* What about loot? */
{ {

View File

@ -32,7 +32,8 @@ this.version = "1.79";
this.aiStarted = function() { this.aiStarted = function() {
var ai = new worldScripts["oolite-libPriorityAI"].AILib(this.ship); var ai = new worldScripts["oolite-libPriorityAI"].AILib(this.ship);
ai.setCommunicationsRole("pirate"); ai.setCommunicationsRole("_constrictor");
ai.setParameter("oolite_flag_surrendersLate",true);
ai.setPriorities([ ai.setPriorities([
/* Fight */ /* Fight */
@ -46,7 +47,7 @@ this.aiStarted = function() {
}, },
condition: ai.conditionLosingCombat, condition: ai.conditionLosingCombat,
behaviour: ai.behaviourFleeCombat, behaviour: ai.behaviourFleeCombat,
reconsider: 5 reconsider: 20
}, },
{ {
condition: ai.conditionInCombat, condition: ai.conditionInCombat,

View File

@ -81,7 +81,7 @@ this.aiStarted = function() {
reconsider: 1 reconsider: 1
}, },
{ {
condition: ai.conditionScannerContainsHuntableOffender, condition: ai.conditionScannerContainsSeriousOffender,
configuration: ai.configurationAcquireScannedTarget, configuration: ai.configurationAcquireScannedTarget,
behaviour: ai.behaviourDestroyCurrentTarget, behaviour: ai.behaviourDestroyCurrentTarget,
reconsider: 1 reconsider: 1

View File

@ -33,6 +33,7 @@ this.aiStarted = function() {
var ai = new worldScripts["oolite-libPriorityAI"].AILib(this.ship); var ai = new worldScripts["oolite-libPriorityAI"].AILib(this.ship);
ai.setParameter("oolite_flag_sendsDistressCalls",true); ai.setParameter("oolite_flag_sendsDistressCalls",true);
ai.setParameter("oolite_flag_surrendersEarly",true);
ai.setCommunicationsRole("trader"); ai.setCommunicationsRole("trader");

View File

@ -732,13 +732,27 @@ AILib.prototype.conditionCascadeDetected = function()
AILib.prototype.conditionCombatOddsTerrible = function() AILib.prototype.conditionCombatOddsTerrible = function()
{ {
return this.oddsAssessment() < 0.375; if (this.getParameter("oolite_flag_surrendersEarly"))
{
return this.oddsAssessment() < 0.75;
}
else
{
return this.oddsAssessment() < 0.375;
}
} }
AILib.prototype.conditionCombatOddsBad = function() AILib.prototype.conditionCombatOddsBad = function()
{ {
return this.oddsAssessment() < 0.75; if (this.getParameter("oolite_flag_surrendersLate"))
{
return this.oddsAssessment() < 0.375;
}
else
{
return this.oddsAssessment() < 0.75;
}
} }
@ -1342,6 +1356,15 @@ AILib.prototype.conditionScannerContainsFugitive = function()
} }
AILib.prototype.conditionScannerContainsHuntableOffender = function() AILib.prototype.conditionScannerContainsHuntableOffender = function()
{
return this.checkScannerWithPredicate(function(s) {
var threshold = this.fineThreshold() / 2;
return s.isInSpace && s.bounty > threshold && s.scanClass != "CLASS_CARGO" && s.scanClass != "CLASS_ROCK";
});
}
AILib.prototype.conditionScannerContainsSeriousOffender = function()
{ {
return this.checkScannerWithPredicate(function(s) { return this.checkScannerWithPredicate(function(s) {
var threshold = this.fineThreshold(); var threshold = this.fineThreshold();