"use strict";
this.name = "IR-anarchist.js";
this.author = "Ramirez";
this.copyright = "November 2010";
this.description = "Ship script for anarchist targets";
this.version = "2.0";

//-------------------------------------------------------------------------------------------------------------
this.shipDied = function () {
	if (this.ship.primaryRole == "IR-anarchypython-alt" || this.ship.primaryRole == "IR-anarchypython") {
		if (missionVariables.IR_status == "IR_LOA_2") {
			++missionVariables.IR_pythonCount;
			worldScripts["IR-mfd.js"].$updateMFD("IR_anarchist_destroyed", {count: missionVariables.IR_pythonCount});
			if (missionVariables.IR_pythonCount == missionVariables.IR_pythonCount_max) {
				worldScripts["IR-mfd.js"].$updateMFD("IR_anarchist_comm", null, null, expandMissionText("IR_cherkasova_key"));
				worldScripts["IR-main-script.js"]._setInstructionsKey("IR_LOA_brief_3", "IR-main-script.js");
				mission.markSystem({name:"IR-main-script.js", system:149});
				missionVariables.IR_status = "IR_LOA_3";
			}
		}
	}
}

//-------------------------------------------------------------------------------------------------------------
this.shipLaunchedFromStation = function () {
	if (this.ship.primaryRole == "police" || this.ship.primaryRole == "defence_ship") { 
		this.ship.setAI("IR-piratepatrolAI.plist");
	}
}

//-------------------------------------------------------------------------------------------------------------
this.shipBeingAttacked = function(whom) {
	var grp = worldScripts["IR-main-script.js"]._pirate_group;
	for (var i = 0; i < grp.ships.length; i++) {
		if (!grp.ships[i].target) {
			grp.ships[i].target = whom;
			grp.ships[i].performAttack();
		}
	}
}
