2007-07-14 13:53:50 +00:00
|
|
|
/*
|
|
|
|
|
2008-03-10 00:01:30 +00:00
|
|
|
oolite-cloaking-device-mission.js
|
2007-07-14 13:53:50 +00:00
|
|
|
|
|
|
|
Script for cloaking device mission.
|
2008-02-03 15:44:24 +00:00
|
|
|
|
2007-07-14 13:53:50 +00:00
|
|
|
|
|
|
|
Oolite
|
2010-07-03 18:45:37 +00:00
|
|
|
Copyright © 2004-2010 Giles C Williams and contributors
|
2007-07-14 13:53:50 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
MA 02110-1301, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-05-22 22:45:02 +00:00
|
|
|
/*jslint bitwise: true, undef: true, eqeqeq: true, immed: true, newcap: true*/
|
|
|
|
/*global galaxyNumber, missionVariables, system*/
|
|
|
|
|
|
|
|
|
|
|
|
this.name = "oolite-cloaking-device";
|
|
|
|
this.author = "Jens Ayton";
|
2010-07-03 18:45:37 +00:00
|
|
|
this.copyright = "© 2007-2010 the Oolite team.";
|
2009-05-22 22:45:02 +00:00
|
|
|
this.description = "Cloaking device mission in galaxy 5.";
|
2010-06-13 15:40:59 +00:00
|
|
|
this.version = "1.75";
|
2007-07-14 13:53:50 +00:00
|
|
|
|
|
|
|
|
2008-02-17 00:50:01 +00:00
|
|
|
this.shipWillExitWitchspace = function ()
|
2007-07-14 13:53:50 +00:00
|
|
|
{
|
|
|
|
// If we're in galaxy 5...
|
2009-05-22 22:45:02 +00:00
|
|
|
if (galaxyNumber === 4)
|
2007-07-14 13:53:50 +00:00
|
|
|
{
|
|
|
|
// ...and the asp-cloaked's death_actions haven't triggered...
|
2009-05-22 22:45:02 +00:00
|
|
|
if (missionVariables.cloak === null)
|
2007-07-14 13:53:50 +00:00
|
|
|
{
|
|
|
|
// ...then we count of jumps...
|
2009-05-22 22:45:02 +00:00
|
|
|
if (!missionVariables.cloakcounter)
|
|
|
|
{
|
|
|
|
missionVariables.cloakcounter = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
missionVariables.cloakcounter++;
|
|
|
|
}
|
2007-07-14 13:53:50 +00:00
|
|
|
|
|
|
|
// ...until we reach six or more.
|
2009-05-22 22:45:02 +00:00
|
|
|
if (missionVariables.cloakcounter > 6 && system.countShipsWithRole("asp-cloaked") === 0)
|
2007-07-14 13:53:50 +00:00
|
|
|
{
|
|
|
|
// Then trigger the ambush!
|
|
|
|
system.legacy_addShips("asp-cloaked", 1);
|
|
|
|
system.legacy_addShips("asp-pirate", 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-05-22 22:45:02 +00:00
|
|
|
};
|