#library "MSXSTRIFE"
#include "zcommon.acs"

// Replaces the AlienSpectre's native death function. Sends logs to the comm 
// unit, gives QuestItems, prints "You killed ___!" messages, etc. Script
// originally by Xaser for use with Psychic.
script "AlienSpectreDeath" (int specNum){
	SetActivator(0,AAPTR_PLAYER1); 
	switch(specNum){
	case 1:     // Programmer's Spectre (the one fought in the Ruins)
		Floor_LowerToLowest(999,8); 
		SendToCommunicator(95,0,0,0); break;
	case 2:     // Bishop's Spectre
		PrintBold(l:"TXT_KILLED_BISHOP"); 
		SendToCommunicator(74,0,0,0); 
		GiveInventory("QuestItem21",1); 
		break;
	case 3:     // Oracle's Spectre
		PrintBold(l:"TXT_KILLED_ORACLE"); 
		Thing_Destroy(900,0); 
		Door_Open(222,8); 
		GiveInventory("QuestItem23",1);
		if(CheckInventory("QuestItem21")){
			GiveInventory("QuestItem22",1);}// If bishop is dead, mark Oracle dead too.
		if(!CheckInventory("QuestItem24")){
			SendToCommunicator(87,0,0,0);} // If Macil still alive...
		else{
			SendToCommunicator(85,0,0,0);}
		break;
	case 4:     // Macil's Spectre
		PrintBold(l:"TXT_KILLED_MACIL");
		GiveInventory("QuestItem24",1); //Macil dead.
		if(!CheckInventory("QuestItem25")){
			SendToCommunicator(79,0,0,0);}// If Conversion Chapel mission not complete...
		else{
			SendToCommunicator(106,0,0,0);}
		break;
	case 5:     // Loremaster's Spectre
		PrintBold(l:"TXT_KILLED_LOREMASTER"); 
		Floor_LowerToLowest(666,8); 
		GiveInventory("QuestItem25",1); // Loremaster dead.
		if(CheckInventory("EntityKey")>=5){
			SendToCommunicator(85,0,0,0);} // If all five Spectres have been killed, it's time to go to the ship.
		else{
			SendToCommunicator(83,0,0,0);} // Otherwise, you've got at least one more to go.
		break;}}