| Scripts/ferdelance3G_conditions.js |
/*
//////////////////////////////////////////////////////////////////////////////////
This file: ferdelance3G_conditions.js
Part of: Fer-de-Lance 3G OXP
Author: UK_Eliter
License: 2017 Creative Commons: attribution, non-commercial, sharealike
//////////////////////////////////////////////////////////////////////////////////
*/
/*
==============
LINTER OPTIONS
==============
*/
/* jshint esversion: 6 */
/* jshint -W030 */
/*
======
HEADER
======
*/
this.name = 'ferdelance3G_conditionsScript';
this.author = 'UK_Eliter';
this.description = 'ferdelance3G_conditionsScript.js';
this.copyright = '2014 Creative Commons: attribution, non-commercial, sharealike.';
this.licence = 'CC-NC-SA 3';
/*
==================
DEBUGGING SWITCHES
==================
*/
//this.logging = true; // THIS SHOULD BE COMMENTED OUT WHEN NOT TESTING
//this.dbg = false;
/*
========================
JSLINT: start of wrapper
========================
*/
(function() {
'use strict';
/*
------------------
CONDITION ROUTINES
------------------
*/
this.allowAwardEquipment = function(eqKey, ship, context) {
if ( eqKey !== 'EQ_F3G_ANTISWEEP_MISSILE' ) {
return;
}
if (system.techLevel < 9) {
return false;
}
var c;
if (player.ship.dockedStation === 'Navy SecCom Station') {
c = 0.87;
} else if (system.techLevel > 10) {
c = 0.7;
} else {
c = 0.45;
}
// Make it likely that some systems consistently have, or lack, the missiles.
const r = Math.random();
return r < 0.85 ? system.scrambledPseudoRandomNumber(6921) <= c : (r <= c);
};
this.updateEquipmentPrice = function(eqKey, currentPrice) {
var myPrice;
switch (eqKey) {
case 'EQ_F3G_ANTISWEEP_MISSILE':
if (player.ship.dockedStation === 'Navy SecCom Station') {
myPrice = 1000;
return (myPrice);
}
// Otherwise
if (system.techLevel > 10) {
if (Math.random() < 0.95) {
myPrice = 13000 + ((Math.ceil(system.scrambledPseudoRandomNumber(3420) * 10)) * 1000);
} else {
myPrice = 13000 + ((Math.ceil(Math.random() * 10)) * 1000);
}
return (myPrice);
}
// Otherwise
if (system.techLevel > 8) {
if (Math.random() < 0.95) {
myPrice = 10000 + ((Math.ceil(system.scrambledPseudoRandomNumber(3420) * 18)) * 1000);
} else {
myPrice = 10000 + ((Math.ceil(Math.random() * 18)) * 1000);
}
return (myPrice);
}
}
};
/*
======================
JSLINT: end of wrapper
======================
*/
}).call(this);
// EOF |
| Scripts/ferdelance3G_hunter.js |
/*
//////////////////////////////////////////////////////////////////////////////////
This file: ferdelance3G_hunter.js
Associated AI: none / auto_AI
Part of: Fer-de-Lance 3G OXP
Author: UK_Eliter
License: 2017 Creative Commons: attribution, non-commercial, sharealike
//////////////////////////////////////////////////////////////////////////////////
*/
/*
==============
LINTER OPTIONS
==============
*/
/* jshint esversion: 6 */
/* jshint -W030 */
/*
======
HEADER
======
*/
this.name = 'ferdelance3G_hunter';
this.author = 'UK_Eliter';
this.copyright = '';
this.description = 'ferdelance3G_hunter.js (for NPCs)';
this.license = '2014 CC-by-nc-sa 3.0';
/*
==================
DEBUGGING SWITCHES
==================
*/
// this.logging = true;
this.dbg = false;
if (this.dbg) {
this.ship.reportAIMessages = true;
}
/*
========================
JSLINT: start of wrapper
========================
*/
(function () {
'use strict';
/*
==============
EVENT HANDLERS
==============
*/
this.shipSpawned = function () {
const
r = Math.random(),
r2 = Math.random();
if (r > 0.45) {
var
i,
l,
ordinance_available = [
'EQ_MISSILE',
'EQ_MISSILE',
'EQ_MISSILE'
],
ordinance_capacity = this.ship.missileCapacity,
ordinance_giveLev2_bool,
ordinance_giveLev3_prob;
/*
----------------------------------
Determine ordinance we might award
----------------------------------
*/
if (this.ship.hasRole('ferdelance3G_+T')) {
ordinance_giveLev2_bool = true;
ordinance_giveLev3_prob = 0.15;
} else if (r > 0.7) {
ordinance_giveLev2_bool = true;
ordinance_giveLev3_prob = 0.11;
} else {
ordinance_giveLev2_bool = false;
ordinance_giveLev3_prob = 0.11;
}
if (ordinance_giveLev2_bool) {
if (worldScripts['Missiles & Bombs']) {
ordinance_available.push(
'EQ_RMB_FRAG_MISSILE',
'EQ_RMB_OVERRIDE_MISSILE',
'EQ_RMB_LAW_MISSILE',
'EQ_RMB_INTERCEPT_MISSILE',
'EQ_RMB_INTERCEPT_MISSILE',
'EQ_RMB_INTERCEPT_MISSILE'
);
}
if (EquipmentInfo.infoForKey('EQ_TORPEDO_MISSILE')) {
ordinance_available.push(
'EQ_TORPEDO_MISSILE'
);
}
if (EquipmentInfo.infoForKey('EQ_HARPOON_NUKE1_MISSILE')) {
ordinance_available.push(
'EQ_HARPOON_NUKE1_MISSILE'
);
}
if (worldScripts['armoury_trackerWorldScript.js']) {
ordinance_available.push(
'EQ_ARMOURY_STUNBOMB_MINE'
);
if (this.ship.equipmentStatus('EQ_CLOAKING_DEVICE') != 'EQUIPMENT_OK') {
ordinance_available.push(
'EQ_KDRONE_LAUNCHER_MINE',
'EQ_CDRONE_LAUNCHER_MINE'
);
}
}
if (EquipmentInfo.infoForKey('EQ_NEXUS_BUG_MISSILE')) {
ordinance_available.push(
'EQ_NEXUS_PREMIUM_MISSILE'
);
if (r > 0.9) {
ordinance_available.push(
'EQ_NEXUS_PREMIUM_MISSILE'
);
} else {
ordinance_available.push(
'EQ_NEXUS_BASIC_MISSILE'
);
}
}
}
i = ordinance_available.length;
while (i--) {
ordinance_available.push(
'EQ_HARDENED_MISSILE'
);
}
/*
---------------
Award ordinance
---------------
*/
if (Math.random() <= ordinance_giveLev3_prob) {
this.ship.awardEquipment(
'EQ_QC_MINE'
);
--ordinance_capacity;
}
i = ordinance_capacity - 1;
do {
this.ship.awardEquipment(
ordinance_available[~~(Math.random() * l)]
);
}
while (i--);
}
/*
-------------------------------------------------------------------
BOUNTY
NB: This script is used not only for hunters but also for assassins.
-------------------------------------------------------------------
*/
if (r2 > 0.7) {
if (r < 0.9) {
this.ship.bounty += ~~1 + (r * 32);
// _Sic_ - 'r', not 'r2'.
} else {
this.ship.bounty += ~~2 + (r * 120);
}
}
/*
--------
CLEAN UP
--------
*/
delete this.shipSpawned;
};
/*
----------------------
JSLINT: end of wrapper
----------------------
*/
}).call(this);
// EOF |
| Scripts/ferdelance3G_milInterstellar.js |
/*
//////////////////////////////////////////////////////////////////////////////////
This file: ferdelance3G_milInterstellar.js
Associated AI: ferdelance3G_milInterstellarAI.plist
Part of: Fer-de-Lance 3G OXP
Author: UK_Eliter
License: 2017 Creative Commons: attribution, non-commercial, sharealike
//////////////////////////////////////////////////////////////////////////////////
*/
/*
==============
LINTER OPTIONS
==============
*/
/* jshint esversion: 6 */
/* jshint -W030 */
/* jshint -W069 */
/*
======
HEADER
======
*/
this.name = 'ferdelance3G_milInterstellar.js';
this.author = 'UK_Eliter';
this.copyright = '';
this.description = 'A script for NPCs';
this.license = 'CC-by-nc-sa 3.0';
/*
==================
DEBUGGING SWITCHES
==================
*/
this.dbg = false; // NB
if (this.dbg) {
this.ship.reportAIMessages = true;
}
/*
========================
JSLINT: start of wrapper
========================
*/
(function() {
'use strict';
/*
--------------
EVENT HANDLERS
--------------
*/
this.shipSpawned = function() {
/*
----------------------------------
Determine ordinance we might award
----------------------------------
*/
const
oxp = {
armoury: !!worldScripts['armoury_trackerWorldScript'],
extraBugs: !!worldScripts['extraThargoids_populator'],
missilesAndBombs: !!worldScripts['Missiles & Bombs'],
nexus: !!EquipmentInfo.infoForKey('EQ_NEXUS_BUG_MISSILE'),
TCAT: !!worldScripts['TCAT_masterScript']
};
var
ordinance_available = [],
ordinance_shipSlots = this.ship.missileordinance_shipSlots;
if ( this.ship.hasRole('ferdelance3Bugblatter') ) {
/*
BUGBLATTER
*/
ordinance_available = [
'EQ_F3G_ANTISWEEP_MISSILE',
'EQ_F3G_ANTISWEEP_MISSILE',
'EQ_HARDENED_MISSILE'
];
if (oxp.nexus) {
ordinance_available.push(
'EQ_NEXUS_BUG_MISSILE',
'EQ_NEXUS_BUG_MISSILE'
);
} else if (oxp.missilesAndBombs) {
ordinance_available.push(
'EQ_RMB_THARGOID_MISSILE',
'EQ_RMB_THARGOID_MISSILE'
);
}
if (oxp.armoury) {
ordinance_available.push(
'EQ_ARMOURY_SCREAMER_MINE'
);
}
if (oxp.TCAT) {
ordinance_available.push(
'EQ_TCAT_JAMMER_MINE'
);
}
} else {
/*
NORMAL
*/
ordinance_available =
[
'EQ_F3G_ANTISWEEP_MISSILE',
'EQ_F3G_ANTISWEEP_MISSILE',
'EQ_HARDENED_MISSILE',
'EQ_HARDENED_MISSILE'
];
if (oxp.extraBugs) {
ordinance_available.push(
'EQ_F3G_ANTISWEEP_MISSILE'
);
}
if (oxp.nexus === true) {
ordinance_available.push(
'EQ_NEXUS_BUG_MISSILE',
'EQ_NEXUS_BUG_MISSILE'
);
if (oxp.missilesAndBombs) {
ordinance_available.push(
'EQ_RMB_THARGOID_MISSILE'
);
}
} else if (oxp.missilesAndBombs) {
ordinance_available.push(
'EQ_RMB_THARGOID_MISSILE',
'EQ_RMB_THARGOID_MISSILE'
);
} else if ( EquipmentInfo.infoForKey('EQ_MILITARY_MISSILE') ) {
ordinance_available.push(
'EQ_MILITARY_MISSILE',
'EQ_MILITARY_MISSILE',
'EQ_MILITARY_MISSILE'
);
}
}
/*
----------------------------
Allocate available ordinance
----------------------------
*/
ordinance_shipSlots = this.ship.missileordinance_shipSlots;
const l = ordinance_available.length;
var i = ordinance_shipSlots - 1;
do {
this.ship.awardEquipment(ordinance_available[~~(Math.random() * l)]);
}
while (i--);
};
/*
-------------
ENTITY PICKER
-------------
*/
this.$isSuitableNavy = function(e) {
return e.isShip &&
(e.scanClass === 'CLASS_MILITARY') &&
(e.mass > 20000000);
};
/*
---------------------
ROUTINES CALLED BY AI
---------------------
*/
this.$_seekAttackTarget = function() {
if (!this.ship || !this.ship.isPiloted) return;
const s = this.ship.checkScanner(true);
if (s.length === 0) return;
var
i,
targets_primary = [],
targets_quaternary = [],
targets_secondary = [],
targets_tertiary = [];
while (i--) {
if (
s[0] &&
s[0].isValid &&
e.isShip && (
( e.isThargoid && e.primaryRole !== 'thargoidRebel' ) ||
e.primaryRole === scorpax
)
) {
if ( s[i].hasRole('extraThargoids_sweeper') || s[i].mass > 4600000 ) {
targets_primary.push(s[i]);
} else if ( s[i].mass > 900000 ) {
targets_secondary.push(s[i]);
} else if ( s[i].mass > 75000 ) {
targets_tertiary.push(s[i]);
} else {
targets_quaternary.push(s[i]);
}
}
}
const targets = targets_primary + targets_secondary + targets_tertiary + targets_quaternary;
if ( targets.length === 0 ) {
this.ship.reactToAIMessage('NOTHING_FOUND');
return;
}
if ( targets.length === 1 || (Math.random() < 0.6) ) {
this.ship.target = targets[0];
this.ship.reactToAIMessage('TARGET_FOUND');
return;
}
if ( targets.length === 2 || (Math.random() < 0.7) ) {
this.ship.target = targets[1];
this.ship.reactToAIMessage('TARGET_FOUND');
return;
}
this.ship.target = targets[3];
this.ship.reactToAIMessage('TARGET_FOUND');
};
this.$_seekNavy = function() {
const s = system.filteredEntities(
this,
this.$isSuitableNavy,
this.ship,
50000
);
if (s.length > 0) {
if ((s.length === 1) || (Math.random() < 0.7)) {
this.ship.target = s[0];
} else {
this.ship.target = s[1];
}
this.ship.reactToAIMessage('TARGET_FOUND');
} else {
this.ship.reactToAIMessage('NOTHING_FOUND');
}
};
// Called, only, by ferdelance3G_milInterstellarAI.
this.$_setMisJump = function() {
const r = Math.random();
this.ship.scriptedMisjump = true;
if (r < 0.4) {
this.ship.scriptedMisjumpRange = r * 2;
}
};
/*
---------
DEBUGGING
---------
*/
//this.messagePlayerIfPlayerWithinScannerRangeOfShip = function(text)
//{
// if (!this.ship.isValid) {return;}
// if (!player.ship.isValid) {return;}
// if ( this.ship.position.distanceTo(player.ship.position) < 23000 ) {player.consoleMessage(text, 6);}
//}
//
//
//this.message = function(text) {player.consoleMessage(text, 6);}
/*
----------------------
JSLINT: end of wrapper
----------------------
*/
}).call(this);
// EOF |
| Scripts/ferdelance3G_pirate.js |
/*
//////////////////////////////////////////////////////////////////////////////////
This file: ferdelance3G_pirate.js
Associated AI: None / auto_ai
Part of: Fer-de-Lance 3G OXP
Author: UK_Eliter
License: 2017 Creative Commons: attribution, non-commercial, sharealike
//////////////////////////////////////////////////////////////////////////////////
*/
/*
===================
JSLINT: set options
===================
*/
/*jshint esversion: 6*/
/*jshint sub:true*/
this.name = 'ferdelance3G_pirate';
this.author = 'UK_Eliter';
this.copyright = '';
this.description = 'ferdelance3G_pirate.js (for NPCs)';
this.license = 'CC-by-nc-sa 3.0';
/*
==================
DEBUGGING SWITCHES
==================
*/
// this.logging = true;
this.dbg = false;
if (this.dbg) {
this.ship.reportAIMessages = true;
}
/*
========================
JSLINT: start of wrapper
========================
*/
(function() {
'use strict';
/*
==============
EVENT HANDLERS
==============
*/
this.shipSpawned = function()
{
/*
----------------------------------
Determine ordinance we might award
----------------------------------
*/
var
i,
l,
ordinance_available = [],
ordinance_available_lev2_bool = false,
ordinance_available_lev3_prob = 0.11;
if (this.ship.hasRole('ferdelance3G_+T')) {
ordinance_available_lev2_bool = true;
if (this.ship.hasRole('ferdelance3G_pirateKing')) {
this.ship.bounty += 50 + ~~((Math.random() * 120) + 1);
ordinance_available_lev3_prob = 0.8;
}
} else if (Math.random() > 0.6) {
ordinance_available_lev2_bool = true;
}
if (ordinance_available_lev2_bool) {
if (worldScripts['Missiles & Bombs']) {
ordinance_available.push(
'EQ_RMB_FRAG_MISSILE',
'EQ_RMB_OVERRIDE_MISSILE',
'EQ_RMB_INTERCEPT_MISSILE',
'EQ_RMB_INTERCEPT_MISSILE');
}
if (worldScripts['armoury_trackerWorldScript.js']) {
ordinance_available.push('EQ_ARMOURY_STUNBOMB_MINE');
if (this.ship.equipmentStatus('EQ_CLOAKING_DEVICE') != 'EQUIPMENT_OK') {
ordinance_available.push(
'EQ_KDRONE_LAUNCHER_MINE',
'EQ_CDRONE_LAUNCHER_MINE');
}
}
if (EquipmentInfo.infoForKey('EQ_TORPEDO_MISSILE')) {
ordinance_available.push('EQ_TORPEDO_MISSILE');
}
if (EquipmentInfo.infoForKey('EQ_HARPOON_NUKE1_MISSILE')) {
ordinance_available.push('EQ_HARPOON_NUKE1_MISSILE');
}
if (EquipmentInfo.infoForKey('EQ_NEXUS_BUG_MISSILE')) {
if (Math.random() > 0.25) {
ordinance_available.push('EQ_NEXUS_BASIC_MISSILE');
} else {
ordinance_available.push('EQ_NEXUS_PREMIUM_MISSILE');
}
}
if (Math.random() < ordinance_available_lev3_prob) {
ordinance_available.push('EQ_QC_MINE');
}
}
// Ensure there is at least one item in the ordinance list (so that we can triple the list and not get zero).
ordinance_available.push('EQ_HARDENED_MISSILE');
// Triple the size of ordinance_available by adding, for every entry present already, a normal missile and a hardhead.
i = ordinance_available.length;
while (i--) {
ordinance_available.push('EQ_MISSILE');
ordinance_available.push('EQ_HARDENED_MISSILE');
}
/*
---------------
Award ordinance
---------------
*/
l = ordinance_available.length;
i = this.ship.missileCapacity;
do {
this.ship.awardEquipment(ordinance_available[~~(Math.random() * l)]);
}
while (i--);
/*
--------
Clean up
--------
*/
delete this.shipSpawned;
};
/*
======================
JSHINT: end of wrapper
======================
*/
}).call(this);
// EOF |
| Scripts/ferdelance3G_populator.js |
/*
///////////////////////////////////////////////////////////////////////////////////
This file: ferdelance3G_populator.js
Part of: Fer-de-Lance 3G OXP
Author: UK_Eliter
License: 2017 Creative Commons: attribution, non-commercial, sharealike.
NB: This script requires a world-scripts.plist file.
///////////////////////////////////////////////////////////////////////////////////
*/
/*
===================
JSLINT: set options
===================
*/
/*jshint esversion: 6*/
/*jshint sub:true*/
this.name = 'ferdelance3G_populator';
this.author = 'UK_Eliter';
this.copyright = '2014 Creative Commons: attribution, non-commercial, sharealike.';
this.licence = 'CC-NC-SA 4';
this.description = 'Fer-de-Lance 3G populator script';
/*
==================
DEBUGGING SWITCHES
==================
*/
// this.logging = true;
this.consoleDebugMessages = false; // to disable this, set it to false. DO NOT comment it out. EDIT: er, why?
/*
=======
GLOBALS
=======
*/
this.militaryInterstellar_threeG_radius = 2200;
/*
========================
JSLINT: start of wrapper
========================
*/
(function () {
'use strict';
/*
---------------------------
INTERSTELLAR (re)population
---------------------------
*/
this.interstellarSpaceWillPopulate = function () {
if (Math.random() < 0.9) {
return;
}
system.setPopulator('ferdelance3G_interstellar', {
priority: 300,
callback: this._addinterstellar3Gs.bind(this)
});
};
this._addinterstellar3Gs = function () {
const
farPosition = new Vector3D([500000, 500000, 500000]),
num_threeG = ~~(1 + (Math.random() * 8)),
witchpoint = new Vector3D(); // This initialises the vector to [0, 0, 0].
var i;
// First: create far from witchpoint - in order to avoid rings.
const s = system.addShips(
'ferdelance3G_interstellar',
num_threeG,
farPosition,
this.militaryInterstellar_threeG_radius
);
// Now move
if (s) {
const offset = new Vector3D(witchpoint).subtract(farPosition);
i = s.length;
while (i--)
if (s[i].isValid) s[i].position = s[i].position.add(offset);
}
};
this.interstellarSpaceWillRepopulate = function () {
/*
It is important for smooth gameplay that this function runs very quickly. If calculations are needed, run as many as possible in the populator function to save the result.
Note re Interstellar Tweaks OXP: that function will stop this routine being called, except in 'unchanged# or 'modified' scenarios. For 'new' scenarios, InterstellarTweaks can itself spawn 3Gs.
*/
if (this.threeG_addNoMore === true) {
return;
}
if (!player.ship.isValid) {
return;
}
const num_thargoids = system.countShipsWithRole('thargoid');
if (num_thargoids < 5) {
return;
/*
Crude, but the player is unlikely to notice the crudity.
Having an absolute limit also makes it less likely that, in Interstellar Tweak's 'novel scenario', this OXP adds ships to a witchpoint area that the player will very likely never enter.
*/
}
const military = system.entitiesWithScanClass('CLASS_MILITARY');
var num_military = military.length;
if (num_military > num_thargoids) {
return;
}
var threeG_chanceAdd;
if (num_military < 15) {
threeG_chanceAdd = 0.02;
} else {
threeG_chanceAdd = 0.06;
}
const num_thargoidCarriers = system.countShipsWithRole('thargoid_carrier');
if (num_thargoidCarriers > 2) threeG_chanceAdd = threeG_chanceAdd * (num_thargoidCarriers - 1);
if (threeG_chanceAdd > 0.4) threeG_chanceAdd = 0.4;
if (Math.random() > threeG_chanceAdd) {
return;
}
const num_threeG = 3 + ~~((Math.random() * 6) + 1);
system.addGroup(
'ferdelance3G_interstellar',
num_threeG,
[0, 0, 0],
this.militaryInterstellar_threeG_radius
);
if (Math.random() < 0.6) {
this.threeG_addNoMore = true;
}
};
/*
----------------------
POPULATION - STELLAR
Can add, only, hunters
----------------------
*/
this.systemWillPopulate = function () {
if (
!(
(system.government < 3) && (Math.random() < 0.2)
)
) return;
switch (
~~(1 + (Math.random() * 8))
) {
case 1:
system.setPopulator('ferDeLance3G-huntersPO', {
groupCount: 1,
priority: 150,
location: 'PLANET_ORBIT',
callback: this._addHunter.bind(this)
});
break;
case 2:
system.setPopulator('ferDeLance3G-huntersLWP', {
groupCount: 1,
priority: 111,
location: 'LANE_WP',
callback: this._addHunter.bind(this)
});
break;
case 3:
system.setPopulator('ferDeLance3G-huntersOS', {
groupCount: 1,
priority: 150,
location: 'OUTER_SYSTEM',
callback: this._addHunter.bind(this)
});
break;
case 4:
system.setPopulator('ferDeLance3G-huntersSA', {
groupCount: 1,
priority: 150,
location: 'STATION_AEGIS',
callback: this._addHunter.bind(this)
});
break;
case 5:
system.setPopulator('ferDeLance3G-huntersWP', {
groupCount: 1,
priority: 110,
location: 'WITCHPOINT',
callback: this._addHunter.bind(this)
});
break;
case 6:
system.setPopulator('ferDeLance3G-huntersSOL', {
groupCount: 1,
priority: 150,
location: 'STAR_ORBIT_LOW',
callback: this._addHunter.bind(this)
});
break;
default:
system.setPopulator('ferDeLance3G-huntersLWPS', {
groupCount: 1,
priority: 111,
location: 'LANE_WPS',
callback: this._addHunter.bind(this)
});
}
};
this._addHunter = function (pos) {
const s = system.addShips('ferdelance3G_hunter', 1, pos, 35000);
};
/*
----------------------
JSLINT: end of wrapper
----------------------
*/
}).call(this);
// EOF |
| Scripts/ferdelance3G_trader.js |
/*
//////////////////////////////////////////////////////////////////////////////////
This file: ferdelance3G_trader.js
Associated AI: None / auto_ai
Part of: Fer-de-Lance 3G OXP
Author: UK_Eliter
License: 2017 Creative Commons: attribution, non-commercial, sharealike
//////////////////////////////////////////////////////////////////////////////////
*/
/*
===================
JSLINT: set options
===================
*/
/*jshint esversion: 6*/
/*jshint sub:true*/
this.name = "ferdelance3G_trader";
this.author = "UK_Eliter";
this.copyright = "";
this.description = "ferdelance3G_hunter.js (for NPCs)";
this.license = "CC-by-nc-sa 3.0";
/*
==================
DEBUGGING SWITCHES
==================
*/
// this.logging = true;
this.dbg = false;
if (this.dbg) {
this.ship.reportAIMessages = true;
}
/*
========================
JSLINT: start of wrapper
========================
*/
(function () {
"use strict";
/*
-------------------------
EVENT HANDLERS
(except incoming missile)
-------------------------
*/
this.shipSpawned = function () {
/*
----------------------------------
Determine ordinance we might award
----------------------------------
*/
var
ordinance_available = [
"EQ_MISSILE",
"EQ_MISSILE",
"EQ_MISSILE", "EQ_HARDENED_MISSILE",
"EQ_HARDENED_MISSILE"
],
ordinance_giveLev2_bool = false,
ordinance_giveLev3_prob = 0.1;
if (this.ship.hasRole("ferdelance3G_+T")) {
ordinance_giveLev2_bool = true;
ordinance_giveLev3_prob = 0.17;
} else if (Math.random() > 0.8) {
ordinance_giveLev2_bool = true;
}
if (ordinance_giveLev2_bool) {
if (worldScripts["Missiles & Bombs"]) {
ordinance_available.push(
"EQ_RMB_FRAG_MISSILE",
"EQ_RMB_OVERRIDE_MISSILE",
"EQ_RMB_LAW_MISSILE",
"EQ_RMB_INTERCEPT_MISSILE",
"EQ_RMB_INTERCEPT_MISSILE",
"EQ_RMB_INTERCEPT_MISSILE"
);
}
if (EquipmentInfo.infoForKey("EQ_TORPEDO_MISSILE")) {
ordinance_available.push("EQ_TORPEDO_MISSILE");
}
if (EquipmentInfo.infoForKey("EQ_HARPOON_NUKE1_MISSILE")) {
ordinance_available.push("EQ_HARPOON_NUKE1_MISSILE");
}
if (worldScripts["armoury_trackerWorldScript.js"]) {
ordinance_available.push("EQ_ARMOURY_STUNBOMB_MINE");
if (this.ship.equipmentStatus("EQ_CLOAKING_DEVICE") != "EQUIPMENT_OK") {
ordinance_available.push(
"EQ_KDRONE_LAUNCHER_MINE",
"EQ_CDRONE_LAUNCHER_MINE"
);
}
}
if (EquipmentInfo.infoForKey("EQ_NEXUS_BUG_MISSILE")) {
ordinance_available.push(
"EQ_NEXUS_PREMIUM_MISSILE"
);
if (Math.random() > 0.2) {
ordinance_available.push(
"EQ_NEXUS_BASIC_MISSILE");
} else {
ordinance_available.push(
"EQ_NEXUS_PREMIUM_MISSILE");
}
}
if (Math.random() <= ordinance_giveLev3_prob) {
ordinance_available.push("EQ_QC_MINE");
}
}
/*
---------------
Award ordinance
---------------
*/
var
i = this.ship.missileCapacity - 1,
l = ordinance_available.length;
do {
this.ship.awardEquipment(ordinance_available[~~(Math.random() * l)]);
}
while (i--);
/*
--------
CLEAN UP
--------
*/
delete this.shipSpawned;
};
/*
======================
JSLINT: end of wrapper
======================
*/
}).call(this);
// EOF |