diff --git a/Resources/AIs/bountyHunterAI.js b/Resources/AIs/bountyHunterAI.js index bee98d7b..82614673 100644 --- a/Resources/AIs/bountyHunterAI.js +++ b/Resources/AIs/bountyHunterAI.js @@ -67,8 +67,15 @@ this.aiStarted = function() { { condition: ai.conditionScannerContainsHuntableOffender, configuration: ai.configurationAcquireScannedTarget, - behaviour: ai.behaviourDestroyCurrentTarget, - reconsider: 1 + truebranch: [ + /* 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? */ { diff --git a/Resources/AIs/ooliteConstrictorAI.js b/Resources/AIs/ooliteConstrictorAI.js index ceee6c1f..d741000e 100644 --- a/Resources/AIs/ooliteConstrictorAI.js +++ b/Resources/AIs/ooliteConstrictorAI.js @@ -32,7 +32,8 @@ this.version = "1.79"; this.aiStarted = function() { var ai = new worldScripts["oolite-libPriorityAI"].AILib(this.ship); - ai.setCommunicationsRole("pirate"); + ai.setCommunicationsRole("_constrictor"); + ai.setParameter("oolite_flag_surrendersLate",true); ai.setPriorities([ /* Fight */ @@ -46,7 +47,7 @@ this.aiStarted = function() { }, condition: ai.conditionLosingCombat, behaviour: ai.behaviourFleeCombat, - reconsider: 5 + reconsider: 20 }, { condition: ai.conditionInCombat, diff --git a/Resources/AIs/policeAI.js b/Resources/AIs/policeAI.js index 007306a9..2c8be185 100644 --- a/Resources/AIs/policeAI.js +++ b/Resources/AIs/policeAI.js @@ -81,7 +81,7 @@ this.aiStarted = function() { reconsider: 1 }, { - condition: ai.conditionScannerContainsHuntableOffender, + condition: ai.conditionScannerContainsSeriousOffender, configuration: ai.configurationAcquireScannedTarget, behaviour: ai.behaviourDestroyCurrentTarget, reconsider: 1 diff --git a/Resources/AIs/traderAI.js b/Resources/AIs/traderAI.js index 47d76157..41dc4117 100644 --- a/Resources/AIs/traderAI.js +++ b/Resources/AIs/traderAI.js @@ -33,6 +33,7 @@ this.aiStarted = function() { var ai = new worldScripts["oolite-libPriorityAI"].AILib(this.ship); ai.setParameter("oolite_flag_sendsDistressCalls",true); + ai.setParameter("oolite_flag_surrendersEarly",true); ai.setCommunicationsRole("trader"); diff --git a/Resources/Scripts/oolite-ailib.js b/Resources/Scripts/oolite-ailib.js index 6591f267..f1f7131f 100644 --- a/Resources/Scripts/oolite-ailib.js +++ b/Resources/Scripts/oolite-ailib.js @@ -732,13 +732,27 @@ AILib.prototype.conditionCascadeDetected = 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() { - 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() +{ + 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) { var threshold = this.fineThreshold();